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

cache(gha): don't require url attr if url_v2 is set #5750

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions cache/remotecache/gha/gha.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ func getConfig(attrs map[string]string) (*Config, error) {
if !ok {
scope = "buildkit"
}
url, ok := attrs[attrURL]
if !ok {
return nil, errors.Errorf("url not set for github actions cache")
}
token, ok := attrs[attrToken]
if !ok {
return nil, errors.Errorf("token not set for github actions cache")
Expand All @@ -80,12 +76,19 @@ func getConfig(attrs map[string]string) (*Config, error) {
}
apiVersionInt = int(i)
}
var url string
if apiVersionInt != 1 {
if v, ok := attrs[attrURLV2]; ok {
url = v
apiVersionInt = 2
}
}
if v, ok := attrs[attrURL]; ok && url == "" {
url = v
}
if url == "" {
return nil, errors.Errorf("url not set for github actions cache")
}
// best effort on old clients
if apiVersionInt == 0 {
if strings.Contains(url, "results-receiver.actions.githubusercontent.com") {
Expand Down
Loading