Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish-commit-bottles: use public action #171085

Merged
merged 11 commits into from
May 8, 2024
19 changes: 16 additions & 3 deletions .github/workflows/publish-commit-bottles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@
volumes:
- /mnt:/mnt
permissions:
attestations: write # for `generate build provenance`

Check failure on line 247 in .github/workflows/publish-commit-bottles.yml

View workflow job for this annotation

GitHub Actions / workflow_syntax

unknown permission scope "attestations". all available permission scopes are "actions", "checks", "contents", "deployments", "discussions", "id-token", "issues", "packages", "pages", "pull-requests", "repository-projects", "security-events", "statuses"
id-token: write # for `generate build provenance`
contents: write # for `generate build provenance`
packages: write # for `generate build provenance`
woodruffw marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -335,11 +336,23 @@

echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
woodruffw marked this conversation as resolved.
Show resolved Hide resolved

- name: generate build provenance
uses: github-early-access/generate-build-provenance@main
- name: Generate build provenance
# GitHub Attestations are still in early public access, and we've seen
# some sporadic errors when generating attestations.
# Rather than fail outright, we allow this step to fail and fall
# through to a last-ditch retry below. Longer term, we should put this
# above the 'pr-pull' step, which should be split into separate 'pull'
# and 'push to GitHub Packages' phases.
continue-on-error: true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the right way to continue if this step fails. The other approach is to have the last ditch step use if: failure(), which AFAIK means it'll run if any step fails, not just the last one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it would be nicer if actions/attest-build-provenance had some sort of retry logic built-in, but this approach suits for now, I think. (Assuming actions/attest-build-provenance is idempotent, which I suppose it should be.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, agreed. I think the team working on this at GH has been tackling it though internal retries, so I suspect it'll get better over time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no side effect of ignoring the action step failure?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so -- if it fails it should fall through to the "last ditch" version, which will then hard-fail the action if it also fails. But maybe I missed something?

uses: actions/attest-build-provenance@v1
with:
subject-path: '${{steps.pr-pull.outputs.bottle_path}}/*.tar.gz'


- name: Generate build provenance (last ditch)
woodruffw marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/attest-build-provenance@v1
woodruffw marked this conversation as resolved.
Show resolved Hide resolved
with:
subject-path: '${{steps.pr-pull.outputs.bottle_path}}/*.tar.gz'

- name: Push commits
uses: Homebrew/actions/git-try-push@master
with:
Expand Down
Loading