Skip to content

Commit

Permalink
Scan Docker images in Snyk Github action (close #299)
Browse files Browse the repository at this point in the history
  • Loading branch information
spenes committed Dec 1, 2023
1 parent 493353a commit 362011d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 30 deletions.
41 changes: 33 additions & 8 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ jobs:
echo "VERSION file ${{steps.version.outputs.VERSION_FILE}} does not match tagged version ${{ github.ref }}"
exit 1
- name: Snyk Setup
uses: snyk/actions/setup@master

- name: Run Snyk to check for vulnerabilities
run: snyk test --project-name=snowbridge --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Install ngrok
run: |
mkdir -p $GITHUB_WORKSPACE/bin
Expand All @@ -73,6 +65,39 @@ jobs:
- name: Run e2e tests
run: make e2e-test

- name: Snyk Setup
uses: snyk/actions/setup@master

- name: Run Snyk to check for vulnerabilities in main Docker image
run: snyk container test snowplow/snowbridge:${{ github.ref_name }} --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Run Snyk to check for vulnerabilities in aws-only Docker image
run: snyk container test snowplow/snowbridge:${{ github.ref_name }}-aws-only --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Run Snyk to monitor for vulnerabilities in main Docker image
uses: snyk/actions/docker@master
if: ${{ !contains(github.ref, 'rc') }}
with:
image: "snowplow/snowbridge:${{ github.ref_name }}"
args: "--app-vulns --org=data-processing-new --project-name=snowbridge-main"
command: monitor
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Run Snyk to monitor for vulnerabilities in aws-only Docker image
uses: snyk/actions/docker@master
if: ${{ !contains(github.ref, 'rc') }}
with:
image: "snowplow/snowbridge:${{ github.ref_name }}-aws-only"
args: "--app-vulns --org=data-processing-new --project-name=snowbridge-aws-only"
command: monitor
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Create Release
uses: actions/create-release@v1
env:
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ jobs:
check-latest: true
cache: true

- name: Extract project version from file
id: version
run: |
echo ::set-output name=VERSION::"$(cat VERSION)"
- name: Block Concurrent Executions of Integration Tests
if: ${{ env.NGROK_TOKEN != '' }}
uses: softprops/turnstyle@v1
Expand Down Expand Up @@ -60,8 +65,13 @@ jobs:
- name: Snyk Setup
uses: snyk/actions/setup@master

- name: Run Snyk to check for vulnerabilities
run: snyk test --project-name=snowbridge --severity-threshold=high
- name: Run Snyk to check for vulnerabilities in main Docker image
run: snyk container test snowplow/snowbridge:${{steps.version.outputs.VERSION}} --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Run Snyk to check for vulnerabilities in aws-only Docker
run: snyk container test snowplow/snowbridge:${{steps.version.outputs.VERSION}}-aws-only --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/snyk.yml

This file was deleted.

0 comments on commit 362011d

Please sign in to comment.