Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion .github/actions/security/snyk-container-scan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ inputs:
projectPrefix:
description: "Project prefix for Snyk dashboard (e.g., 'strimzi')"
required: true
snykMonitorTargetReference:
description: "Value for --target-reference in 'snyk container monitor' (e.g. release version). Defaults to the image tag."
required: false
default: ""
uploadToCodeScanning:
description: "Whether to upload SARIF results to GitHub Code Scanning"
required: false
Expand Down Expand Up @@ -89,13 +93,18 @@ runs:

# Monitor command is used for upload snapshot of the scan to Snyk App where Snyk will do daily scans and can generate reports
- name: Run Snyk monitor
if: ${{ inputs.monitor == 'true' }}
if: ${{ inputs.snykMonitor == 'true' }}
shell: bash
continue-on-error: true
env:
TARGET_REFERENCE: ${{ inputs.snykMonitorTargetReference }}
run: |
if [ -n "$LOADED_IMAGE" ]; then
MONITOR_PROJECT="${LOADED_IMAGE%%:*}"
MONITOR_REVISION="${LOADED_IMAGE##*:}"
if [ -n "$TARGET_REFERENCE" ]; then
MONITOR_REVISION="$TARGET_REFERENCE"
fi
snyk container monitor "$LOADED_IMAGE" \
--project-name="$MONITOR_PROJECT" \
--target-reference="$MONITOR_REVISION"
Expand Down
7 changes: 2 additions & 5 deletions .github/actions/security/snyk-maven-scan/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ runs:

# Monitor command is used for upload snapshot of the scan to Snyk App where Snyk will do daily scans and can generate reports
- name: Run Snyk monitor
if: ${{ inputs.monitor == 'true' }}
if: ${{ inputs.snykMonitor == 'true' }}
shell: bash
continue-on-error: true
env:
PROJECT_PREFIX: ${{ inputs.projectPrefix }}
run: |
REPO_NAME="${GITHUB_REPOSITORY##*/}"
snyk monitor --project-name="${PROJECT_PREFIX}/${REPO_NAME}"
snyk monitor --target-reference="${GITHUB_REF_NAME}"
2 changes: 2 additions & 0 deletions .github/workflows/test-snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ jobs:
imageFile: docker-images/container-archives/${{ matrix.image }}.tar.gz
image: ${{ matrix.image }}
snykMonitor: "false"
snykMonitorTargetReference: "latest"
uploadToCodeScanning: "false"
projectPrefix: test-operators
env:
Expand Down Expand Up @@ -255,6 +256,7 @@ jobs:
image: drain-cleaner-amd64
# Keep false to avoid uploading testing results to Snyk App
snykMonitor: "false"
snykMonitorTargetReference: "latest"
# Keep false to avoid uploading results to GitHub Code Scanning page
uploadToCodeScanning: "false"
projectPrefix: test-drain-cleaner
Expand Down
Loading