Skip to content

gha: add support for batch checking existing keys - #4788

Merged
tonistiigi merged 1 commit into
moby:masterfrom
tonistiigi:gha-batch-key-check
Mar 26, 2024
Merged

tonistiigi merged 1 commit into
moby:masterfrom
tonistiigi:gha-batch-key-check

Conversation

@tonistiigi

Copy link
Copy Markdown
Member

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

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>

@crazy-max crazy-max left a comment

Copy link
Copy Markdown
Member

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.

Comment on lines +130 to +132
func (ce *exporter) blobKeyPrefix() string {
return "buildkit-blob-" + version + "-"
}

Copy link
Copy Markdown
Member

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

@crazy-max crazy-max added this to the v0.14.0 milestone Mar 25, 2024
@tonistiigi
tonistiigi merged commit cf45790 into moby:master Mar 26, 2024
Comment on lines +40 to +41
attrRepository = "repository"
attrGHToken = "ghtoken"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants