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
8 changes: 8 additions & 0 deletions hack/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ export CGO_ENABLED=0
case "${MODE}" in
release)
TAGS="${TAGS} release"
if test -n "${RELEASE_IMAGE}"
then
LDFLAGS="${LDFLAGS} -X github.com/openshift/installer/pkg/asset/ignition/bootstrap.defaultReleaseImage=${RELEASE_IMAGE}"
fi
if test -n "${RHCOS_BUILD_NAME}"
then
LDFLAGS="${LDFLAGS} -X github.com/openshift/installer/pkg/rhcos.buildName=${RHCOS_BUILD_NAME}"
fi
if test "${SKIP_GENERATION}" != y
then
go generate ./data
Expand Down
5 changes: 4 additions & 1 deletion pkg/asset/ignition/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ import (

const (
rootDir = "/opt/openshift"
defaultReleaseImage = "registry.svc.ci.openshift.org/openshift/origin-release:v4.0"
bootstrapIgnFilename = "bootstrap.ign"
etcdCertSignerImage = "quay.io/coreos/kube-etcd-signer-server:678cc8e6841e2121ebfdb6e2db568fce290b67d6"
etcdctlImage = "quay.io/coreos/etcd:v3.2.14"
ignitionUser = "core"
)

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 {
Expand Down
18 changes: 13 additions & 5 deletions pkg/rhcos/builds.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ import (
"github.com/sirupsen/logrus"
)

const (
var (
// DefaultChannel is the default RHCOS channel for the cluster.
DefaultChannel = "maipo"

// buildName is the name of the build in the channel that will be picked up
// empty string means the first one in the build list (latest) will be used
buildName = ""

baseURL = "https://releases-rhcos.svc.ci.openshift.org/storage/releases"
)

Expand All @@ -33,9 +37,13 @@ type metadata struct {
}

func fetchLatestMetadata(ctx context.Context, channel string) (metadata, error) {
build, err := fetchLatestBuild(ctx, channel)
if err != nil {
return metadata{}, errors.Wrap(err, "failed to fetch latest build")
build := buildName
var err error
if build == "" {
build, err = fetchLatestBuild(ctx, channel)
if err != nil {
return metadata{}, errors.Wrap(err, "failed to fetch latest build")
}
}

url := fmt.Sprintf("%s/%s/%s/meta.json", baseURL, channel, build)
Expand All @@ -48,7 +56,7 @@ func fetchLatestMetadata(ctx context.Context, channel string) (metadata, error)
client := &http.Client{}
resp, err := client.Do(req.WithContext(ctx))
if err != nil {
return metadata{}, errors.Wrap(err, "failed to fetch metadata")
return metadata{}, errors.Wrapf(err, "failed to fetch metadata for build %s", build)
}
defer resp.Body.Close()

Expand Down