@@ -309,35 +309,78 @@ jobs:
309309 GITHUB_USER : roboquat
310310311311 VERSION : ${{ needs.configuration.outputs.version }}
312-
313- trivy-scan :
314- name : " Scan Images for Vulnerabilities"
315- needs :
316- - configuration
317- - build-gitpod
318- - create-runner
319- runs-on : ${{ needs.create-runner.outputs.label }}
320- container :
321- image : eu.gcr.io/gitpod-dev-artifact/dev/dev-environment:clu-leeway-sbom-scan-gha.32440
322- steps :
323- - uses : actions/checkout@v4
324- - name : Setup Environment
325- uses : ./.github/actions/setup-environment
326- with :
327- identity_provider : ${{ github.ref == 'refs/heads/main' && secrets.CORE_DEV_PROVIDER || secrets.DEV_PREVIEW_PROVIDER }}
328- service_account : ${{ github.ref == 'refs/heads/main' && secrets.CORE_DEV_SA || secrets.DEV_PREVIEW_SA }}
329- leeway_segment_key : ${{ secrets.LEEWAY_SEGMENT_KEY }}
330- - name : Scan Images for Vulnerabilities
312+ - name : Scan for Vulnerabilities
331313 shell : bash
332314 env :
333- INSTALLER_IMAGE_BASE_REPO : ${{needs.configuration.outputs.image_repo_base}}
315+ NODE_OPTIONS : " --max_old_space_size=4096"
316+ JAVA_HOME : /home/gitpod/.sdkman/candidates/java/current
317+ VERSION : ${{needs.configuration.outputs.version}}
318+ PR_NO_CACHE : ${{needs.configuration.outputs.build_no_cache}}
319+ PR_NO_TEST : ${{needs.configuration.outputs.build_no_test}}
320+ NPM_AUTH_TOKEN : " ${{ secrets.NPM_AUTH_TOKEN }}"
321+ PUBLISH_TO_NPM : ${{ needs.configuration.outputs.publish_to_npm == 'true' || needs.configuration.outputs.is_main_branch == 'true' }}
322+ JB_MARKETPLACE_PUBLISH_TOKEN : " ${{ secrets.JB_MARKETPLACE_PUBLISH_TOKEN }}"
323+ PUBLISH_TO_JBPM : ${{ needs.configuration.outputs.publish_to_jbmp == 'true' || needs.configuration.outputs.is_main_branch == 'true' }}
324+ CODECOV_TOKEN : " ${{ secrets.CODECOV_TOKEN }}"
325+ LEEWAY_REMOTE_CACHE_BUCKET : ${{needs.configuration.outputs.leeway_cache_bucket}}
326+ IMAGE_REPO_BASE : ${{needs.configuration.outputs.image_repo_base}}/build
327+
328+ # SCM tokens for integration tests
329+ GITPOD_TEST_TOKEN_BITBUCKET : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET }}"
330+ GITPOD_TEST_TOKEN_BITBUCKET_SERVER : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET_SERVER }}"
331+ GITPOD_TEST_TOKEN_BITBUCKET_SERVER_WRITE : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET_SERVER_WRITE }}"
332+ GITPOD_TEST_TOKEN_BITBUCKET_SERVER_READ : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET_SERVER_READ }}"
333+ GITPOD_TEST_TOKEN_GITHUB : " ${{ secrets.GITPOD_TEST_TOKEN_GITHUB }}"
334+ GITPOD_TEST_TOKEN_GITLAB : " ${{ secrets.GITPOD_TEST_TOKEN_GITLAB }}"
335+ GITPOD_TEST_TOKEN_AZURE_DEVOPS : " ${{ secrets.GITPOD_TEST_TOKEN_AZURE_DEVOPS }}"
334336 run : |
335- ./scripts/trivy/trivy-scan-images.sh ${{ needs.configuration.outputs.version }} CRITICAL
336- exit $?
337+ [[ "$PR_NO_CACHE" = "true" ]] && CACHE="none" || CACHE="remote"
338+ [[ "$PR_NO_TEST" = "true" ]] && TEST="--dont-test" || TEST=""
339+ [[ "${PUBLISH_TO_NPM}" = 'true' ]] && NPM_PUBLISH_TRIGGER=$(date +%s%3N) || NPM_PUBLISH_TRIGGER="false"
340+
341+ sboms_dir=$(mktemp -d)
342+ CI= leeway -v sbom export --with-dependencies --output-dir "$sboms_dir" \
343+ -Dversion=$VERSION \
344+ --docker-build-options network=host \
345+ --max-concurrent-tasks 1 \
346+ -DlocalAppVersion=$VERSION \
347+ -DpublishToNPM="${PUBLISH_TO_NPM}" \
348+ -DnpmPublishTrigger="${NPM_PUBLISH_TRIGGER}" \
349+ -DpublishToJBMarketplace="${PUBLISH_TO_JBPM}" \
350+ -DimageRepoBase=$IMAGE_REPO_BASE
337351
352+ scans_dir=$(mktemp -d)
353+ CI= leeway -v sbom scan --with-dependencies --output-dir "$scans_dir" \
354+ -Dversion=$VERSION \
355+ --docker-build-options network=host \
356+ --max-concurrent-tasks 1 \
357+ -DlocalAppVersion=$VERSION \
358+ -DpublishToNPM="${PUBLISH_TO_NPM}" \
359+ -DnpmPublishTrigger="${NPM_PUBLISH_TRIGGER}" \
360+ -DpublishToJBMarketplace="${PUBLISH_TO_JBPM}" \
361+ -DimageRepoBase=$IMAGE_REPO_BASE
362+
363+ {
364+ echo "leeway_sboms_dir=$sboms_dir"
365+ echo "leeway_vulnerability_reports_dir=$scans_dir"
366+ } >> $GITHUB_OUTPUT
367+
368+ cat "$scans_dir/vulnerability-summary.md" >> $GITHUB_STEP_SUMMARY
369+ - name : Upload SBOMs
370+ uses : actions/upload-artifact@v4
371+ if : success()
372+ with :
373+ name : sboms
374+ path : ${{ steps.scan.outputs.leeway_sboms_dir }}
375+ - name : Upload vulnerability reports
376+ uses : actions/upload-artifact@v4
377+ if : success()
378+ with :
379+ name : vulnerability-reports
380+ path : ${{ steps.scan.outputs.leeway_vulnerability_reports_dir }}
338381 install-app :
339382 runs-on : ${{ needs.create-runner.outputs.label }}
340- needs : [ configuration, build-gitpod, trivy-scan, create-runner ]
383+ needs : [ configuration, build-gitpod, create-runner ]
341384 if : ${{ needs.configuration.outputs.is_main_branch == 'true' }}
342385 strategy :
343386 fail-fast : false
@@ -375,7 +418,6 @@ jobs:
375418 - configuration
376419 - build-previewctl
377420 - build-gitpod
378- - trivy-scan
379421 - infrastructure
380422 - create-runner
381423 runs-on : ${{ needs.create-runner.outputs.label }}
@@ -523,7 +565,6 @@ jobs:
523565 - build-previewctl
524566 - infrastructure
525567 - build-gitpod
526- - trivy-scan
527568 - install-app
528569 - install
529570 - monitoring
0 commit comments