Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: update snyk docker action to snyk cli #241

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions .github/workflows/docker-build-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,21 @@ jobs:
- name: Run promtool checks
run: for FILE in ${{ github.workspace }}/monitoring-as-code/output/prometheus-rules/*-rules.yaml; do docker run -v ${{ github.workspace }}/monitoring-as-code:${{ github.workspace }}/data ${{env.REGISTRY}}/${{env.USER}}/${{env.PROMTOOL_IMAGE_NAME}}:${{env.PROMTOOL_VERSION}} check rules ${{ github.workspace }}/data/output/prometheus-rules/$(basename $FILE); if [ $? -ne 0 ]; then echo "Validation of rules files failed for $(basename $FILE) - exiting"; exit 1; fi done

# Snyk security scan of Dockerfile and Built Docker Image with unmanaged dependencies
- name: Run Snyk to check Docker file for vulnerabilities
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 16.17.0

- name: Setup Snyk
run: |
npm install snyk -g
snyk auth ${{secrets.SNYK_TOKEN}}

- name: Snyk Container Scan
id: snyk-dockerfile
run: |
snyk container test --file=./monitoring-as-code/Dockerfile --sarif-file-output=snyk.sarif --app-vulns --severity-threshold=medium ${{ steps.meta.outputs.tags }}
continue-on-error: true
uses: snyk/actions/[email protected]
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
image: ${{ steps.meta.outputs.tags }}
args: |
--file=./monitoring-as-code/Dockerfile
--severity-threshold=medium
--app-vulns
--sarif-file-output=snyk.sarif

- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v2
Expand All @@ -92,4 +93,4 @@ jobs:
run: exit 1

- name: Push image to GitHub Container Registry
run: docker push ${{ steps.meta.outputs.tags }}
run: docker push ${{ steps.meta.outputs.tags }}