From abf2f53fee31cbe94ba8fe0137c81ad6d74dc876 Mon Sep 17 00:00:00 2001 From: Jamie Magee Date: Thu, 25 Apr 2024 16:57:50 -0700 Subject: [PATCH] Sign remaining images with cosign --- .github/workflows/images-latest.yml | 10 ++++++++-- .github/workflows/images-updater-core.yml | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.github/workflows/images-latest.yml b/.github/workflows/images-latest.yml index 63e8d83e21a..3f170068ed9 100644 --- a/.github/workflows/images-latest.yml +++ b/.github/workflows/images-latest.yml @@ -1,7 +1,7 @@ name: Latest images env: UPDATER_IMAGE: "ghcr.io/dependabot/dependabot-updater-" -on: # yamllint disable-line rule:truthy +on: # yamllint disable-line rule:truthy push: branches: - main @@ -27,6 +27,7 @@ jobs: needs: date-version permissions: contents: read + id-token: write packages: write strategy: fail-fast: false @@ -60,6 +61,8 @@ jobs: with: submodules: recursive + - uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0 + - name: Build the dependabot-updater- image # despite the script input being $NAME, the resulting image is dependabot-updater-${ECOSYSTEM} run: script/build ${NAME} @@ -74,7 +77,10 @@ jobs: run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Push the images to GHCR - run: docker push --all-tags "${UPDATER_IMAGE}${ECOSYSTEM}" + run: | + docker push --all-tags "${UPDATER_IMAGE}${ECOSYSTEM}" + # All tags should resolve to the same digest so we only need to look up one of them + cosign sign --yes $(cosign triangulate --type=digest "${UPDATER_IMAGE}${ECOSYSTEM}:latest") - name: Set summary run: | diff --git a/.github/workflows/images-updater-core.yml b/.github/workflows/images-updater-core.yml index 418c03c07ee..02a954f97ff 100644 --- a/.github/workflows/images-updater-core.yml +++ b/.github/workflows/images-updater-core.yml @@ -1,7 +1,7 @@ name: Updater-Core image env: UPDATER_CORE_IMAGE: "ghcr.io/dependabot/dependabot-updater-core" -on: # yamllint disable-line rule:truthy +on: # yamllint disable-line rule:truthy push: branches: - main @@ -14,12 +14,16 @@ jobs: if: github.repository == 'dependabot/dependabot-core' permissions: contents: read + id-token: write packages: write steps: - name: Checkout code uses: actions/checkout@v4 with: submodules: recursive + + - uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0 + - name: Build dependabot-updater-core image run: script/build common - name: Log in to GHCR @@ -28,6 +32,8 @@ jobs: - name: Push latest image run: | docker push "$UPDATER_CORE_IMAGE:latest" + cosign sign --yes $(cosign triangulate --type=digest "$UPDATER_CORE_IMAGE:latest") + - name: Push tagged image if: contains(github.ref, 'refs/tags') run: |