Skip to content

Commit

Permalink
Uses snyk instead of docker_scan-lint
Browse files Browse the repository at this point in the history
Move to .github/draft
  • Loading branch information
mjanez committed Sep 14, 2023
1 parent 74835ef commit ea1abe5
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 12 deletions.
33 changes: 33 additions & 0 deletions .github/draft/docker_scan-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Scan & lint ckan-pycsw images

on:
# Trigger the workflow after docker.yml
workflow_run:
workflows: ['Build ckan-pycsw images']
branches: ['main', 'latest']
pull_request:
branches: ['main']
types:
- completed

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
CONTEXT: .
DOCKERFILE_PATH: /ckan-pycsw
DOCKERFILE: Dockerfile

jobs:
image_scan:
runs-on: ubuntu-latest
steps:
- name: Scan & lint image
uses: ISID/[email protected]
with:
tag: ${{ env.IMAGE_NAME }}
path: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}
dockerfile: ${{ env.DOCKERFILE }}
hadolint-severity: error
dockle-severity: FATAL
trivy-severity: HIGH,CRITICAL

36 changes: 30 additions & 6 deletions .github/workflows/docker-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,34 @@ jobs:
context: ${{ env.CONTEXT }}
file: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE }}

-
name: Scan image
uses: ISID/[email protected]
scan_docker_image:
permissions:
id-token: read
contents: read
packages: read
runs-on: ubuntu-latest
needs: [ docker ]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Scan Docker image
uses: snyk/actions/docker@master
continue-on-error: true
with:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
args: --file=Dockerfile --severity-threshold=high --sarif-file-output=snyk.sarif
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Upload Snyk report as sarif
uses: github/codeql-action/upload-sarif@v2
with:
tag: ${{ env.IMAGE_NAME }}
path: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}
dockerfile: ${{ env.DOCKERFILE }}
sarif_file: snyk.sarif
36 changes: 30 additions & 6 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,34 @@ jobs:
context: ${{ env.CONTEXT }}
file: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}/${{ env.DOCKERFILE }}

-
name: Scan image
uses: ISID/[email protected]
scan_docker_image:
permissions:
id-token: read
contents: read
packages: read
runs-on: ubuntu-latest
needs: [ docker ]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Scan Docker image
uses: snyk/actions/docker@master
continue-on-error: true
with:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
args: --file=Dockerfile --severity-threshold=high --sarif-file-output=snyk.sarif
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

- name: Upload Snyk report as sarif
uses: github/codeql-action/upload-sarif@v2
with:
tag: ${{ env.IMAGE_NAME }}
path: ${{ env.CONTEXT }}${{ env.DOCKERFILE_PATH }}
dockerfile: ${{ env.DOCKERFILE }}
sarif_file: snyk.sarif

0 comments on commit ea1abe5

Please sign in to comment.