|
7 | 7 | $inputFolder = "src/assets/YAML"; |
8 | 8 | $implementationReferenceFile = "$inputFolder/default/implementations.yaml"; |
9 | 9 |
|
10 | | -if (getenv('GITHUB_ACTIONS')) { |
| 10 | +if (getenv('DSOMM_VERSION')) { // version comes as an arg to Dockerfile |
11 | 11 | $publisher = 'https://github.com/' . getenv('GITHUB_REPOSITORY'); |
12 | 12 | } else { |
13 | 13 | $publisher = getenv('USERNAME'); |
|
69 | 69 | if (!array_key_exists("level", $activity)) { |
70 | 70 | array_push($errorMsg,"Missing 'level' attribute in activity: '$activityName'"); |
71 | 71 | } |
72 | | - |
| 72 | + |
73 | 73 | // echo "$subdimension | $activityName\n"; |
74 | 74 | if (!array_key_exists("uuid", $activity)) { |
75 | 75 | array_push($errorMsg, "'$activityName' is missing an uuid in '$dimension'"); |
|
98 | 98 | if(!is_string($dependsOnName)) { |
99 | 99 | array_push($errorMsg, "The 'dependsOn' is not a string '" . json_encode($dependsOnName) . "' (in $activityName)"); |
100 | 100 | continue; |
101 | | - } |
| 101 | + } |
102 | 102 |
|
103 | 103 | // Load dependsOnName and dependsOnUuid, depending on actual content |
104 | 104 | $uuidRegExp = "/(uuid:)?\s*([0-9a-f]{6,}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{6,})/"; |
|
109 | 109 | array_push($errorMsg,"DependsOn non-existing activity uuid: $dependsOnUuid (in activity: '$activityName')"); |
110 | 110 | } else if ($matches[1] != "") { |
111 | 111 | echo "WARNING: DependsOn is prefixed by deprecated 'uuid:' for $dependsOnUuid (in activity: '$activityName'). Use activity name, or the uuid only\n"; |
112 | | - } |
| 112 | + } |
113 | 113 | } else { |
114 | 114 | $dependsOnUuid = getUuidByActivityName($dependsOnName, $dimensionsAggregated); |
115 | 115 | if (is_null(getUuidByActivityName($dependsOnName, $dimensionsAggregated))) { |
|
118 | 118 | } |
119 | 119 | // Trick emit_yaml() to have uuid plus a comment in a string. Removed in post-processing below. |
120 | 120 | $dimensionsAggregated[$dimension][$subdimension][$activityName]["dependsOn"][$index] = "{!$dependsOnUuid!}"; |
121 | | - |
| 121 | + |
122 | 122 |
|
123 | 123 | // Build dependency graph |
124 | 124 | if (!array_key_exists($activityName, $activityIndex)) { |
|
243 | 243 | function buildOpenCreUrl($dimension, $subdimension, $activityName) { |
244 | 244 | $baseUrl = "https://www.opencre.org/node/standard/"; |
245 | 245 | $DSOMM = "DevSecOps Maturity Model (DSOMM)"; |
246 | | - $url = $baseUrl . rawurlencode($DSOMM) . |
| 246 | + $url = $baseUrl . rawurlencode($DSOMM) . |
247 | 247 | "/section/" . rawurlencode($subdimension) . |
248 | 248 | "/subsection/" . rawurlencode($activityName); |
249 | 249 | return $url; |
@@ -280,7 +280,7 @@ function assertUniqueRefByKey($references, $keyToAssert, &$errorMsg) { |
280 | 280 | function assertSecureUrlsInRefs($all_references, &$errorMsg) { |
281 | 281 | foreach ($all_references as $references) { |
282 | 282 | foreach ($references as $id => $reference) { |
283 | | - foreach ($reference as $key => $value) { |
| 283 | + foreach ($reference as $key => $value) { |
284 | 284 | if (is_string($value)) { |
285 | 285 | // echo "KEY: $key VAL: " . var_dump($value) . "\n"; |
286 | 286 | if (str_contains($value,'http://')) { |
@@ -326,23 +326,23 @@ function assertLiveUrl($url):string { |
326 | 326 | curl_setopt($curl, CURLOPT_TIMEOUT, 5); |
327 | 327 | curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); |
328 | 328 | $response = curl_exec($curl); |
329 | | - |
| 329 | + |
330 | 330 | if (curl_errno($curl)) { |
331 | 331 | echo curl_error($curl); |
332 | 332 | curl_close($curl); |
333 | 333 | return "No reply"; |
334 | 334 | } |
335 | | - |
| 335 | + |
336 | 336 | // Extract header info |
337 | 337 | $statusCode = curl_getinfo($curl, CURLINFO_HTTP_CODE); |
338 | 338 | $redirectUrl = curl_getinfo($curl, CURLINFO_REDIRECT_URL ); |
339 | 339 |
|
340 | 340 | curl_close($curl); |
341 | 341 |
|
342 | | - if ($statusCode == 200) { |
| 342 | + if ($statusCode == 200) { |
343 | 343 | return ""; |
344 | 344 | } |
345 | | - if ($statusCode == 301 || $statusCode == 302) { |
| 345 | + if ($statusCode == 301 || $statusCode == 302) { |
346 | 346 | return "Status code $statusCode redirects to: $redirectUrl"; |
347 | 347 | } |
348 | 348 | return "Status code: $statusCode: $url"; |
@@ -380,7 +380,7 @@ function yaml_emit_with_header($metaDocument, $document) { |
380 | 380 | // Remove trailing ... from meta document |
381 | 381 | $metaString = substr(rtrim($metaString), 0, -3); |
382 | 382 | } |
383 | | - |
| 383 | + |
384 | 384 | return $metaString . $documentString; |
385 | 385 | } |
386 | 386 |
|
|
0 commit comments