Add --all-tags/-a flag to image push#1335
Conversation
| let repositoryName: String | ||
| if let resolved = parsedRef.resolvedDomain { | ||
| repositoryName = "\(resolved)/\(parsedRef.path)" | ||
| } else { | ||
| repositoryName = parsedRef.name | ||
| } |
There was a problem hiding this comment.
Suggestion: Looks like this is being repeated at couple of places. I think moving this to a package level function inside Utility would make sense.
Sources/Services/ContainerImagesService/Server/ImagesService.swift
Outdated
Show resolved
Hide resolved
| guard !Utility.isInfraImage(name: image.reference) else { return false } | ||
| guard let ref = try? Reference.parse(image.reference) else { return false } | ||
| let resolvedName: String | ||
| if let resolved = ref.resolvedDomain { | ||
| resolvedName = "\(resolved)/\(ref.path)" | ||
| } else { | ||
| resolvedName = ref.name | ||
| } | ||
| return resolvedName == repositoryName | ||
| } |
There was a problem hiding this comment.
Suggestion: This would be a good candidate which can be moved to Utility.
| let normalized = try ClientImage.normalizeReference(reference) | ||
| let displayRepo = try ClientImage.denormalizeReference(normalized) | ||
| let displayName = try Reference.parse(displayRepo).name | ||
| print("The push refers to repository [\(displayName)]") |
There was a problem hiding this comment.
I don't know if this is super necessary since we get back a list of images we pushed
| } | ||
| } | ||
|
|
||
| public func pushAllTags(repositoryName: String, platform: Platform?, insecure: Bool, maxConcurrentUploads: Int, progressUpdate: ProgressUpdateHandler?) async throws |
There was a problem hiding this comment.
I'm wondering if we should instead move the logic to ImageStore.ExportOperation to be similar to how ImageStore.pull works. What do you think?
| throw ContainerizationError(.notFound, message: "no tags found for repository \(repositoryName)") | ||
| } | ||
|
|
||
| let maxConcurrent = maxConcurrentUploads > 0 ? maxConcurrentUploads : 3 |
There was a problem hiding this comment.
Suggestion: This silent fallback behavior is different than what's in ClientImage (which has a guard). I would keep the same behavior to be consistent.
-a/--all-tagsforcontainer image push#1334.Type of Change
Motivation and Context
Adds
--all-tags(-a) support tocontainer image push, which pushes all locally tagged versions of a repository in parallel with bounded concurrency (--max-concurrent-uploads, default 3). It continues pushing remaining tags if one fails.Usage:
container image push --all-tags myregistry.io/myimageExample:
Note:
-aonpushnow means--all-tags, not--arch.--archremains available as a long-form flag.Testing