Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-main-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,7 @@ jobs:
run-grype-image:
name: 'Grype Docker image scan'
if: ${{ inputs.perform-grype-image-scan }}
uses: chef/common-github-actions/.github/workflows/grype.yml@main
uses: chef/common-github-actions/.github/workflows/grype.yml@add-plpgsql-support
needs: checkout
secrets: inherit
with:
Expand Down
22 changes: 18 additions & 4 deletions .github/workflows/grype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Configure git for private
env:
GOPRIVATE: ${{ inputs.go-private-modules }}
Expand Down Expand Up @@ -78,13 +78,27 @@ jobs:
if [ -f "build-docker.sh" ]; then
echo "Found build-docker.sh script - using it to build images"
chmod +x build-docker.sh
# Snapshot image names before build to detect newly built images
BEFORE_IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -v "^<none>" | sort)
GITHUB_TOKEN="${{ secrets.GH_TOKEN }}" ./build-docker.sh
# Detect all images built (typically repo name or repo-name-init)
IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -E "^${REPO_NAME}" | grep -v "^<none>")
# Detect newly built images by comparing before/after snapshots
AFTER_IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -v "^<none>" | sort)
IMAGES=$(comm -13 <(echo "$BEFORE_IMAGES") <(echo "$AFTER_IMAGES"))
if [ -n "$IMAGES" ]; then
echo "Detected newly built images via before/after diff"
fi
# Fallback: try matching by repo name prefix
if [ -z "$IMAGES" ]; then
IMAGES=$(docker images --format "{{.Repository}}:{{.Tag}}" | grep -E "^${REPO_NAME}" | grep -v "^<none>")
fi
if [ -z "$IMAGES" ]; then
echo "⚠️ No images found with prefix ${REPO_NAME} after build-docker.sh"
echo "⚠️ No images found after build-docker.sh"
echo "Checking for any recently built images..."
IMAGES=$(docker images --format "{{.CreatedAt}}\t{{.Repository}}:{{.Tag}}" | sort -r | head -5 | cut -f2 | grep -v "^<none>")
fi
Expand Down