Skip to content

Commit d88137e

Browse files
committed
Add command option and pass to publish method
! needs to be last option passed to tool, as it might cmd values might be options themselves
1 parent 9417b63 commit d88137e

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Plugins/ContainerImageBuilder/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ extension PluginError: CustomStringConvertible {
9999
let helperURL = try context.tool(named: "containertool").url
100100
let helperArgs =
101101
(FileManager.default.fileExists(atPath: resources.path) ? ["--resources", resources.path] : [])
102-
+ extractor.remainingArguments
103102
+ builtExecutables.map { $0.url.path }
103+
+ extractor.remainingArguments
104104
let helperEnv = ProcessInfo.processInfo.environment.filter { $0.key.starts(with: "CONTAINERTOOL_") }
105105

106106
let err = Pipe()

Sources/containertool/Extensions/RegistryClient+publish.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func publishContainerImage<Source: ImageSource, Destination: ImageDestination>(
2525
destination: Destination,
2626
architecture: String,
2727
os: String,
28+
cmd: [String],
2829
resources: [String],
2930
tag: String?,
3031
verbose: Bool,
@@ -80,7 +81,7 @@ func publishContainerImage<Source: ImageSource, Destination: ImageDestination>(
8081
// and override the entrypoint.
8182
var inheritedConfiguration = baseImageConfiguration.config ?? .init()
8283
inheritedConfiguration.Entrypoint = ["/\(executableURL.lastPathComponent)"]
83-
inheritedConfiguration.Cmd = []
84+
inheritedConfiguration.Cmd = cmd
8485
inheritedConfiguration.WorkingDir = "/"
8586

8687
let configuration = ImageConfiguration(

Sources/containertool/containertool.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ enum AllowHTTP: String, ExpressibleByArgument, CaseIterable { case source, desti
6464

6565
@Option(help: "Operating system")
6666
var os: String?
67+
68+
@Option(parsing: .remaining, help: "Default arguments to pass to the entrypoint process")
69+
var cmd: [String] = []
6770
}
6871

6972
@OptionGroup(title: "Image configuration options")
@@ -222,6 +225,7 @@ enum AllowHTTP: String, ExpressibleByArgument, CaseIterable { case source, desti
222225
destination: destination,
223226
architecture: architecture,
224227
os: os,
228+
cmd: imageConfigurationOptions.cmd,
225229
resources: imageBuildOptions.resources,
226230
tag: repositoryOptions.tag,
227231
verbose: verbose,

0 commit comments

Comments
 (0)