Skip to content

Commit f9fb45a

Browse files
authored
containertool: Use the default registry parameter for image uploads (#19)
### Motivation The `--default-registry` parameter (also set by the `CONTAINERTOOL_DEFAULT_REGISTRY` environment variable) allows a default registry address to be specified for unqualified image names. For example, the following uploads should be equivalent: `containertool --default-registry myregistry.com --repository myrepo/myimage --from baserepo/baseimage` `containertool --repository myregistry.com/myrepo/myimage --from baserepo/baseimage` However the default registry was only being applied when fetching the base image (the `--from` parameter) and not when pushing the final image (the `--repository` parameter). ### Modifications The default registry parameter is now used when pushing the final image. ### Result Pushes to unqualified repositories will work properly. ### Test Plan Manually tested `containertool` uploads with a variety of qualified and unqualified image names.
1 parent 035315f commit f9fb45a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/containertool/containertool.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ enum AllowHTTP: String, ExpressibleByArgument, CaseIterable { case source, desti
6060

6161
func run() async throws {
6262
let baseimage = try ImageReference(fromString: from, defaultRegistry: defaultRegistry)
63-
var destination_image = try ImageReference(fromString: repository)
63+
var destination_image = try ImageReference(fromString: repository, defaultRegistry: defaultRegistry)
6464

6565
let authProvider: AuthorizationProvider?
6666
if !netrc {

0 commit comments

Comments
 (0)