Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/openshift-install/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/spf13/cobra"

"github.com/openshift/installer/pkg/asset/ignition/bootstrap"
"github.com/openshift/installer/pkg/version"
)

Expand All @@ -24,5 +25,8 @@ func runVersionCmd(cmd *cobra.Command, args []string) error {
if version.Commit != "" {
fmt.Printf("built from commit %s\n", version.Commit)
}
if image, err := bootstrap.DefaultReleaseImage(); err == nil {
fmt.Printf("release image %s\n", image)
}
return nil
}
2 changes: 1 addition & 1 deletion pkg/asset/ignition/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ func (a *Bootstrap) getTemplateData(installConfig *types.InstallConfig) (*bootst
releaseImage = ri
} else {
var err error
releaseImage, err = defaultReleaseImage()
releaseImage, err = DefaultReleaseImage()
if err != nil {
return nil, err
}
Expand Down
8 changes: 5 additions & 3 deletions pkg/asset/ignition/bootstrap/release_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ var (
defaultReleaseImageLength = len(defaultReleaseImagePadded)
)

// defaultReleaseImage abstracts how the binary loads the default release payload. We want to lock the binary
// to the
func defaultReleaseImage() (string, error) {
// DefaultReleaseImage abstracts how the binary loads the default release payload. We want to lock the binary
// to the pull spec of the payload we test it with, and since a payload contains an installer image we can't
// know that at build time. Instead, we make it possible to replace the release string after build via a
// known constant in the binary.
func DefaultReleaseImage() (string, error) {
if strings.HasPrefix(defaultReleaseImagePadded, defaultReleaseImagePrefix) {
// the defaultReleaseImagePadded constant hasn't been altered in the binary, fall back to the default
return defaultReleaseImageOriginal, nil
Expand Down