Skip to content

Commit

Permalink
Add Integrity protection for Persistent Logs (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-linner-ericsson authored Aug 14, 2024
1 parent f7ed574 commit e929099
Show file tree
Hide file tree
Showing 16 changed files with 2,025 additions and 8 deletions.
6 changes: 3 additions & 3 deletions definition_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from urllib.parse import urlparse
from urllib.request import url2pathname

from jsonref import JsonRef
import jsonref
from ruamel import yaml


Expand All @@ -30,7 +30,7 @@ def load(input_path: Path) -> Dict:
all references resolved.
"""
with input_path.open() as input_file:
return JsonRef.replace_refs(
return jsonref.replace_refs(
yaml.YAML().load(input_file),
base_uri=input_path.resolve().as_uri(),
loader=_yaml_loader,
Expand All @@ -42,7 +42,7 @@ def _yaml_loader(uri: str) -> Dict:
input_path = Path(url2pathname(parsed_uri.path))
with input_path.open() as input_file:
# Maybe JsonRef fixes recursion on its own?
schema = JsonRef.replace_refs(
schema = jsonref.replace_refs(
yaml.YAML().load(input_file),
base_uri=input_path.resolve().as_uri(),
loader=_yaml_loader,
Expand Down
160 changes: 160 additions & 0 deletions definitions/EiffelActivityFinishedEvent/4.1.0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Copyright 2017-2024 Ericsson AB and others.
# For a full list of individual contributors, please see the commit history.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
$schema: https://json-schema.org/draft/2020-12/schema#
_name: EiffelActivityFinishedEvent
_version: 4.1.0
_abbrev: ActF
_description: The EiffelActivityFinishedEvent declares that a previously
started activity (declared by [EiffelActivityTriggeredEvent](./EiffelActivityTriggeredEvent.md)
followed by [EiffelActivityStartedEvent](./EiffelActivityStartedEvent.md))
has finished.
type: object
properties:
meta:
$ref: ../EiffelMetaProperty/4.0.0.yml
data:
type: object
properties:
outcome:
_description: The outcome of the activity.
type: object
properties:
conclusion:
_description: |-
A terse standardized conclusion of the activity, designed to be machine readable.
SUCCESSFUL signifies that the activity was concluded and the outcome matched expectations.
UNSUCCESSFUL signifies that the activity was concluded, but the outcome did not match expectations. To exemplify, a compilation job was successfully invoked, but compilation failed.
FAILED signifies that the activity could not be successfully executed. To exemplify, a compilation could not be invoked, e.g. due to misconfiguration or environment issues.
ABORTED signifies that the activity was aborted before it could be concluded.
TIMED_OUT signifies that the activity did not conclude within the allowed time frame.
INCONCLUSIVE signifies that the outcome of the activity could not be determined.
type: string
enum:
- SUCCESSFUL
- UNSUCCESSFUL
- FAILED
- ABORTED
- TIMED_OUT
- INCONCLUSIVE
description:
_description: A verbose description of the activity outcome,
designed to provide human readers with further information.
type: string
required:
- conclusion
persistentLogs:
$ref: ../EiffelPersistentLogsProperty/1.0.0.yml
customData:
type: array
items:
$ref: ../EiffelCustomDataProperty/2.0.0.yml
additionalProperties: false
required:
- outcome
links:
type: array
contains:
type: object
properties:
type:
enum:
- ACTIVITY_EXECUTION
items:
$ref: ../EiffelEventLink/2.0.0.yml
required:
- meta
- data
- links
additionalProperties: false
_links:
ACTIVITY_EXECUTION:
description: Declares the activity execution that was finished.
In other words, [EiffelActivityTriggeredEvent](../eiffel-vocabulary/EiffelActivityTriggeredEvent.md)
acts as a handle for the activity execution. This differs from
__CONTEXT__. In __ACTIVITY_EXECUTION__ the source carries information
pertaining to the target (i.e. the activity started, finished
or was canceled). In __CONTEXT__, on the other hand, the source
constitutes a subset of the target (e.g. this test case was executed
as part of that activity or test suite).
required: true
multiple: false
targets:
any_type: false
types:
- EiffelActivityTriggeredEvent
CAUSE:
description: 'Identifies a cause of the event occurring. SHOULD
not be used in conjunction with __CONTEXT__: individual events
providing __CAUSE__ within a larger context gives rise to ambiguity.
It is instead recommended to let the root event of the context
declare __CAUSE__.'
required: false
multiple: true
targets:
any_type: true
types: []
CONTEXT:
description: Identifies the activity or test suite of which this
event constitutes a part.
required: false
multiple: false
targets:
any_type: false
types:
- EiffelActivityTriggeredEvent
- EiffelTestSuiteStartedEvent
FLOW_CONTEXT:
description: 'Identifies the flow context of the event: which is
the continuous integration and delivery flow in which this occurred
– e.g. which product, project, track or version this is applicable
to.'
required: false
multiple: true
targets:
any_type: false
types:
- EiffelFlowContextDefinedEvent
_history:
- version: 4.1.0
changes: Add `data.persistentLogs.integrityProtection.{alg, digest}` (see [Issue 358](https://github.com/eiffel-community/eiffel/issues/358)).
- version: 4.0.0
changes: Update meta schema to Draft 2020-12 and add link validation.
- version: 3.3.0
introduced_in: edition-arica
changes: Add schema URL to the meta object (see [Issue 280](https://github.com/eiffel-community/eiffel/issues/280)).
- version: 3.2.0
introduced_in: edition-lyon
changes: Add links.domainId member (see [Issue 233](https://github.com/eiffel-community/eiffel/issues/233)).
- version: 3.1.0
introduced_in: edition-lyon
changes: Add `data.persistentLogs.{mediaType,tags}`.
- version: 3.0.0
introduced_in: edition-agen
changes: Improved information integrity protection (see [Issue
185](https://github.com/eiffel-community/eiffel/issues/185)).
- version: 2.0.0
introduced_in: edition-agen
changes: Introduced purl identifiers instead of GAVs (see [Issue
182](https://github.com/eiffel-community/eiffel/issues/182))
- version: 1.1.0
introduced_in: edition-toulouse
changes: Multiple links of type FLOW_CONTEXT allowed.
- version: 1.0.0
introduced_in: edition-bordeaux
changes: Initial version.
_examples:
- title: Simple example
url: ../examples/events/EiffelActivityFinishedEvent/simple.json
Loading

0 comments on commit e929099

Please sign in to comment.