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

buildx: cache binary to hosted tool cache and GHA cache backend #129

Merged
merged 3 commits into from Jul 6, 2023

Conversation

crazy-max
Copy link
Member

When installing buildx, downloaded binary is not cached. As public GitHub runners are ephemeral, this can take some time to download the binary for each workflow execution: https://github.com/docker/setup-buildx-action/actions/runs/5462992694/jobs/9943119048#step:3:1

image

And even more if building from source: https://github.com/docker/setup-buildx-action/actions/runs/5462992694/jobs/9943110665#step:3:1

image

With these changes, binary will be cached to the hosted tool cache like the official actions do today with node, go, ...

This is fine for self-hosted runners but not public runners as hosted tool cache is pruned when a job is completed. To solve this issue, we also cache the binary to the GitHub Actions Cache backend.

@crazy-max
Copy link
Member Author

@nicks This can be an alternative to #127 if you want to make some tests on your side. This does not require changes in setup-buildx-action. Just vendoring this actions-toolkit branch.

@crazy-max crazy-max marked this pull request as ready for review July 6, 2023 07:37
@crazy-max crazy-max force-pushed the buildx-bin-cache branch 2 times, most recently from be4c881 to 639229c Compare July 6, 2023 08:52
@crazy-max crazy-max force-pushed the buildx-bin-cache branch 2 times, most recently from 1e227a2 to 6915a77 Compare July 6, 2023 11:35
Copy link

@nicks nicks left a comment

Choose a reason for hiding this comment

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

i like this approach! i tested it and it works for me - https://github.com/docker/gondolier/actions/runs/5476236490/jobs/9973479123?pr=381

i'm still having problems getting buildx to build from a tag though, see this failure: https://github.com/docker/gondolier/actions/runs/5476109857/jobs/9973172585?pr=381. The only way i was able to get it to work was to manually resolve the tag to a SHA.

src/buildx/install.ts Outdated Show resolved Hide resolved
src/buildx/install.ts Show resolved Hide resolved
src/buildx/install.ts Show resolved Hide resolved
__tests__/buildx/install.test.ts Outdated Show resolved Hide resolved
src/buildx/install.ts Outdated Show resolved Hide resolved
@crazy-max
Copy link
Member Author

i'm still having problems getting buildx to build from a tag though, see this failure: https://github.com/docker/gondolier/actions/runs/5476109857/jobs/9973172585?pr=381. The only way i was able to get it to work was to manually resolve the tag to a SHA.

I need to take a closer look at this one. Have you tried with #refs/tags/... ?

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
@crazy-max crazy-max merged commit 8d02bad into docker:main Jul 6, 2023
15 checks passed
@crazy-max crazy-max deleted the buildx-bin-cache branch July 6, 2023 19:06
@nicks
Copy link

nicks commented Jul 6, 2023

oh forgot to mention - i confirmed that #refs/tags/... worked ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants