GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — buildx: cache binary to hosted tool cache and GHA cache backend by crazy-max · Pull Request #129 · docker/actions-toolkit

Conversation

@crazy-max

@crazy-max crazy-max commented Jul 6, 2023

Copy link
Copy Markdown
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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@crazy-max

crazy-max commented Jul 6, 2023

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crazy-max
crazy-max marked this pull request as ready for review July 6, 2023 07:37
@crazy-max crazy-max mentioned this pull request Jul 6, 2023
test docker/actions-toolkit pr-129 docker/setup-buildx-action#245
Closed
@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 commented Jul 6, 2023

Copy link
Copy Markdown
Member Author

Tested in docker/setup-buildx-action#245

Build without cache: https://github.com/docker/setup-buildx-action/actions/runs/5473103624/jobs/9966137055#step:3:99

image

With cache: https://github.com/docker/setup-buildx-action/actions/runs/5473500347/jobs/9967061068#step:3:99

image

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crazy-max
crazy-max requested review from jedevc, nicks and tonistiigi July 6, 2023 09:08
@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
nicks
nicks approved these changes Jul 6, 2023
View reviewed changes

@nicks nicks left a comment

Copy link
Copy Markdown

There was a problem hiding this 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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/buildx/install.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/buildx/install.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/buildx/install.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread __tests__/buildx/install.test.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/buildx/install.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@crazy-max

crazy-max commented Jul 6, 2023

Copy link
Copy Markdown
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/... ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

crazy-max added 3 commits July 6, 2023 16:15
@crazy-max
buildx: cache binary to hosted tool cache and GHA cache backend
ddcd63c
Signed-off-by: CrazyMax <[email protected]>
@crazy-max
util: trimPrefix and trimSuffix methods
70c0e12
Signed-off-by: CrazyMax <[email protected]>
@crazy-max
buildx: improve vspec fingerprint for caching
c1edd0b
Signed-off-by: CrazyMax <[email protected]>
@crazy-max
crazy-max force-pushed the buildx-bin-cache branch from 6915a77 to c1edd0b Compare July 6, 2023 14:16
@crazy-max
crazy-max requested a review from nicks July 6, 2023 14:16
nicks
nicks approved these changes Jul 6, 2023
View reviewed changes
@crazy-max
crazy-max merged commit 8d02bad into docker:main Jul 6, 2023
@crazy-max
crazy-max deleted the buildx-bin-cache branch July 6, 2023 19:06
@nicks

nicks commented Jul 6, 2023

Copy link
Copy Markdown

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

crazy-max reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@crazy-max crazy-max mentioned this pull request Jul 6, 2023
Bump @docker/actions-toolkit from 0.6.0 to 0.7.0 docker/setup-buildx-action#246
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@tonistiigi tonistiigi Awaiting requested review from tonistiigi
@jedevc jedevc Awaiting requested review from jedevc
1 more reviewer
@nicks nicks nicks approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@crazy-max @nicks
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.