Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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: 11 additions & 0 deletions .github/workflows/shared-publish-java-to-docker-versioned.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ jobs:
security-events: write
packages: write
pull-requests: write
id-token: write
attestations: write
artifact-metadata: write
outputs:
jar_version: ${{ steps.version.outputs.new_version }}
image_tag: ${{ steps.updatePom.outputs.image_tag }}
Expand Down Expand Up @@ -203,6 +206,7 @@ jobs:
scan_type: image

- name: Push to Docker
id: push
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
context: ${{inputs.working_dir}}
Expand All @@ -213,6 +217,13 @@ jobs:
JAR_VERSION=${{ steps.version.outputs.new_version }}
IMAGE_VERSION=${{ steps.version.outputs.new_version }}

- name: Attest build provenance
if: ${{ steps.checkRelease.outputs.not_snapshot == 'true' }}
uses: IABTechLab/uid2-shared-actions/actions/attest_image@v3
with:
subject_name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}${{ inputs.append_image_name }}
subject_digest: ${{ steps.push.outputs.digest }}

- name: Build Changelog
id: github_release
if: ${{ steps.checkRelease.outputs.is_release == 'true' }}
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/shared-publish-to-docker-versioned.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ jobs:
security-events: write
packages: write
pull-requests: write
id-token: write
attestations: write
artifact-metadata: write
steps:
- name: Setup
id: setup
Expand Down
44 changes: 44 additions & 0 deletions actions/attest_image/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Attest container image
description: |
Generates a SLSA build-provenance attestation for an OCI image, pushes the
signed bundle to the registry alongside the image, and verifies it via
`gh attestation verify`.

inputs:
subject_name:
description: Fully qualified image reference (registry/owner/repo[+suffix]).
required: true
subject_digest:
description: OCI manifest digest (sha256:...) emitted by docker/build-push-action.
required: true

runs:
using: composite
steps:
- name: Lowercase image reference
id: ref
shell: bash
run: |
value="$(printf '%s' '${{ inputs.subject_name }}' | tr '[:upper:]' '[:lower:]')"
echo "value=${value}" >> "$GITHUB_OUTPUT"

- name: Attest build provenance
uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0
env:
# Mirrors actions/attest-build-provenance, prevents oversized OCI registry auth-challenge headers triggering HPE_HEADER_OVERFLOW.
NODE_OPTIONS: --max-http-header-size=32768
with:
subject-name: ${{ steps.ref.outputs.value }}
subject-digest: ${{ inputs.subject_digest }}
push-to-registry: true

- name: Verify attestation
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
# Accept either signer SAN: the reusable workflow under IABTechLab/uid2-shared-actions, or the caller's workflow via the composite path. --owner alone would reject the former (see https://github.com/cli/cli/issues/9045).
gh attestation verify \
"oci://${{ steps.ref.outputs.value }}@${{ inputs.subject_digest }}" \
--owner "${{ github.repository_owner }}" \
--cert-identity-regex "^https://github\.com/(IABTechLab/uid2-shared-actions|${{ github.repository }})/"
8 changes: 8 additions & 0 deletions actions/shared_publish_to_docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ runs:
scan_type: ${{ inputs.scan_type }}

- name: Push to Docker
id: push
uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
context: ${{ inputs.docker_context }}
Expand All @@ -100,3 +101,10 @@ runs:
build-args: |
JAR_VERSION=${{ inputs.new_version }}
IMAGE_VERSION=${{ inputs.new_version }}

- name: Attest build provenance
if: ${{ inputs.not_snapshot == 'true' }}
uses: IABTechLab/uid2-shared-actions/actions/attest_image@v3
with:
subject_name: ${{ inputs.docker_registry }}/${{ inputs.docker_image_name }}
subject_digest: ${{ steps.push.outputs.digest }}
Loading