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
42 changes: 42 additions & 0 deletions .github/scripts/install-docker-scout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
# Installs the Docker Scout CLI as a Docker CLI plugin, pinned by version and
# SHA-256.
#
# This replaces docker/scout-action, which downloads its own binary through
# the GitHub API without authentication. That API allows 60 requests an hour
# per IP address, which shared GitHub-hosted runners exhaust, so the action
# failed at random with "Unexpected HTTP response: 403". Release downloads
# from github.com are not subject to that limit, and are retried here.
#
# To upgrade: set SCOUT_VERSION and copy both linux checksums from
# https://github.com/docker/scout-cli/releases/download/v<version>/docker-scout_<version>_checksums.txt
set -euo pipefail

SCOUT_VERSION=1.30.0
SHA256_AMD64=bd8d24896d2aa0f9e01d25830ac53cfd416a3254f8fbfce2cb10bcd7a1afe152
SHA256_ARM64=4396c268e310d692e2f1aeb41945e7acbb1829e0ab3d938f0bc9304de70cffaf

case "$(uname -m)" in
x86_64) arch=amd64 sha256="$SHA256_AMD64" ;;
aarch64 | arm64) arch=arm64 sha256="$SHA256_ARM64" ;;
*)
echo "unsupported runner architecture: $(uname -m)" >&2
exit 1
;;
esac

archive="docker-scout_${SCOUT_VERSION}_linux_${arch}.tar.gz"
url="https://github.com/docker/scout-cli/releases/download/v${SCOUT_VERSION}/${archive}"
work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT

curl --fail --silent --show-error --location \
--retry 5 --retry-all-errors --retry-delay 5 \
--output "$work/$archive" "$url"
echo "$sha256 $work/$archive" | sha256sum --check --quiet

tar -xzf "$work/$archive" -C "$work" docker-scout
plugins="${DOCKER_CONFIG:-$HOME/.docker}/cli-plugins"
mkdir -p "$plugins"
install -m 0755 "$work/docker-scout" "$plugins/docker-scout"
docker scout version
35 changes: 15 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: hadolint/hadolint-action@v3.5.0

- name: Lint shell scripts
run: shellcheck rootfs/docker-entrypoint.sh rootfs/docker-entrypoint.d/*.sh tests/smoke.sh
run: shellcheck rootfs/docker-entrypoint.sh rootfs/docker-entrypoint.d/*.sh tests/smoke.sh .github/scripts/*.sh

- name: Lint workflows
uses: docker://rhysd/actionlint:1.7.12
Expand Down Expand Up @@ -126,30 +126,25 @@ jobs:
# Docker Scout uses its own vulnerability data, which can disagree with
# Trivy's (CVE-2026-107891 in musl was reported only by Scout). This is
# what Docker Hub shows for the image, so the build has to pass it too.
# Needs the Docker Hub credentials; skipped without them.
# Needs the Docker Hub credentials (from the login step above); skipped
# without them. Uses the Scout CLI rather than docker/scout-action: see
# .github/scripts/install-docker-scout.sh for why.
- name: Install Docker Scout
if: env.DOCKERHUB_PASSWORD != ''
run: .github/scripts/install-docker-scout.sh

- name: Scan image with Docker Scout
if: env.DOCKERHUB_PASSWORD != ''
uses: docker/scout-action@b265cd48f8a1451d2680815b3e8dc4ed65ee16e7 # v1.30.0
with:
command: cves
image: local://nginx:ci
platform: ${{ matrix.platform }}
only-fixed: true
exit-code: true
write-comment: false
dockerhub-user: ${{ vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ env.DOCKERHUB_PASSWORD }}
env:
PLATFORM: ${{ matrix.platform }}
run: docker scout cves --only-fixed --exit-code --platform "$PLATFORM" local://nginx:ci

# Report only: what Docker Scout currently says about the published
# image for this platform, for comparison with the build above.
- name: Docker Scout report for the published image
if: env.DOCKERHUB_PASSWORD != ''
continue-on-error: true
uses: docker/scout-action@b265cd48f8a1451d2680815b3e8dc4ed65ee16e7 # v1.30.0
with:
command: cves
image: registry://docker.io/${{ vars.DOCKERHUB_IMAGE || format('{0}/nginx', vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME) }}:latest
platform: ${{ matrix.platform }}
write-comment: false
dockerhub-user: ${{ vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ env.DOCKERHUB_PASSWORD }}
env:
PLATFORM: ${{ matrix.platform }}
PUBLISHED: docker.io/${{ vars.DOCKERHUB_IMAGE || format('{0}/nginx', vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME) }}:latest
run: docker scout cves --platform "$PLATFORM" "registry://$PUBLISHED"
16 changes: 7 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,15 @@ jobs:

# Same check as Docker Hub's own scanner, so a release is not published
# with a finding Docker Hub would show. Runs when Docker Hub is set up.
# Scout CLI rather than docker/scout-action: see
# .github/scripts/install-docker-scout.sh. Uses the Docker Hub login above.
- name: Install Docker Scout
if: steps.registries.outputs.dockerhub == 'true'
run: .github/scripts/install-docker-scout.sh

- name: Scan image with Docker Scout
if: steps.registries.outputs.dockerhub == 'true'
uses: docker/scout-action@b265cd48f8a1451d2680815b3e8dc4ed65ee16e7 # v1.30.0
with:
command: cves
image: local://nginx:release-test
only-fixed: true
exit-code: true
write-comment: false
dockerhub-user: ${{ vars.DOCKERHUB_USERNAME || secrets.DOCKERHUB_USERNAME }}
dockerhub-password: ${{ secrets.DOCKERHUB_PASSWORD }}
run: docker scout cves --only-fixed --exit-code local://nginx:release-test

- name: Log in to GHCR
uses: docker/login-action@v4
Expand Down