Skip to content

Commit f857bca

Browse files
ejahnGithubCopilotbdehamer
authored
Update Docker publishing tutorial for artifact attestation guidance (#58736)
Co-authored-by: Copilot <[email protected]> Co-authored-by: Brian DeHamer <[email protected]>
1 parent bcff1fe commit f857bca

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

content/actions/tutorials/publish-packages/publish-docker-images.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ jobs:
191191
permissions:
192192
packages: write
193193
contents: read
194-
{% ifversion artifact-attestations %}attestations: write{% endif %}
195-
{% ifversion artifact-attestations %}id-token: write{% endif %}
196194
steps:
197195
- name: Check out the repo
198196
uses: {% data reusables.actions.action-checkout %}
@@ -226,18 +224,15 @@ jobs:
226224
push: true
227225
tags: {% raw %}${{ steps.meta.outputs.tags }}{% endraw %}
228226
labels: {% raw %}${{ steps.meta.outputs.labels }}{% endraw %}
229-
230-
{% ifversion artifact-attestations %}
231-
- name: Generate artifact attestation
232-
uses: actions/attest-build-provenance@v3
233-
with:
234-
subject-name: {% data reusables.package_registry.container-registry-hostname %}/{% raw %}${{ github.repository }}{% endraw %}
235-
subject-digest: {% raw %}${{ steps.push.outputs.digest }}{% endraw %}
236-
push-to-registry: true
237-
{% endif -%}
238227
```
239228
240229
The above workflow checks out the {% data variables.product.github %} repository, uses the `login-action` twice to log in to both registries and generates tags and labels with the `metadata-action` action.
241230
Then the `build-push-action` action builds and pushes the Docker image to Docker Hub and the {% data variables.product.prodname_container_registry %}.
242231

243-
{% ifversion artifact-attestations %}{% data reusables.actions.artifact-attestations-step-explanation %}{% endif %}
232+
{% ifversion artifact-attestations %}> [!NOTE]
233+
> When pushing to multiple registries:
234+
>
235+
> * Image digests may differ between registries, making attestation verification difficult.
236+
> * To maintain a consistent digest and allow a single attestation to verify all copies, push to one registry first and use a tool like [`crane copy`](https://github.com/google/go-containerregistry/blob/main/cmd/crane/doc/crane_copy.md) to replicate the image elsewhere.
237+
> * If you choose to build and push to each registry separately instead, you must generate a distinct attestation for each one to ensure your artifacts remain verifiable.
238+
{% endif %}

0 commit comments

Comments
 (0)