@@ -309,35 +309,79 @@ 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-core-dev/dev/dev-environment:main-gha.32399
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
313+ id : scan
331314 shell : bash
332315 env :
333- INSTALLER_IMAGE_BASE_REPO : ${{needs.configuration.outputs.image_repo_base}}
316+ NODE_OPTIONS : " --max_old_space_size=4096"
317+ JAVA_HOME : /home/gitpod/.sdkman/candidates/java/current
318+ VERSION : ${{needs.configuration.outputs.version}}
319+ PR_NO_CACHE : ${{needs.configuration.outputs.build_no_cache}}
320+ PR_NO_TEST : ${{needs.configuration.outputs.build_no_test}}
321+ NPM_AUTH_TOKEN : " ${{ secrets.NPM_AUTH_TOKEN }}"
322+ PUBLISH_TO_NPM : ${{ needs.configuration.outputs.publish_to_npm == 'true' || needs.configuration.outputs.is_main_branch == 'true' }}
323+ JB_MARKETPLACE_PUBLISH_TOKEN : " ${{ secrets.JB_MARKETPLACE_PUBLISH_TOKEN }}"
324+ PUBLISH_TO_JBPM : ${{ needs.configuration.outputs.publish_to_jbmp == 'true' || needs.configuration.outputs.is_main_branch == 'true' }}
325+ CODECOV_TOKEN : " ${{ secrets.CODECOV_TOKEN }}"
326+ LEEWAY_REMOTE_CACHE_BUCKET : ${{needs.configuration.outputs.leeway_cache_bucket}}
327+ IMAGE_REPO_BASE : ${{needs.configuration.outputs.image_repo_base}}/build
328+
329+ # SCM tokens for integration tests
330+ GITPOD_TEST_TOKEN_BITBUCKET : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET }}"
331+ GITPOD_TEST_TOKEN_BITBUCKET_SERVER : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET_SERVER }}"
332+ GITPOD_TEST_TOKEN_BITBUCKET_SERVER_WRITE : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET_SERVER_WRITE }}"
333+ GITPOD_TEST_TOKEN_BITBUCKET_SERVER_READ : " ${{ secrets.GITPOD_TEST_TOKEN_BITBUCKET_SERVER_READ }}"
334+ GITPOD_TEST_TOKEN_GITHUB : " ${{ secrets.GITPOD_TEST_TOKEN_GITHUB }}"
335+ GITPOD_TEST_TOKEN_GITLAB : " ${{ secrets.GITPOD_TEST_TOKEN_GITLAB }}"
336+ GITPOD_TEST_TOKEN_AZURE_DEVOPS : " ${{ secrets.GITPOD_TEST_TOKEN_AZURE_DEVOPS }}"
334337 run : |
335- ./scripts/trivy/trivy-scan-images.sh ${{ needs.configuration.outputs.version }} CRITICAL
336- exit $?
338+ [[ "$PR_NO_CACHE" = "true" ]] && CACHE="none" || CACHE="remote"
339+ [[ "$PR_NO_TEST" = "true" ]] && TEST="--dont-test" || TEST=""
340+ [[ "${PUBLISH_TO_NPM}" = 'true' ]] && NPM_PUBLISH_TRIGGER=$(date +%s%3N) || NPM_PUBLISH_TRIGGER="false"
341+
342+ sboms_dir=$(mktemp -d)
343+ CI= leeway sbom export --with-dependencies --output-dir "$sboms_dir" \
344+ -Dversion=$VERSION \
345+ --docker-build-options network=host \
346+ --max-concurrent-tasks 1 \
347+ -DlocalAppVersion=$VERSION \
348+ -DpublishToNPM="${PUBLISH_TO_NPM}" \
349+ -DnpmPublishTrigger="${NPM_PUBLISH_TRIGGER}" \
350+ -DpublishToJBMarketplace="${PUBLISH_TO_JBPM}" \
351+ -DimageRepoBase=$IMAGE_REPO_BASE
337352
353+ scans_dir=$(mktemp -d)
354+ CI= leeway sbom scan --with-dependencies --output-dir "$scans_dir" \
355+ -Dversion=$VERSION \
356+ --docker-build-options network=host \
357+ --max-concurrent-tasks 1 \
358+ -DlocalAppVersion=$VERSION \
359+ -DpublishToNPM="${PUBLISH_TO_NPM}" \
360+ -DnpmPublishTrigger="${NPM_PUBLISH_TRIGGER}" \
361+ -DpublishToJBMarketplace="${PUBLISH_TO_JBPM}" \
362+ -DimageRepoBase=$IMAGE_REPO_BASE
363+
364+ {
365+ echo "leeway_sboms_dir=$sboms_dir"
366+ echo "leeway_vulnerability_reports_dir=$scans_dir"
367+ } >> $GITHUB_OUTPUT
368+
369+ cat "$scans_dir/vulnerability-summary.md" >> $GITHUB_STEP_SUMMARY
370+ - name : Upload SBOMs
371+ uses : actions/upload-artifact@v4
372+ if : success()
373+ with :
374+ name : sboms
375+ path : ${{ steps.scan.outputs.leeway_sboms_dir }}
376+ - name : Upload vulnerability reports
377+ uses : actions/upload-artifact@v4
378+ if : success()
379+ with :
380+ name : vulnerability-reports
381+ path : ${{ steps.scan.outputs.leeway_vulnerability_reports_dir }}
338382 install-app :
339383 runs-on : ${{ needs.create-runner.outputs.label }}
340- needs : [ configuration, build-gitpod, trivy-scan, create-runner ]
384+ needs : [ configuration, build-gitpod, create-runner ]
341385 if : ${{ needs.configuration.outputs.is_main_branch == 'true' }}
342386 strategy :
343387 fail-fast : false
@@ -375,7 +419,6 @@ jobs:
375419 - configuration
376420 - build-previewctl
377421 - build-gitpod
378- - trivy-scan
379422 - infrastructure
380423 - create-runner
381424 runs-on : ${{ needs.create-runner.outputs.label }}
@@ -523,7 +566,6 @@ jobs:
523566 - build-previewctl
524567 - infrastructure
525568 - build-gitpod
526- - trivy-scan
527569 - install-app
528570 - install
529571 - monitoring
0 commit comments