@@ -310,7 +310,7 @@ jobs:
310
310
311
311
VERSION : ${{ needs.configuration.outputs.version }}
312
312
313
- trivy -scan :
313
+ vulnerability -scan :
314
314
name : " Scan Images for Vulnerabilities"
315
315
needs :
316
316
- configuration
@@ -330,14 +330,81 @@ jobs:
330
330
- name : Scan Images for Vulnerabilities
331
331
shell : bash
332
332
env :
333
- INSTALLER_IMAGE_BASE_REPO : ${{needs.configuration.outputs.image_repo_base}}
333
+ NODE_OPTIONS : " --max_old_space_size=4096"
334
+ JAVA_HOME : /home/gitpod/.sdkman/candidates/java/current
335
+ VERSION : ${{needs.configuration.outputs.version}}
336
+ PR_NO_CACHE : ${{needs.configuration.outputs.build_no_cache}}
337
+ PR_NO_TEST : ${{needs.configuration.outputs.build_no_test}}
338
+ NPM_AUTH_TOKEN : " ${{ secrets.NPM_AUTH_TOKEN }}"
339
+ PUBLISH_TO_NPM : ${{ needs.configuration.outputs.publish_to_npm == 'true' || needs.configuration.outputs.is_main_branch == 'true' }}
340
+ JB_MARKETPLACE_PUBLISH_TOKEN : " ${{ secrets.JB_MARKETPLACE_PUBLISH_TOKEN }}"
341
+ PUBLISH_TO_JBPM : ${{ needs.configuration.outputs.publish_to_jbmp == 'true' || needs.configuration.outputs.is_main_branch == 'true' }}
342
+ CODECOV_TOKEN : " ${{ secrets.CODECOV_TOKEN }}"
343
+ LEEWAY_REMOTE_CACHE_BUCKET : ${{needs.configuration.outputs.leeway_cache_bucket}}
344
+ IMAGE_REPO_BASE : ${{needs.configuration.outputs.image_repo_base}}/build
345
+
346
+ # SCM tokens for integration tests
347
+ GITPOD_TEST_TOKEN_BITBUCKET : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET }}"
348
+ GITPOD_TEST_TOKEN_BITBUCKET_SERVER : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET_SERVER }}"
349
+ GITPOD_TEST_TOKEN_BITBUCKET_SERVER_WRITE : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET_SERVER_WRITE }}"
350
+ GITPOD_TEST_TOKEN_BITBUCKET_SERVER_READ : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET_SERVER_READ }}"
351
+ GITPOD_TEST_TOKEN_GITHUB : " ${{ secrets.GITPOD_TEST_TOKEN_GITHUB }}"
352
+ GITPOD_TEST_TOKEN_GITLAB : " ${{ secrets.GITPOD_TEST_TOKEN_GITLAB }}"
353
+ GITPOD_TEST_TOKEN_AZURE_DEVOPS : " ${{ secrets.GITPOD_TEST_TOKEN_AZURE_DEVOPS }}"
334
354
run : |
335
- ./scripts/trivy/trivy-scan-images.sh ${{ needs.configuration.outputs.version }} CRITICAL
336
- exit $?
355
+ [[ "$PR_NO_CACHE" = "true" ]] && CACHE="none" || CACHE="remote"
356
+ [[ "$PR_NO_TEST" = "true" ]] && TEST="--dont-test" || TEST=""
357
+ [[ "${PUBLISH_TO_NPM}" = 'true' ]] && NPM_PUBLISH_TRIGGER=$(date +%s%3N) || NPM_PUBLISH_TRIGGER="false"
358
+
359
+ # tmp: Update leeway from branch to make testing easier
360
+ LEEWAY_BRANCH=clu/sbom-cve-2
361
+ LEEWAY_REPO_DIR=$(mktemp -d -t leeway-repo-XXXXXXXXXX) && git clone https://github.com/gitpod-io/leeway "$LEEWAY_REPO_DIR" && cd "$LEEWAY_REPO_DIR" && git switch ${LEEWAY_BRANCH} && git pull && go build -ldflags="-X github.com/gitpod-io/leeway/pkg/leeway.Version=0.10.2.sbom" -o leeway && sudo install -m 755 leeway /usr/bin/ && cd - && rm -rf "$LEEWAY_REPO_DIR"
337
362
363
+ RESULT=0
364
+
365
+ sboms_dir=$(mktemp -d)
366
+ CI= leeway -v sbom export --with-dependencies --output-dir "$sboms_dir" \
367
+ -Dversion=$VERSION \
368
+ --docker-build-options network=host \
369
+ --max-concurrent-tasks 1 \
370
+ -DlocalAppVersion=$VERSION \
371
+ -DpublishToNPM="${PUBLISH_TO_NPM}" \
372
+ -DnpmPublishTrigger="${NPM_PUBLISH_TRIGGER}" \
373
+ -DpublishToJBMarketplace="${PUBLISH_TO_JBPM}" \
374
+ -DimageRepoBase=$IMAGE_REPO_BASE
375
+
376
+ scans_dir=$(mktemp -d)
377
+ CI= leeway -v sbom scan --with-dependencies --output-dir "$scans_dir" \
378
+ -Dversion=$VERSION \
379
+ --docker-build-options network=host \
380
+ --max-concurrent-tasks 1 \
381
+ -DlocalAppVersion=$VERSION \
382
+ -DpublishToNPM="${PUBLISH_TO_NPM}" \
383
+ -DnpmPublishTrigger="${NPM_PUBLISH_TRIGGER}" \
384
+ -DpublishToJBMarketplace="${PUBLISH_TO_JBPM}" \
385
+ -DimageRepoBase=$IMAGE_REPO_BASE
386
+
387
+ {
388
+ echo "leeway_sboms_dir=$sboms_dir"
389
+ echo "leeway_vulnerability_reports_dir=$scans_dir"
390
+ } >> $GITHUB_OUTPUT
391
+
392
+ cat "$scans_dir/vulnerability-summary.md" >> $GITHUB_STEP_SUMMARY
393
+ - name : Upload SBOMs
394
+ uses : actions/upload-artifact@v4
395
+ if : success()
396
+ with :
397
+ name : sboms
398
+ path : ${{ steps.scan.outputs.leeway_sboms_dir }}
399
+ - name : Upload vulnerability reports
400
+ uses : actions/upload-artifact@v4
401
+ if : success()
402
+ with :
403
+ name : vulnerability-reports
404
+ path : ${{ steps.scan.outputs.leeway_vulnerability_reports_dir }}
338
405
install-app :
339
406
runs-on : ${{ needs.create-runner.outputs.label }}
340
- needs : [ configuration, build-gitpod, trivy -scan, create-runner ]
407
+ needs : [ configuration, build-gitpod, vulnerability -scan, create-runner ]
341
408
if : ${{ needs.configuration.outputs.is_main_branch == 'true' }}
342
409
strategy :
343
410
fail-fast : false
@@ -375,7 +442,7 @@ jobs:
375
442
- configuration
376
443
- build-previewctl
377
444
- build-gitpod
378
- - trivy -scan
445
+ - vulnerability -scan
379
446
- infrastructure
380
447
- create-runner
381
448
runs-on : ${{ needs.create-runner.outputs.label }}
0 commit comments