Skip to content

Add --all-tags/-a flag to image push#1335

Open
realrajaryan wants to merge 3 commits intoapple:mainfrom
realrajaryan:users/realrajaryan/alltags
Open

Add --all-tags/-a flag to image push#1335
realrajaryan wants to merge 3 commits intoapple:mainfrom
realrajaryan:users/realrajaryan/alltags

Conversation

@realrajaryan
Copy link
Contributor

@realrajaryan realrajaryan commented Mar 20, 2026

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Motivation and Context

Adds --all-tags (-a) support to container 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/myimage
Example:

❯ container image push --all-tags ghcr.io/sometest/alltagstest
The push refers to repository [ghcr.io/sometest/alltagstest]
v1: digest: sha256:28a33e0598da2b341d05e53803c5982377039baedfc8a82a4910d5acc4788c99 size: 5 KB
v2: digest: sha256:28a33e0598da2b341d05e53803c5982377039baedfc8a82a4910d5acc4788c99 size: 5 KB
latest: digest: sha256:28a33e0598da2b341d05e53803c5982377039baedfc8a82a4910d5acc4788c99 size: 5 KB

Note: -a on push now means --all-tags, not --arch. --arch remains available as a long-form flag.

Testing

  • Tested locally
  • Added/updated tests
  • Added/updated docs

@github-actions github-actions bot added the cli label Mar 20, 2026
Comment on lines +297 to +302
let repositoryName: String
if let resolved = parsedRef.resolvedDomain {
repositoryName = "\(resolved)/\(parsedRef.path)"
} else {
repositoryName = parsedRef.name
}
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +163 to +172
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
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion: This would be a good candidate which can be moved to Utility.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Request]: Add -a/--all-tags for container image push

3 participants