Skip to content

Commit

Permalink
split tag at last '.' so we can the service name in the reference
Browse files Browse the repository at this point in the history
  • Loading branch information
dizzyo committed Nov 15, 2023
1 parent f7818b7 commit ddf3f8c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pkg/build/buildkit.go
Expand Up @@ -215,13 +215,13 @@ func (bk *BuildKit) build(bb *Build, path, dockerfile, tag string, env map[strin
args = append(args, "--output", fmt.Sprintf("type=image,name=%s,push=true", tag)) // skipcq

if bk.cacheProvider(os.Getenv("PROVIDER")) {
reg := strings.Split(tag, ":")[0]
args = append(args, "--export-cache", fmt.Sprintf("type=registry,ref=%s:buildcache", reg)) // skipcq
args = append(args, "--import-cache", fmt.Sprintf("type=registry,ref=%s:buildcache", reg)) // skipcq
reg := tag[:strings.LastIndex(tag, ".")]
args = append(args, "--export-cache", fmt.Sprintf("type=registry,ref=%s.buildcache", reg)) // skipcq
args = append(args, "--import-cache", fmt.Sprintf("type=registry,ref=%s.buildcache", reg)) // skipcq
} else if bk.imageManifestCacheProvider(os.Getenv("PROVIDER")) {
reg := strings.Split(tag, ":")[0]
args = append(args, "--export-cache", fmt.Sprintf("mode=max,image-manifest=true,type=registry,ref=%s:buildcache", reg)) // skipcq
args = append(args, "--import-cache", fmt.Sprintf("type=registry,ref=%s:buildcache", reg)) // skipcq
reg := tag[:strings.LastIndex(tag, ".")]
args = append(args, "--export-cache", fmt.Sprintf("mode=max,image-manifest=true,type=registry,ref=%s.buildcache", reg)) // skipcq
args = append(args, "--import-cache", fmt.Sprintf("type=registry,ref=%s.buildcache", reg)) // skipcq
} else {
// keep a local cache for services using the same Dockerfile
args = append(args, "--export-cache", "type=local,dest=/var/lib/buildkit") // skipcq
Expand Down

0 comments on commit ddf3f8c

Please sign in to comment.