Skip to content

Commit

Permalink
Scan Docker images in Snyk Github action (close #90)
Browse files Browse the repository at this point in the history
  • Loading branch information
spenes committed Dec 4, 2023
1 parent b8da747 commit 644ea20
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 32 deletions.
34 changes: 22 additions & 12 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,32 @@ jobs:
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Publish docker image locally for Snyk action
run: make docker-build

- name: Run Snyk to monitor vulnerabilities in Docker image
uses: snyk/actions/docker@master
if: ${{ !contains(github.ref, 'rc') }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: Version ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
image: "snowplow/dataflow-runner:${{ github.ref_name }}"
args: "--app-vulns --org=data-processing-new"
command: monitor
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Upload release binaries
uses: alexellis/upload-assets@0.2.3
- name: Create GitHub release and attach artifacts
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_paths: '["./build/bin/*.zip"]'
draft: true
prerelease: ${{ contains(github.ref , '-') }}
name: Version ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
files: |
build/bin/dataflow_runner_${{ github.ref_name }}_darwin_amd64.zip
build/bin/dataflow_runner_${{ github.ref_name }}_linux_amd64.zip
build/bin/dataflow_runner_${{ github.ref_name }}_windows_amd64.zip
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,23 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Extract project version from file
id: version
run: |
echo ::set-output name=VERSION::"$(cat VERSION)"
- name: Run tests
run: |
export PATH="$PATH:/tmp/consul/"
make test
- name: Publish docker image locally for Snyk action
run: make docker-build

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

- name: Run Snyk to check for vulnerabilities in Docker image
run: snyk container test snowplow/dataflow-runner:${{steps.version.outputs.VERSION}} --severity-threshold=high
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
20 changes: 0 additions & 20 deletions .github/workflows/snyk.yml

This file was deleted.

0 comments on commit 644ea20

Please sign in to comment.