Skip to content

Commit

Permalink
ci/get-ocp-repo: Keep RHEL 9 repos for OKD 10
Browse files Browse the repository at this point in the history
  • Loading branch information
travier authored and jbtrystram committed Feb 28, 2025
1 parent 352d241 commit b605c27
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions ci/get-ocp-repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ while [ $# -ne 0 ]; do
shift
done

set -x

if [ -n "$ocp_manifest" ]; then
# --ocp-layer path
rhel_version=$(source /usr/lib/os-release; echo ${VERSION_ID//./})
Expand Down Expand Up @@ -75,8 +77,9 @@ else
# first, make sure we're looking at the right manifest
manifest="$cosa_workdir/src/config/manifest.yaml"
if [ -f "$cosa_workdir/src/config.json" ]; then
variant="$(jq --raw-output '."coreos-assembler.config-variant"' 'src/config.json')"
variant="$(jq --raw-output '."coreos-assembler.config-variant"' "$cosa_workdir/src/config.json")"
manifest="$cosa_workdir/src/config/manifest-${variant}.yaml"
info "Using variant ${variant}"
fi
# flatten manifest and query a couple of fields
Expand All @@ -89,6 +92,8 @@ else
info "Building pure SCOS variant. Exiting..."
exit 0
elif [ "$osname" = scos ]; then
centos_version_prefix=$(jq -r '.["automatic-version-prefix"]' <<< "$json")
centos_version=$(cut -f2 -d. <<< "$centos_version_prefix")
# We still need the OCP repos for now unfortunately because not
# everything is in the Stream repo. For the RHEL version, just use the
# default variant's one.
Expand All @@ -97,7 +102,7 @@ else
version=$(jq -r '.["automatic-version-prefix"]' <<< "$json")
if [ "$is_ocp_variant" = true ]; then
# RHEL version is second field
info "Building OCP variant"
info "Building OCP/OKD variant"
rhel_version=$(cut -f2 -d. <<< "$version")
else
# RHEL version is first and second field
Expand All @@ -115,24 +120,28 @@ fi
mkdir -p "$output_dir"
repo_path="$output_dir/ocp.repo"
set -x
info "Fetching ${ocp_version} ${rhel_version} repos"
# set -x
curl --fail -L "http://base-${ocp_version}-rhel${rhel_version}.ocp.svc.cluster.local" -o "$repo_path"
set +x
# set +x
if [ "${rhel_version}" = 96 ]; then
# XXX: also currently also add 9.4 repos for crun-wasm when building extensions
# https://github.com/openshift/os/issues/1680
# https://github.com/openshift/os/pull/1682
# https://issues.redhat.com/browse/COS-3075
info "Fetching 4.19 94 repos"
curl --fail -L http://base-4-19-rhel94.ocp.svc.cluster.local >> "$repo_path"
fi
# If we're building the SCOS OKD variant, then strip away all the RHEL repos and just keep the plashet.
# If we are building the SCOS OKD 9 variant, then strip away all the RHEL repos and just keep the plashet.
# Temporary workaround until we have all packages for SCOS in CentOS Stream.
if [ "$osname" = scos ]; then
# If we are building the SCOS OKD 10 variant, then we need some RHEL packages for now.
if [ "$osname" = scos ] && [ "${centos_version}" != "10" ]; then
info "Neutering RHEL repos for SCOS"
awk '/server-ose/,/^$/' "$repo_path" > "$repo_path.tmp"
mv "$repo_path.tmp" "$repo_path"
fi
info "Final repo config"
cat "$repo_path"

0 comments on commit b605c27

Please sign in to comment.