From e890b7b76ff2b4e57eccf79a79d183ed29ab7288 Mon Sep 17 00:00:00 2001 From: Rajat Chopra Date: Mon, 26 Nov 2018 19:12:57 -0500 Subject: [PATCH] hack: pin the release image in build flags But still leave an override env var so that it can be overridden. Use the following env var to pin the image while building the binary: ``` $ # export the release-image variable $ export OPENSHIFT_INSTALL_RELEASE_IMAGE=registry.redhat.io/openshift/origin-release:v4.0" $ # build the openshift-install binary $ ./hack/build.sh $ # distribute the binary to customers and run with pinned image being picked up $ ./bin/openshift-install create cluster... ``` The only way to override it would be to use an env var OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE while running the openshift-install binary. --- hack/build.sh | 4 ++++ pkg/asset/ignition/bootstrap/bootstrap.go | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hack/build.sh b/hack/build.sh index 604c620e463..1b4add595ba 100755 --- a/hack/build.sh +++ b/hack/build.sh @@ -28,6 +28,10 @@ export CGO_ENABLED=0 case "${MODE}" in release) TAGS="${TAGS} release" + if test -n "${OPENSHIFT_INSTALL_RELEASE_IMAGE}" + then + LDFLAGS="${LDFLAGS} -X github.com/openshift/installer/pkg/asset/ignition/bootstrap.defaultReleaseImage=${OPENSHIFT_INSTALL_RELEASE_IMAGE}" + fi if test "${SKIP_GENERATION}" != y then go generate ./data diff --git a/pkg/asset/ignition/bootstrap/bootstrap.go b/pkg/asset/ignition/bootstrap/bootstrap.go index e685af4877e..74f9c2b666f 100644 --- a/pkg/asset/ignition/bootstrap/bootstrap.go +++ b/pkg/asset/ignition/bootstrap/bootstrap.go @@ -30,10 +30,13 @@ import ( const ( rootDir = "/opt/tectonic" - defaultReleaseImage = "registry.svc.ci.openshift.org/openshift/origin-release:v4.0" bootstrapIgnFilename = "bootstrap.ign" ) +var ( + defaultReleaseImage = "registry.svc.ci.openshift.org/openshift/origin-release:v4.0" +) + // bootstrapTemplateData is the data to use to replace values in bootstrap // template files. type bootstrapTemplateData struct {