Update snyk-test.yaml #190
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Snyk Scan | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: main | |
env: | |
IMAGE_NAME: nodejs-goof | |
PLATFORM: linux-arm64 | |
jobs: | |
build: | |
name: Snyk Scan | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Build project | |
run: npm install --legacy-peer-deps | |
- name: Setup Snyk + snyk-filter # For information about the required commands https://docs.snyk.io/scm-ide-and-ci-cd-integrations/snyk-ci-cd-integrations | |
run: | | |
npm install snyk snyk-filter -g | |
snyk auth ${{ secrets.SNYK_TOKEN }} | |
- name: Snyk Open Source | |
run: snyk monitor --all-projects --tags="component=pkg:${{ github.repository }}@${{ github.ref_name }}" --org=${{ secrets.SNYK_ORG_ID }} # snyk-filter --json --print-deps | snyk-delta --setPassIfNoBaseline false | |
# run: snyk test--org=XXX ---project-name=XXX - Use snyk monitor command to upload the results to the UI | |
continue-on-error: true | |
- name: Snyk Code | |
run: snyk code test | |
continue-on-error: true | |
- name: Snyk Container | |
run: | | |
docker build -f ./Dockerfile . --tag ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }} --platform=linux/arm64 } | |
snyk container test ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }} --file=Dockerfile --exclude-app-vulns --platform=linux/arm64 | |
# Rename your image, for uploading directly to your snyk org please use the command "snyk container monitor $container_name/$tag --org=$ORG_ID" | |
continue-on-error: true | |
- name: Snyk IaC | |
run: snyk iac test | |
continue-on-error: true | |
- name: Snyk Container Monitor | |
run: | | |
snyk container monitor "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.PLATFORM }}" \ | |
--file=Dockerfile --exclude-app-vulns --platform=linux/arm64 \ | |
--tags="component=pkg:${{ github.repository }}@${{ github.ref_name }}" | |
continue-on-error: true | |
- name: Snyk SBOM generate | |
run: snyk container sbom --format=spdx2.3+json --name="${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ env.PLATFORM }}" --file=Dockerfile --platform=linux/arm64 > bom.spdx.json | |
continue-on-error: true | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v4.3.5 | |
with: | |
name: snyk SBOM | |
path: bom.spdx.json |