-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsnyk-cd-test.yaml
More file actions
67 lines (58 loc) · 2.3 KB
/
snyk-cd-test.yaml
File metadata and controls
67 lines (58 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Snyk CI Tests
## requires SNYK_TOKEN and SNYK_ORG_ID secret
on:
workflow_dispatch:
pull_request:
branches: main
push:
branches: main
env:
IMAGE_NAME: nodejs-goof-insights
IMAGE_TAG: v1.1.0
PLATFORM: linux/amd64
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
SNYK_ORG_ID: ${{ secrets.SNYK_ORG_ID }}
jobs:
build:
name: Snyk Scan
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v2
with:
node-version: 20.x
- 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 $SNYK_TOKEN --auth-type=token
- name: Snyk Open Source
run: |
snyk monitor --file=./package.json --tags="component=pkg:${{ github.repository }}@${{ github.ref_name }}" \
--org=${{ secrets.SNYK_ORG_ID }} --project-name=${{ env.REPO_NAME }} \
--remote-repo-url=${{ github.repository }} --target-reference=${{ github.repository }}
- name: Snyk IaC
run: snyk iac test --report --org=${{ secrets.SNYK_ORG_ID }}
continue-on-error: true
# upload container snapshot to snyk
- name: Snyk Container Monitor
run: |
snyk container monitor "${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}" \
--file=Dockerfile --exclude-app-vulns --platform=${{ env.PLATFORM }} \
--tags="component=pkg:${{ github.repository }}@${{ github.ref_name }}" \
--org=${{ secrets.SNYK_ORG_ID }} --target-reference=${{ github.repository }}
continue-on-error: true
- name: Snyk SBOM generate
run: |
snyk container sbom --format=spdx2.3+json \
${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} > bom.${{ env.IMAGE_NAME }}.spdx.json
continue-on-error: true
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4.3.5
with:
name: snyk SBOM
path: bom.${{ env.IMAGE_NAME }}.spdx.json
continue-on-error: true