From a2b2292f9b03d52ef30e441d707400bdf3d1bba9 Mon Sep 17 00:00:00 2001
From: Jonathan Lebon <jonathan@jlebon.com>
Date: Mon, 6 May 2024 14:50:57 -0400
Subject: [PATCH] variants: simplify variants

This repo is really confusing to work with because of all the various
tiers of variants we have.

In practice, our production pipelines always specify a concrete variant
to build because the switchover between e.g. 9.2 and 9.4 happens on the
ART side, not RHCOS side. And even in CI, since the script that gets
called by Prow lives here, we can easily control which concrete variant
gets built.

So overall, we don't gain much from trying to have symbolic versionless
variants, but it adds cognitive overhead trying to understand it all.

This patch greatly simplifies things by getting rid of the `scos` and
`rhel-coreos-9` variants. Now, we *only* have concrete variants.
Document them in the README.

The only symbolic links left are the canonical variantless ones, which
determine the default variant that gets built if no `--variant` switch
is passed to `cosa init`.

This is also prep for #799, which will add more concrete variants.
---
 README.md                     | 14 ++++++++++++++
 ci/prow-entrypoint.sh         | 12 ++++++------
 extensions-rhel-coreos-9.yaml |  1 -
 extensions-scos.yaml          |  1 -
 extensions.yaml               |  2 +-
 image-rhel-coreos-9.yaml      |  1 -
 image-scos.yaml               |  1 -
 image.yaml                    |  2 +-
 manifest-rhel-coreos-9.yaml   |  1 -
 manifest-scos.yaml            |  1 -
 manifest.yaml                 |  2 +-
 11 files changed, 23 insertions(+), 15 deletions(-)
 delete mode 120000 extensions-rhel-coreos-9.yaml
 delete mode 120000 extensions-scos.yaml
 delete mode 120000 image-rhel-coreos-9.yaml
 delete mode 120000 image-scos.yaml
 delete mode 120000 manifest-rhel-coreos-9.yaml
 delete mode 120000 manifest-scos.yaml

diff --git a/README.md b/README.md
index f2b23621..4663763c 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,19 @@ There was a previous git repository inside the Red Hat firewall that was never
 published. The history of that repository is entangled with various private
 things and is omitted. This repository is now canonical.
 
+## Variants
+
+To support building both a RHEL-based and a CentOS Stream-based CoreOS, the
+coreos-assembler concept of [variants] is used. The following variants are
+supported:
+
+- `rhel-9.4`: RHEL 9.4-based CoreOS; including OpenShift components.
+- `c9s`: CentOS Stream-based CoreOS, including OpenShift components. This
+  currently includes some packages from RHEL because not all packages required
+  by OpenShift are provided in CentOS Stream.
+
+The default variant is `rhel-9.4`.
+
 ## Reporting issues
 
 The issue tracker for this repository is only used to track the development
@@ -34,3 +47,4 @@ See [OpenShift CI notes](docs/openshift-ci-notes.md) for more information.
 
 [coreos-assembler]: https://github.com/coreos/coreos-assembler/
 [OKD issue tracker]: https://github.com/openshift/okd/issues
+[variants]: https://github.com/coreos/coreos-assembler/blob/065cd2d20e379642cc3a69e498d20708e2243b21/src/cmd-init#L45-L48
diff --git a/ci/prow-entrypoint.sh b/ci/prow-entrypoint.sh
index dc0a1402..cd65ffd1 100755
--- a/ci/prow-entrypoint.sh
+++ b/ci/prow-entrypoint.sh
@@ -300,36 +300,36 @@ main() {
             prepare_repos
             ;;
         "build" | "init-and-build-default")  # TODO: change prow job to use init-and-build-default
-            cosa_init "rhel-coreos-9"
+            cosa_init "rhel-9.4"
             cosa_build
             ;;
         "rhcos-cosa-prow-pr-ci")
             setup_user
-            cosa_init "rhel-coreos-9"
+            cosa_init "rhel-9.4"
             cosa_build
             kola_test_qemu
             ;;
         "rhcos-9-build-test-qemu")
             setup_user
-            cosa_init "rhel-coreos-9"
+            cosa_init "rhel-9.4"
             cosa_build
             kola_test_qemu
             ;;
         "rhcos-9-build-test-metal")
             setup_user
-            cosa_init "rhel-coreos-9"
+            cosa_init "rhel-9.4"
             cosa_build
             kola_test_metal
             ;;
         "scos-9-build-test-qemu")
             setup_user
-            cosa_init "scos"
+            cosa_init "c9s"
             cosa_build
             kola_test_qemu
             ;;
         "scos-9-build-test-metal")
             setup_user
-            cosa_init "scos"
+            cosa_init "c9s"
             cosa_build
             kola_test_metal
             ;;
diff --git a/extensions-rhel-coreos-9.yaml b/extensions-rhel-coreos-9.yaml
deleted file mode 120000
index 94e08ff2..00000000
--- a/extensions-rhel-coreos-9.yaml
+++ /dev/null
@@ -1 +0,0 @@
-extensions-rhel-9.4.yaml
\ No newline at end of file
diff --git a/extensions-scos.yaml b/extensions-scos.yaml
deleted file mode 120000
index dedefe81..00000000
--- a/extensions-scos.yaml
+++ /dev/null
@@ -1 +0,0 @@
-extensions-c9s.yaml
\ No newline at end of file
diff --git a/extensions.yaml b/extensions.yaml
index 91cb33f6..94e08ff2 120000
--- a/extensions.yaml
+++ b/extensions.yaml
@@ -1 +1 @@
-extensions-rhel-coreos-9.yaml
\ No newline at end of file
+extensions-rhel-9.4.yaml
\ No newline at end of file
diff --git a/image-rhel-coreos-9.yaml b/image-rhel-coreos-9.yaml
deleted file mode 120000
index 3abbf78c..00000000
--- a/image-rhel-coreos-9.yaml
+++ /dev/null
@@ -1 +0,0 @@
-image-rhel-9.4.yaml
\ No newline at end of file
diff --git a/image-scos.yaml b/image-scos.yaml
deleted file mode 120000
index 56168f45..00000000
--- a/image-scos.yaml
+++ /dev/null
@@ -1 +0,0 @@
-image-c9s.yaml
\ No newline at end of file
diff --git a/image.yaml b/image.yaml
index 81b4da81..3abbf78c 120000
--- a/image.yaml
+++ b/image.yaml
@@ -1 +1 @@
-image-rhel-coreos-9.yaml
\ No newline at end of file
+image-rhel-9.4.yaml
\ No newline at end of file
diff --git a/manifest-rhel-coreos-9.yaml b/manifest-rhel-coreos-9.yaml
deleted file mode 120000
index e376971b..00000000
--- a/manifest-rhel-coreos-9.yaml
+++ /dev/null
@@ -1 +0,0 @@
-manifest-rhel-9.4.yaml
\ No newline at end of file
diff --git a/manifest-scos.yaml b/manifest-scos.yaml
deleted file mode 120000
index 04717602..00000000
--- a/manifest-scos.yaml
+++ /dev/null
@@ -1 +0,0 @@
-manifest-c9s.yaml
\ No newline at end of file
diff --git a/manifest.yaml b/manifest.yaml
index 5aa2be8d..e376971b 120000
--- a/manifest.yaml
+++ b/manifest.yaml
@@ -1 +1 @@
-manifest-rhel-coreos-9.yaml
\ No newline at end of file
+manifest-rhel-9.4.yaml
\ No newline at end of file