-
Notifications
You must be signed in to change notification settings - Fork 18
microshift-io/microshift-nightly COPR: RPM with rhocp-mirror-beta configs #203
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
Merged
+309
−22
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b232655
Tools for creating RPM with rhocp beta .repo files
pmtk c2add92
Add rhocp deps rpm to nightly-copr workflow
pmtk 6f7dcb6
Update docs
pmtk 9f113f3
containernetworking-plugins RPM
pmtk be7c86c
General improvement around COPR tools
pmtk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| _package_name="containernetworking-plugins" | ||
| _scriptdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
|
||
| if [ $# -ne 1 ]; then | ||
| echo "Usage: $(basename "$0") <copr-repo-name>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| COPR_REPO_NAME="$1" | ||
|
|
||
| [ -z "${COPR_REPO_NAME}" ] && echo "ERROR: COPR_REPO_NAME is not set" && exit 1 | ||
| echo "COPR_REPO_NAME: '${COPR_REPO_NAME}'" | ||
|
|
||
| latest_tag=$(curl -fsSL --retry 3 \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| https://api.github.com/repos/containernetworking/plugins/releases/latest | jq -r '.tag_name') | ||
|
|
||
| if [ -z "${latest_tag}" ] || [ "${latest_tag}" = "null" ]; then | ||
| echo "ERROR: Failed to retrieve latest tag from containernetworking/plugins" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "### containernetworking/plugins latest tag: '${latest_tag}'" | ||
| version="${latest_tag#v}" | ||
|
|
||
| echo "### Checking if package ${_package_name} ${version} already exists in the COPR repository" | ||
| cni_pkg="$(copr-cli list-packages "${COPR_REPO_NAME}" | jq -r '.[] | select(.name == "'${_package_name}'")')" | ||
| if [ -n "${cni_pkg}" ]; then | ||
| existing_package_version=$(copr-cli get-package \ | ||
| --name "${_package_name}" \ | ||
| --with-latest-succeeded-build \ | ||
| "${COPR_REPO_NAME}" \ | ||
| | jq -r '.latest_succeeded_build.source_package.version') | ||
|
|
||
| if [[ "${existing_package_version}" == "1:${version}-1" ]]; then | ||
| echo "### Package ${_package_name} ${version} already exists in the COPR repository" | ||
| exit 0 | ||
| fi | ||
| fi | ||
|
|
||
| temp_dir="$(mktemp -d "/tmp/containernetworking-plugins-${version}.XXXXXX")" | ||
| cp "${_scriptdir}/containernetworking-plugins.spec" "${temp_dir}/" | ||
|
|
||
| pushd "${temp_dir}" >/dev/null | ||
|
|
||
| echo "### Downloading the CNI plugins x86_64 and aarch64 releases for ${version}" | ||
| curl -L -o amd64.tgz "https://github.com/containernetworking/plugins/releases/download/v${version}/cni-plugins-linux-amd64-v${version}.tgz" | ||
| curl -L -o arm64.tgz "https://github.com/containernetworking/plugins/releases/download/v${version}/cni-plugins-linux-arm64-v${version}.tgz" | ||
|
|
||
| mkdir -p "containernetworking-plugins-${version}"/{x86_64,aarch64} | ||
|
|
||
| tar xf amd64.tgz -C "containernetworking-plugins-${version}/x86_64" | ||
| tar xf arm64.tgz -C "containernetworking-plugins-${version}/aarch64" | ||
| cp \ | ||
| "containernetworking-plugins-${version}/x86_64/LICENSE" \ | ||
| "containernetworking-plugins-${version}/x86_64/README.md" \ | ||
| "containernetworking-plugins-${version}/" | ||
|
|
||
| tar czf "containernetworking-plugins-${version}.tar.gz" -C "containernetworking-plugins-${version}" . | ||
|
|
||
| mkdir -p buildroot/{RPMS,SRPMS,SOURCES,SPECS,BUILD} | ||
| mv "containernetworking-plugins-${version}.tar.gz" buildroot/SOURCES/ | ||
|
|
||
| cat > buildroot/SPECS/containernetworking-plugins.spec <<EOF | ||
| %global ver ${version} | ||
| EOF | ||
| cat containernetworking-plugins.spec >> buildroot/SPECS/containernetworking-plugins.spec | ||
|
|
||
| echo "### Building the SRPM" | ||
| rpmbuild -bs --define "_topdir ./buildroot" ./buildroot/SPECS/containernetworking-plugins.spec | ||
|
|
||
| echo "### Pushing the SRPM to COPR (${COPR_REPO_NAME}) and waiting for the build" | ||
| # Just epel-10 chroots because of the obsolesence of the original package in the CentOS Stream 10. | ||
| if copr-cli build "${COPR_REPO_NAME}" \ | ||
| --chroot epel-10-aarch64 --chroot epel-10-x86_64 \ | ||
| "${temp_dir}/buildroot/SRPMS/containernetworking-plugins-${version}-1.src.rpm"; then | ||
| copr-cli regenerate-repos "${COPR_REPO_NAME}" | ||
| else | ||
| exit 1 | ||
| fi | ||
|
|
||
| popd >/dev/null | ||
| rm -rf "${temp_dir}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| %global debug_package %{nil} | ||
|
|
||
| Name: containernetworking-plugins | ||
| # Setting epoch to workaround containers-common's Obsolete of 'containernetworking-plugins < 2' | ||
| Epoch: 1 | ||
| Version: %{ver} | ||
| Release: 1 | ||
| Summary: Binaries required to provision kubernetes container networking | ||
|
|
||
| Packager: MicroShift team | ||
| License: Apache-2.0 | ||
| URL: https://microshift.io | ||
| Source0: %{name}-%{version}.tar.gz | ||
|
|
||
| %description | ||
| %{summary}. | ||
|
|
||
| %prep | ||
| %setup -q -c | ||
|
|
||
| %build | ||
| # Nothing to build | ||
|
|
||
| %install | ||
| # Detect host arch | ||
| KUBE_ARCH="$(uname -m)" | ||
|
|
||
| # Install files | ||
| mkdir -p %{buildroot}/usr/libexec/cni/ | ||
| mkdir -p %{buildroot}%{_sysconfdir}/cni/net.d/ | ||
|
|
||
| cp -a ${KUBE_ARCH}/* %{buildroot}/usr/libexec/cni/ | ||
|
|
||
| %files | ||
| /usr/libexec/cni/ | ||
| %dir %{_sysconfdir}/cni | ||
| %dir %{_sysconfdir}/cni/net.d | ||
| %license LICENSE | ||
| %doc README.md | ||
|
|
||
| %changelog | ||
| * Fri Feb 13 2026 Patryk Matuszak <pmatusza@redhat.com> 0.0.0 | ||
| - Init specfile based on https://download.opensuse.org/repositories/isv:/kubernetes:/core:/prerelease:/v1.36/rpm/src/kubernetes-cni-1.8.0-150500.1.1.src.rpm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,10 @@ | ||
| FROM quay.io/fedora/fedora:latest | ||
|
|
||
| RUN dnf install -y copr-cli && dnf clean all | ||
| RUN dnf install \ | ||
| --setopt=install_weak_deps=False \ | ||
| -y \ | ||
| copr-cli jq rpm-build \ | ||
| && dnf clean all | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| COPY create-build.sh microshift-io-dependencies.sh cni/containernetworking-plugins.spec / | ||
| COPY cni/build.sh cni/containernetworking-plugins.spec /cni/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| _package_name="microshift-io-dependencies" | ||
|
|
||
| if [ $# -ne 2 ]; then | ||
| echo "Usage: $(basename "$0") <okd-version-tag> <copr-repo-name>" | ||
| exit 1 | ||
| fi | ||
|
|
||
| OKD_VERSION_TAG="$1" | ||
| COPR_REPO_NAME="$2" | ||
|
|
||
| echo "OKD_VERSION_TAG: '${OKD_VERSION_TAG}'" | ||
| echo "COPR_REPO_NAME: '${COPR_REPO_NAME}'" | ||
|
|
||
| [ -z "${OKD_VERSION_TAG}" ] && echo "ERROR: OKD_VERSION_TAG is not set" && exit 1 | ||
| [ -z "${COPR_REPO_NAME}" ] && echo "ERROR: COPR_REPO_NAME is not set" && exit 1 | ||
|
|
||
| major=$(echo "${OKD_VERSION_TAG}" | cut -d. -f1) | ||
| minor=$(echo "${OKD_VERSION_TAG}" | cut -d. -f2) | ||
| pkg_version="${major}.${minor}" | ||
| echo "New package version: '${pkg_version}'" | ||
|
|
||
| if copr-cli list-packages "${COPR_REPO_NAME}" | jq -r '.[].name' | grep -q "${_package_name}"; then | ||
| existing_package_version=$(copr-cli get-package \ | ||
| --name "${_package_name}" \ | ||
| --with-latest-succeeded-build \ | ||
| "${COPR_REPO_NAME}" \ | ||
| | jq -r '.latest_succeeded_build.source_package.version') | ||
|
|
||
| if [[ "${existing_package_version}" == "${pkg_version}-1" ]]; then | ||
| echo "Package ${_package_name} ${pkg_version} already exists in the COPR repository" | ||
| exit 0 | ||
| fi | ||
| fi | ||
|
|
||
| # Include 3 repos (X.Y, X.Y-1, and X.Y-2) just in case there's some dependencies misalignment. | ||
| minor_version_start=$((minor - 2)) | ||
| rhocp_versions="" | ||
| for min in $(seq "${minor_version_start}" "${minor}") ; do | ||
| rhocp_versions+="${major}.${min} " | ||
| done | ||
|
|
||
| echo "RHOCP versions to create .repo files for: '${rhocp_versions}'" | ||
|
|
||
| dest=$(mktemp -d "/tmp/${_package_name}.XXXXXX") | ||
| cat > "${dest}/${_package_name}.spec" <<EOF | ||
| %global rhocp_versions ${rhocp_versions} | ||
| %global version ${pkg_version} | ||
|
|
||
| Name: ${_package_name} | ||
| Version: %{version} | ||
| Release: 1%{?dist} | ||
| Summary: RPM repository configurations for MicroShift dependencies | ||
|
|
||
| License: Apache-2.0 | ||
| URL: https://github.com/microshift-io/microshift-io | ||
| BuildArch: noarch | ||
|
|
||
| %description | ||
| This package installs RPM repository configuration files required | ||
| for installing MicroShift dependencies from the OpenShift beta mirror repository. | ||
|
|
||
| %install | ||
| install -d %{buildroot}%{_sysconfdir}/yum.repos.d | ||
|
|
||
| for v in %{rhocp_versions}; do | ||
| cat >> %{buildroot}%{_sysconfdir}/yum.repos.d/openshift-mirror-beta.repo <<EOF2 | ||
| [openshift-mirror-\${v}-beta] | ||
| name=OpenShift \${v} Mirror Beta Repository | ||
| baseurl=https://mirror.openshift.com/pub/openshift-v4/\\\$basearch/dependencies/rpms/\${v}-el9-beta/ | ||
| enabled=1 | ||
| gpgcheck=0 | ||
| skip_if_unavailable=0 | ||
|
|
||
| EOF2 | ||
| done | ||
|
|
||
| %files | ||
| %config(noreplace) %{_sysconfdir}/yum.repos.d/openshift-mirror-beta.repo | ||
|
|
||
| EOF | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| echo "--------------- SPEC FILE ---------------" | ||
| cat "${dest}/${_package_name}.spec" | ||
| echo "-----------------------------------------" | ||
|
|
||
| if copr-cli build "${COPR_REPO_NAME}" "${dest}/${_package_name}.spec"; then | ||
| copr-cli regenerate-repos "${COPR_REPO_NAME}" | ||
| else | ||
| exit 1 | ||
pmtk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fi | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.