-
Notifications
You must be signed in to change notification settings - Fork 13
feat: add activties.yaml #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
99c2c77
10f08d5
9ed68a4
dd0ea1a
91b97ac
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,16 +4,6 @@ | |
|
|
||
| $errorMsg = array(); | ||
| $implementationReferenceFile = "src/assets/YAML/default/implementations.yaml"; | ||
| $metadata = readYaml("src/assets/YAML/meta.yaml"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I just saw your comment about compatibility, @wurstbrot. We still need these lines to be compatible with |
||
|
|
||
| $teams = $metadata["teams"]; | ||
| if (sizeof($teams) == 0) { | ||
| echo "Warning: No teams defined"; | ||
| } | ||
| $teamsImplemented = array(); | ||
| foreach ($teams as $team) { | ||
| $teamsImplemented[$team] = false; | ||
| } | ||
|
|
||
| $files = glob("src/assets/YAML/default/*/*.yaml"); | ||
| $dimensions = array(); | ||
|
|
@@ -89,29 +79,6 @@ | |
| if (!array_key_exists("tags", $activity)) { | ||
| $dimensionsAggregated[$dimension][$subdimension][$activityName]["tags"] = ["none"]; | ||
| } | ||
| if (!array_key_exists("teamsImplemented", $activity)) { | ||
| $dimensionsAggregated[$dimension][$subdimension][$activityName]["teamsImplemented"] = array(); | ||
| } | ||
| $evidenceImplemented = array(); | ||
| if (array_key_exists("teamsEvidence", $activity) && is_array($activity["teamsEvidence"]) && IS_IMPLEMENTED_WHEN_EVIDENCE) { | ||
| foreach ($activity["teamsEvidence"] as $team => $evidenceForTeam) { | ||
| if(!is_string($activity["teamsEvidence"][$team])) { | ||
| echo "teamsEvidence for team $team in $activityName is not a string, ignoring"; | ||
| continue; | ||
| } | ||
| if (strlen($activity["teamsEvidence"][$team]) > 0) { | ||
| $evidenceImplemented[$team] = true; | ||
| } else { | ||
| echo "Warning: '$activityName -> evidence -> $team' has no evidence set but should have"; | ||
| } | ||
| } | ||
| } | ||
| $dimensionsAggregated[$dimension][$subdimension][$activityName]["teamsImplemented"] = | ||
| array_merge( | ||
| $teamsImplemented, | ||
| $dimensionsAggregated[$dimension][$subdimension][$activityName]["teamsImplemented"], | ||
| $evidenceImplemented | ||
| ); | ||
| if (!array_key_exists("openCRE", $activity["references"])) { | ||
| $dimensionsAggregated[$dimension][$subdimension][$activityName]["references"]["openCRE"] = array(); | ||
| $dimensionsAggregated[$dimension][$subdimension][$activityName]["references"]["openCRE"][] = "https://www.opencre.org/rest/v1/standard/DevSecOps+Maturity+Model+(DSOMM)/" . $subdimension . "/" . $dimensionsAggregated[$dimension][$subdimension][$activityName]["uuid"]; | ||
|
|
@@ -193,12 +160,33 @@ | |
| } | ||
|
|
||
|
|
||
| // Store generated data | ||
| // Store generated data with meta document first | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great! 🙂 |
||
| $metaDocument = array( | ||
| 'meta' => array( | ||
| 'version' => '__VERSION_PLACEHOLDER__', | ||
| 'released' => date('Y-m-d'), | ||
| 'publisher' => 'https://github.com/devsecopsmaturitymodel/DevSecOps-MaturityModel-data/' | ||
| ) | ||
| ); | ||
|
|
||
| $metaString = yaml_emit($metaDocument); | ||
| $dimensionsString = yaml_emit($dimensionsAggregated); | ||
|
|
||
| // Combine both documents with proper YAML document separators | ||
| // Remove trailing ... from meta document and add proper separator | ||
| $metaString = rtrim($metaString); | ||
| if (substr($metaString, -3) === '...') { | ||
| $metaString = substr($metaString, 0, -3); | ||
| } | ||
|
|
||
| $targetGeneratedFile = getcwd() . "/src/assets/YAML/generated/generated.yaml"; | ||
| echo "\nStoring to $targetGeneratedFile\n"; | ||
| file_put_contents($targetGeneratedFile, $dimensionsString); | ||
|
|
||
| $combinedYaml = $metaString . $dimensionsString; | ||
| $targetGeneratedFile = getcwd() . "/src/assets/YAML/activities.yaml"; | ||
| echo "\nStoring to $targetGeneratedFile\n"; | ||
| file_put_contents($targetGeneratedFile, $combinedYaml); | ||
|
|
||
| // Store dependency graph | ||
| $graphFilename = getcwd() . "/src/assets/YAML/generated/dependency-tree.md"; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref the discussion we had regarding having the generated and input source files in the same folder, @wurstbrot:
What about keeping the source yaml files as they are, and move
generatedfolder to root? Then it is not undersrcand will be obvious for anyone downloading the project.(And we don't need to rename
/yaml-generationto/scripts, btw. It's just a suggestion to make things more self explanatory. But it will have a side-effect on trigering the php file.)