Skip to content

Commit f074984

Browse files
fixup! IONOS(sbom-matrix): add SBOM generation workflow
Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
1 parent cdb2bcb commit f074984

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

.github/workflows/sbom-matrix.yaml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ on:
6262

6363
env:
6464
NODE_OPTIONS: "--max-old-space-size=4096"
65+
PARENT_UUID: "95d97ac1-1e35-49e3-862a-4bb23de9c68e" # @todo: Update to actual UUID of parent project in Dependency Track
6566

6667
jobs:
6768
# Job 1: Extract version information from the repository
@@ -119,6 +120,7 @@ jobs:
119120
"component": [
120121
{
121122
"name": "nextcloud",
123+
"project_name": "HiDrive NEXT Core",
122124
"path": ".",
123125
"has_composer": true,
124126
"has_npm": true,
@@ -128,6 +130,7 @@ jobs:
128130
},
129131
{
130132
"name": "theme-nc-ionos-theme-legacy",
133+
"project_name": "HiDrive NEXT Theme: nc-ionos-theme",
131134
"path": "themes/nc-ionos-theme/IONOS",
132135
"has_composer": false,
133136
"has_npm": true,
@@ -136,6 +139,7 @@ jobs:
136139
},
137140
{
138141
"name": "app-simplesettings",
142+
"project_name": "HiDrive NEXT App: simplesettings",
139143
"path": "apps-custom/simplesettings",
140144
"has_composer": true,
141145
"has_npm": true,
@@ -145,6 +149,7 @@ jobs:
145149
},
146150
{
147151
"name": "app-googleanalytics",
152+
"project_name": "HiDrive NEXT App: googleanalytics",
148153
"path": "apps-custom/googleanalytics",
149154
"has_composer": true,
150155
"has_npm": false,
@@ -153,6 +158,7 @@ jobs:
153158
},
154159
{
155160
"name": "app-ionos-processes",
161+
"project_name": "HiDrive NEXT App: nc_ionos_processes",
156162
"path": "apps-custom/nc_ionos_processes",
157163
"has_composer": true,
158164
"has_npm": false,
@@ -161,6 +167,7 @@ jobs:
161167
},
162168
{
163169
"name": "app-theming",
170+
"project_name": "HiDrive NEXT App: nc_theming",
164171
"path": "apps-custom/nc_theming",
165172
"has_composer": true,
166173
"has_npm": false,
@@ -169,6 +176,7 @@ jobs:
169176
},
170177
{
171178
"name": "app-viewer",
179+
"project_name": "HiDrive NEXT App: viewer",
172180
"path": "apps-external/viewer",
173181
"has_composer": true,
174182
"has_npm": true,
@@ -178,6 +186,7 @@ jobs:
178186
},
179187
{
180188
"name": "app-user_oidc",
189+
"project_name": "HiDrive NEXT App: user_oidc",
181190
"path": "apps-external/user_oidc",
182191
"has_composer": true,
183192
"has_npm": true,
@@ -187,6 +196,7 @@ jobs:
187196
},
188197
{
189198
"name": "app-groupquota",
199+
"project_name": "HiDrive NEXT App: groupquota",
190200
"path": "apps-external/groupquota",
191201
"has_composer": true,
192202
"has_npm": false,
@@ -195,6 +205,7 @@ jobs:
195205
},
196206
{
197207
"name": "app-richdocuments",
208+
"project_name": "HiDrive NEXT App: richdocuments",
198209
"path": "apps-external/richdocuments",
199210
"has_composer": true,
200211
"has_npm": true,
@@ -204,6 +215,7 @@ jobs:
204215
},
205216
{
206217
"name": "app-files_downloadlimit",
218+
"project_name": "HiDrive NEXT App: files_downloadlimit",
207219
"path": "apps-external/files_downloadlimit",
208220
"has_composer": true,
209221
"has_npm": true,
@@ -213,6 +225,7 @@ jobs:
213225
},
214226
{
215227
"name": "app-serverinfo",
228+
"project_name": "HiDrive NEXT App: serverinfo",
216229
"path": "apps-external/serverinfo",
217230
"has_composer": true,
218231
"has_npm": false,
@@ -346,7 +359,7 @@ jobs:
346359
# 4. Uploads each SBOM to the corresponding Dependency Track project
347360
# 5. Uses custom CA certificate for secure communication with Dependency Track
348361
upload-sboms:
349-
needs: [ setup-matrix, generate-sbom ]
362+
needs: [ get-version, setup-matrix, generate-sbom ]
350363
runs-on: self-hosted
351364

352365
steps:
@@ -367,6 +380,7 @@ jobs:
367380
DT_API_KEY: ${{ secrets.DEPENDENCY_TRACK_API_KEY }}
368381
IONOS_CA_CERT: ${{ secrets.IONOS_CA }}
369382
MATRIX_CONTEXT: ${{ needs.setup-matrix.outputs.matrix }}
383+
PARENT_VERSION: ${{ needs.get-version.outputs.project_version }}
370384
VARS_CONTEXT: ${{ toJSon(vars) }}
371385
run: |
372386
# Create temporary CA cert file
@@ -379,6 +393,7 @@ jobs:
379393
upload_bom() {
380394
local bom_file="$1"
381395
local project_id="$2"
396+
local project_name="$3"
382397
383398
if [[ ! -f "$bom_file" ]]; then
384399
echo "Warning: $bom_file not found, skipping..."
@@ -397,6 +412,11 @@ jobs:
397412
-H "Content-Type: multipart/form-data" \
398413
-H "X-API-Key: ${DT_API_KEY}" \
399414
-F "project=${project_id}" \
415+
-F "isLatest=true" \
416+
-F "autoCreate=true" \
417+
-F "parentUUID=${PARENT_UUID}" \
418+
-F "projectName=${PARENT_VERSION}" \
419+
-F "projectVersion=1.0.8" \
400420
-F "bom=@${bom_file}")
401421
402422
http_code=$(echo "$response" | grep -o "HTTPSTATUS:[0-9]*" | cut -d: -f2)
@@ -422,6 +442,7 @@ jobs:
422442
project_id_var_name=$(echo "$component_json" | jq -r '.project_id')
423443
component_name=$(echo "$component_json" | jq -r '.name')
424444
project_id_var_value=$(echo "$VARS_CONTEXT" | jq -r --arg key "$project_id_var_name" '.[$key]')
445+
project_name=$(echo "$component_json" | jq -r '.project_name')
425446
426447
echo "Processing component: ${component_name}"
427448
@@ -439,7 +460,7 @@ jobs:
439460
continue
440461
fi
441462
442-
upload_bom "$bom_file" "$project_id_var_value" || exit 1
463+
upload_bom "$bom_file" "$project_id_var_value" "$project_name" || exit 1
443464
done
444465
445466
# Cleanup

0 commit comments

Comments
 (0)