Skip to content

Commit

Permalink
Allow extracted binary name can be set to different
Browse files Browse the repository at this point in the history
  • Loading branch information
ardaguclu committed Jan 5, 2024
1 parent 7010159 commit 10b06af
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions pkg/cli/admin/release/extract_tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ type extractTarget struct {
InjectReleaseVersion bool
SignMachOBinary bool

ArchiveFormat string
AsArchive bool
AsZip bool
Readme string
LinkTo []string
ArchiveFormat string
AsArchive bool
AsZip bool
Readme string
LinkTo []string
TargetCommandName string

Mapping extract.Mapping
}
Expand Down Expand Up @@ -275,6 +276,7 @@ func (o *ExtractOptions) extractCommand(command string) error {
Readme: readmeCLIUnix,
InjectReleaseVersion: true,
ArchiveFormat: "openshift-client-linux-amd64-rhel9-%s.tar.gz",
TargetCommandName: "oc",
},
{
OS: "linux",
Expand All @@ -286,6 +288,7 @@ func (o *ExtractOptions) extractCommand(command string) error {
Readme: readmeCLIUnix,
InjectReleaseVersion: true,
ArchiveFormat: "openshift-client-linux-amd64-rhel8-%s.tar.gz",
TargetCommandName: "oc",
},
{
OS: "linux",
Expand All @@ -310,6 +313,7 @@ func (o *ExtractOptions) extractCommand(command string) error {
Readme: readmeCLIUnix,
InjectReleaseVersion: true,
ArchiveFormat: "openshift-client-linux-arm64-rhel9-%s.tar.gz",
TargetCommandName: "oc",
},
{
OS: "linux",
Expand All @@ -322,6 +326,7 @@ func (o *ExtractOptions) extractCommand(command string) error {
Readme: readmeCLIUnix,
InjectReleaseVersion: true,
ArchiveFormat: "openshift-client-linux-arm64-rhel8-%s.tar.gz",
TargetCommandName: "oc",
},
{
OS: "windows",
Expand Down Expand Up @@ -590,6 +595,11 @@ func (o *ExtractOptions) extractCommand(command string) error {
}
target.Mapping.Image = spec
target.Mapping.ImageRef = imagesource.TypedImageReference{Ref: ref, Type: imagesource.DestinationRegistry}
// if the name of the extracted binary is set to different from the
// actual command name, we set it to new target command name.
if target.TargetCommandName != "" {
target.Command = target.TargetCommandName
}
if target.AsArchive {
willArchive = true
target.Mapping.Name = fmt.Sprintf(target.ArchiveFormat, releaseName)
Expand Down

0 comments on commit 10b06af

Please sign in to comment.