-
Notifications
You must be signed in to change notification settings - Fork 129
OCPBUGS-52363: ci/get-ocp-repo.sh: Fixes for scos to accomodate building images in CI #1757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,11 +29,50 @@ info() { | |
| echo "INFO:" "$@" >&2 | ||
| } | ||
|
|
||
| cleanup_repos() { | ||
| # if we had installed the packages and created symlinks, remove it | ||
| if rpm -q centos-release-cloud; then | ||
| dnf remove -y centos-release-{cloud,nfv,virt}-common | ||
| find "/usr/share/distribution-gpg-keys/centos" -type l -exec rm -f {} \; | ||
| echo "Removed all symbolic links and packages installed for scos" | ||
| fi | ||
| # remove ocp.repo file | ||
| if [ -n "$ocp_manifest" ]; then | ||
| if [ -z "$output_dir" ]; then | ||
| output_dir=$(dirname "$ocp_manifest") | ||
| fi | ||
| else | ||
| if [ -z "$output_dir" ]; then | ||
| output_dir="$cosa_workdir/src/config" | ||
| fi | ||
| fi | ||
| rm "$output_dir/ocp.repo" | ||
| echo "Removed repo file $output_dir/ocp.repo" | ||
| } | ||
|
|
||
| create_gpg_keys() { | ||
| # Check if centos-stream-release is installed and centos-release-cloud is not | ||
| if rpm -q centos-stream-release && ! rpm -q centos-release-cloud; then | ||
| dnf install -y centos-release-{cloud,nfv,virt}-common | ||
| fi | ||
|
|
||
| # Create directory for CentOS distribution GPG keys | ||
| mkdir -p /usr/share/distribution-gpg-keys/centos | ||
| # Create symbolic links for GPG keys | ||
| if [ ! -e "/usr/share/distribution-gpg-keys/centos/RPM-GPG-KEY-CentOS-Official" ]; then | ||
| ln -s /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial /usr/share/distribution-gpg-keys/centos/RPM-GPG-KEY-CentOS-Official | ||
| ln -s {/etc/pki/rpm-gpg,/usr/share/distribution-gpg-keys/centos}/RPM-GPG-KEY-CentOS-SIG-Cloud | ||
| ln -s {/etc/pki/rpm-gpg,/usr/share/distribution-gpg-keys/centos}/RPM-GPG-KEY-CentOS-SIG-Extras-SHA512 | ||
| ln -s {/etc/pki/rpm-gpg,/usr/share/distribution-gpg-keys/centos}/RPM-GPG-KEY-CentOS-SIG-NFV | ||
| ln -s {/etc/pki/rpm-gpg,/usr/share/distribution-gpg-keys/centos}/RPM-GPG-KEY-CentOS-SIG-Virtualization | ||
| fi | ||
| } | ||
|
|
||
| cosa_workdir= | ||
| ocp_manifest= | ||
| output_dir= | ||
| rc=0 | ||
| options=$(getopt --options h --longoptions help,cosa-workdir:,ocp-layer:,output-dir: -- "$@") || rc=$? | ||
| options=$(getopt --options h --longoptions help,cosa-workdir:,ocp-layer:,output-dir:,cleanup,create-gpg-keys -- "$@") || rc=$? | ||
| [ $rc -eq 0 ] || print_usage_and_exit | ||
| eval set -- "$options" | ||
| while [ $# -ne 0 ]; do | ||
|
|
@@ -42,6 +81,8 @@ while [ $# -ne 0 ]; do | |
| --cosa-workdir) cosa_workdir=$2; shift;; | ||
| --ocp-layer) ocp_manifest=$2; shift;; | ||
| --output-dir) output_dir=$2; shift;; | ||
| --cleanup) cleanup_repos; exit 0;; | ||
| --create-gpg-keys) create_gpg_keys; exit 0;; | ||
| --) break;; | ||
| *) echo "$0: invalid argument: $1" >&2; exit 1;; | ||
| esac | ||
|
|
@@ -50,8 +91,6 @@ done | |
|
|
||
| if [ -n "$ocp_manifest" ]; then | ||
| # --ocp-layer path | ||
| rhel_version=$(source /usr/lib/os-release; echo ${VERSION_ID//./}) | ||
| info "Got RHEL version $rhel_version from /usr/lib/os-release" | ||
| ocp_version=$(rpm-ostree compose tree --print-only "$ocp_manifest" | jq -r '.metadata.ocp_version') | ||
| ocp_version=${ocp_version//./-} | ||
| info "Got OpenShift version $ocp_version from $ocp_manifest" | ||
|
|
@@ -61,6 +100,21 @@ if [ -n "$ocp_manifest" ]; then | |
| if [ -z "$output_dir" ]; then | ||
| output_dir=$(dirname "$ocp_manifest") | ||
| fi | ||
|
|
||
| # get rhel version corresponding to the release so we can get the | ||
| # correct OpenShift rpms from those for scos. These packages are not | ||
| # available in CentOS Stream | ||
| if [ "$osname" = scos ]; then | ||
| workdir=$(dirname "$ocp_manifest") | ||
| manifest="$workdir/manifest.yaml" | ||
| json=$(rpm-ostree compose tree --print-only "$manifest") | ||
| version=$(jq -r '.["automatic-version-prefix"]' <<< "$json") | ||
| rhel_version=$(cut -f2 -d. <<< "$version") | ||
| info "Got RHEL version $rhel_version from rhel manifest for scos" | ||
| else | ||
| rhel_version=$(source /usr/lib/os-release; echo ${VERSION_ID//./}) | ||
| info "Got RHEL version $rhel_version from /usr/lib/os-release" | ||
| fi | ||
| else | ||
| [ -n "$cosa_workdir" ] | ||
| # --cosa-workdir path | ||
|
|
@@ -132,7 +186,16 @@ fi | |
| if [ "$osname" = scos ]; then | ||
| info "Neutering RHEL repos for SCOS" | ||
| awk '/server-ose/,/^$/' "$repo_path" > "$repo_path.tmp" | ||
| # only pull in certain Openshift packages as the rest come from the c9s repo | ||
| sed -i '/^baseurl = /a includepkgs=openshift-* ose-aws-ecr-* ose-azure-acr-* ose-gcp-gcr-*' "$repo_path.tmp" | ||
| # add the contents of the CentOS Stream repo | ||
| workdir="$cosa_workdir/src/config" | ||
| if [ -n "$ocp_manifest" ]; then | ||
| workdir=$(dirname "$ocp_manifest") | ||
| fi | ||
| cat "$workdir/c9s.repo" >> "$repo_path.tmp" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is OK, though I think at least baseos and appstream will be duplicates with the builtin ones. Actually, is there a package we could install that has the SIG repo definitions? You can imagine once this repo is split in two and the base image is defined elsewhere, we wouldn't necessarily have the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'd have to look into that - you are correct that the base and appstream are present, but nothing else. installing these repos: |
||
| mv "$repo_path.tmp" "$repo_path" | ||
| create_gpg_keys | ||
| fi | ||
|
|
||
| cat "$repo_path" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? What else comes from the plashet without it?
Just want to avoid having to maintain a list here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes - we want cri-o, cri-tools, conmon, openvswitch to come from the sig-cloud and the Centos Stream openvswitch repos and not from the plashet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in the longterm we want to target even building the kubelet, openshift-clients and the platform related packages through sig-cloud so we can eliminate the need for the plashet completely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, agree.
But I mean more, are those other packages frequently higher versioned in the plashet than in the SIG repos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the versions differ, but not by much, except for openvswitch and ovn - we cannot use the one from plashets (they come from FDP repos)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ideally this list would live elsewhere. E.g. as another repo definition in openshift/release that's really just the same as the plashet, but has the
includepkgs=inlined. We do something similar also for the kernel: openshift/release#61361The advantage of that is that anything that wants to reuse these repo definitions doesn't have to redefine this stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah that's an idea..we could put the repo there and have a service to access similar to the rhel ones. especially once we start building the images through prow. Although every release we would need to bump the sig-cloud repos, which is fine as we have to do that in this repo too anyway