From 3e7e5b8041683be5abe77f2ac90fbffea452059d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Tue, 21 Jun 2022 10:30:10 +0000 Subject: [PATCH] Rework default variant selection See https://github.com/coreos/coreos-assembler/pull/2934 --- .gitignore | 2 ++ ci/prow-entrypoint.sh | 28 ++++++++++++++-------------- extensions.yaml | 1 - manifest.yaml | 1 - select_version.sh | 35 ----------------------------------- variant_default | 1 + variant_rhcos | 1 + variant_rhel-8.6 | 1 + 8 files changed, 19 insertions(+), 51 deletions(-) delete mode 120000 extensions.yaml delete mode 120000 manifest.yaml delete mode 100755 select_version.sh create mode 120000 variant_default create mode 120000 variant_rhcos create mode 100644 variant_rhel-8.6 diff --git a/.gitignore b/.gitignore index b4d89b587..3bf5c6d47 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /*.repo /content_sets.yaml +/manifest.yaml +/extensions.yaml diff --git a/ci/prow-entrypoint.sh b/ci/prow-entrypoint.sh index d4d114fb7..8f39ad925 100755 --- a/ci/prow-entrypoint.sh +++ b/ci/prow-entrypoint.sh @@ -44,17 +44,13 @@ cosa_init() { echo "Using $cosa_dir for build" cd "$cosa_dir" - # Setup source tree - cosa init --transient "${tmp_src}/os" - # Select RHEL os CentOS Stream version - # This must be defined for each test job entry point - if [[ -z ${RHELVER+x} ]]; then + # Require the CI jobs to explicitly setup the variant to avoid mistakes + if [[ -z ${OSVER+x} ]]; then echo "No RHEL or CentOS Stream version selected to build RHCOS/SCOS" exit 1 fi - pushd src/config - ./select_version.sh "${RHELVER}" - popd + # Setup source tree, selecting a variant + cosa init --transient "${tmp_src}/os" "${OSVER}" } # Do a cosa build & cosa build-extensions only. @@ -67,14 +63,18 @@ cosa_build() { # to X-Y format ocpver=$(rpm-ostree compose tree --print-only src/config/manifest.yaml | jq -r '.["mutate-os-release"]') ocpver_mut=$(rpm-ostree compose tree --print-only src/config/manifest.yaml | jq -r '.["mutate-os-release"]' | sed 's|\.|-|') - prev_build_url=${REDIRECTOR_URL}/rhcos-${ocpver}/ - # Fetch the previous build - cosa buildfetch --url="${prev_build_url}" + + # Temporary workaround until we publish builds for other versions + if [[ "${OSVER}" == "rhel-8.6" ]]; then + prev_build_url=${REDIRECTOR_URL}/rhcos-${ocpver}/ + # Fetch the previous build + cosa buildfetch --url="${prev_build_url}" + fi # Fetch the repos corresponding to the release we are building # Temporarily double checked until we have uniformity for all RHEL and # CentOS versions - if [[ "${RHELVER}" == "rhel-8.6" ]]; then + if [[ "${OSVER}" == "rhel-8.6" ]]; then rhelver=$(rpm-ostree compose tree --print-only src/config/manifest.yaml | jq -r '.["automatic-version-prefix"]' | cut -f2 -d.) curl -L "http://base-${ocpver_mut}-rhel${rhelver}.ocp.svc.cluster.local" -o "src/config/ocp.repo" fi @@ -171,14 +171,14 @@ main () { cosa_build ;; "rhcos-cosa-prow-pr-ci" | "rhcos-86-build-test-qemu") - RHELVER="rhel-8.6" + OSVER="rhel-8.6" setup_user cosa_init cosa_build kola_test_qemu ;; "rhcos-86-build-test-metal") - RHELVER="rhel-8.6" + OSVER="rhel-8.6" setup_user cosa_init cosa_build diff --git a/extensions.yaml b/extensions.yaml deleted file mode 120000 index 051d254e5..000000000 --- a/extensions.yaml +++ /dev/null @@ -1 +0,0 @@ -extensions-rhel-8.6.yaml \ No newline at end of file diff --git a/manifest.yaml b/manifest.yaml deleted file mode 120000 index e3f5abc13..000000000 --- a/manifest.yaml +++ /dev/null @@ -1 +0,0 @@ -rhel-8.6.yaml \ No newline at end of file diff --git a/select_version.sh b/select_version.sh deleted file mode 100755 index 75364c762..000000000 --- a/select_version.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Select the version of RHCOS or SCOS that you want to build from this repo -set -euxo pipefail - -# The current default for RHCOS in OCP 4.11 and later is RHEL 8.6 -RHELVER="rhel-8.6" - -main() { - local osver="" - local content_sets_required="false" - if [[ "$#" -ne 1 ]]; then - osver="$RHELVER" - else - osver="$1" - fi - - case "$osver" in - "rhel-8.6") - echo "Building RHCOS based on ${osver}" - content_sets_required="true" - ;; - *) - echo "Unknown OS version: ${osver}" - exit 1 - ;; - esac - - ln -snf "extensions-${osver}.yaml" "extensions.yaml" - ln -snf "${osver}.yaml" "manifest.yaml" - if [[ "${content_sets_required}" == "true" ]]; then - ln -snf "content_sets-${osver}.yaml" "content_sets.yaml" - fi -} - -main "${@}" diff --git a/variant_default b/variant_default new file mode 120000 index 000000000..e5959cac9 --- /dev/null +++ b/variant_default @@ -0,0 +1 @@ +variant_rhel-8.6 \ No newline at end of file diff --git a/variant_rhcos b/variant_rhcos new file mode 120000 index 000000000..e5959cac9 --- /dev/null +++ b/variant_rhcos @@ -0,0 +1 @@ +variant_rhel-8.6 \ No newline at end of file diff --git a/variant_rhel-8.6 b/variant_rhel-8.6 new file mode 100644 index 000000000..23c7ea772 --- /dev/null +++ b/variant_rhel-8.6 @@ -0,0 +1 @@ +rhel-8.6