-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
gha: add support for batch checking existing keys #4788
Conversation
In order to avoid getting rate limited when checking if previous cache already exists use the Github REST API that supports listing active keys. This means additional GITHUB_TOKEN access is also needed in addition to the RUNTIME_TOKEN needed for the cache API. The implementation is done with a fallback - if GITHUB_TOKEN is passed then it is used, if not then the old method checking individual cache records is still used. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
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.
LGTM
Note for myself to have a follow-up in https://github.com/docker/actions-toolkit to set new attributes automatically when gha
cache is used.
func (ce *exporter) blobKeyPrefix() string { | ||
return "buildkit-blob-" + version + "-" | ||
} |
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.
nit: could just be a const
attrRepository = "repository" | ||
attrGHToken = "ghtoken" |
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.
needs docs updates in https://github.com/moby/buildkit?tab=readme-ov-file#github-actions-cache-experimental and https://docs.docker.com/build/cache/backends/gha/ to define these new attributes (cc @dvdksn)
In order to avoid getting rate limited when checking if previous cache already exists use the Github REST API that supports listing active keys.
This means additional GITHUB_TOKEN access is also
needed in addition to the RUNTIME_TOKEN needed for the cache API. The implementation is done with a fallback - if GITHUB_TOKEN is passed then it is used, if not then the old method checking individual cache records is still used.
Depends on tonistiigi/go-actions-cache#19