From 441fda39bbfe3fb643d5537034f72234148ae22f Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Thu, 29 Jan 2026 14:40:14 +0100 Subject: [PATCH 1/3] Update docs and scripts for installation from COPR --- README.md | 8 ++++ docs/run.md | 32 +++++++++++----- src/quickrpm.sh | 85 ++++++++++++++++++++++++++++++++--------- src/rpm/create_repos.sh | 33 +++++++++++----- 4 files changed, 121 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 8059123d..ce024fcf 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ Notes: Prebuilt MicroShift artifacts are published at the [Releases](https://github.com/microshift-io/microshift/releases) page. +Nightly MicroShift RPMs are published on the COPR +[@microshift-io/microshift-nightly](https://copr.fedorainfracloud.org/coprs/g/microshift-io/microshift-nightly/). MicroShift can be run on the host or inside a Bootc container. * Install the [latest](https://github.com/microshift-io/microshift/releases/latest) @@ -48,6 +50,12 @@ MicroShift can be run on the host or inside a Bootc container. curl -s https://microshift-io.github.io/microshift/quickrpm.sh | sudo bash ``` +* Install nightly MicroShift RPM packages on your host and start the MicroShift service. + + ```bash + curl -s https://microshift-io.github.io/microshift/quickrpm.sh | sudo env RPM_SOURCE=copr-nightly bash + ``` + * Bootstrap the [latest](https://github.com/microshift-io/microshift/releases/latest) MicroShift build inside a Bootc container on your host. diff --git a/docs/run.md b/docs/run.md index bbe597a5..1222a972 100644 --- a/docs/run.md +++ b/docs/run.md @@ -10,6 +10,19 @@ inside a Bootc container. ### Install RPM +The following optional RPM packages are available in the repository. It is +mandatory to install either `microshift-kindnet` or `microshift-networking` +to enable the Kindnet or OVN-K networking support. + +| Package | Description | Comments | +|-----------------------|----------------------------|----------| +| microshift-kindnet | Kindnet CNI | Overrides OVN-K | +| microshift-networking | OVN-K CNI | Uninstall Kindnet to enable OVN-K | +| microshift-topolvm | TopoLVM CSI | Install to enable storage support | +| microshift-olm | Operator Lifecycle Manager | See [Operator Hub Catalogs](https://okd.io/docs/operators/) | + +#### RPMs from Releases or built locally + Run the following commands to install MicroShift RPM packages from a local repository. This repository should be either [built locally](../docs/build.md#create-rpm-packages) or downloaded from [Releases](https://github.com/microshift-io/microshift/releases). @@ -22,16 +35,17 @@ sudo dnf install -y microshift microshift-kindnet sudo ./src/rpm/create_repos.sh -delete ``` -The following optional RPM packages are available in the repository. It is -mandatory to install either `microshift-kindnet` or `microshift-networking` -to enable the Kindnet or OVN-K networking support. +#### RPMs from the COPR -| Package | Description | Comments | -|-----------------------|----------------------------|----------| -| microshift-kindnet | Kindnet CNI | Overrides OVN-K | -| microshift-networking | OVN-K CNI | Uninstall Kindnet to enable OVN-K | -| microshift-topolvm | TopoLVM CSI | Install to enable storage support | -| microshift-olm | Operator Lifecycle Manager | See [Operator Hub Catalogs](https://okd.io/docs/operators/) | +Run the following commands to install MicroShift nightly RPM packages from the COPR. +Before installing MicroShift, RHOCP beta mirror must be enabled to provide dependencies. + +```bash +sudo dnf copr enable -y @microshift-io/microshift-nightly +XY=$(sudo dnf repoquery --repo='copr*microshift-nightly' --qf '%{VERSION}' microshift --latest-limit=1 2>/dev/null | cut -d. -f1,2) +sudo ./src/rpm/create_repos.sh -rhocp-mirror "${XY}" +sudo dnf install -y microshift microshift-kindnet +``` ### Start MicroShift Service diff --git a/src/quickrpm.sh b/src/quickrpm.sh index e06ec819..aaf478a3 100755 --- a/src/quickrpm.sh +++ b/src/quickrpm.sh @@ -5,6 +5,8 @@ OWNER=${OWNER:-microshift-io} REPO=${REPO:-microshift} BRANCH=${BRANCH:-main} TAG=${TAG:-latest} +RPM_SOURCE=${RPM_SOURCE:-github} # Accepted values: github, copr-nightly +COPR_REPO=${COPR_REPO:-@microshift-io/microshift-nightly} LVM_DISK="/var/lib/microshift-okd/lvmdisk.image" VG_NAME="myvg1" @@ -57,6 +59,52 @@ function centos10_cni_plugins() { containernetworking-plugins } +function download_script() { + local -r script=$1 + curl -fSsL --retry 5 --max-time 60 \ + "https://github.com/${OWNER}/${REPO}/raw/${BRANCH}/src/rpm/${script}" \ + -o "${WORKDIR}/${script}" + chmod +x "${WORKDIR}/${script}" +} + +function install_microshift_packages() { + # Disable weak dependencies to avoid the deployment of the microshift-networking + # RPM, which is not necessary when microshift-kindnet RPM is installed. + dnf install -y --setopt=install_weak_deps=False \ + microshift microshift-kindnet microshift-topolvm + + # shellcheck disable=SC1091 + source /etc/os-release + if [ "${ID}" == "fedora" ]; then + # Fedora doesn't have old packages - downgrading greenboot is not possible. + return 0 + fi + + # Pin the greenboot package to 0.15.z until the following issue is resolved: + # https://github.com/fedora-iot/greenboot-rs/issues/132 + dnf install -y 'greenboot-0.15.*' +} + +function install_rpms_copr() { + dnf copr enable -y "${COPR_REPO}" + + # Transform: + # "@microshift-io/microshift-nightly" -> "copr:copr.fedorainfracloud.org:group_microshift-io:microshift-nightly" + # "USER/PROJECT" -> "copr:copr.fedorainfracloud.org:USER:PROJECT" + local -r repo_name="copr:copr.fedorainfracloud.org:$(echo "${COPR_REPO}" | sed -e 's,/,:,g' -e 's,@,group_,g')" + + # Query the MicroShift version from COPR to determine the OpenShift mirror version + local repo_version + repo_version=$(dnf repoquery --repo="${repo_name}" --qf '%{VERSION}' --latest-limit=1 microshift 2>/dev/null | cut -d. -f1,2) + if [ -z "${repo_version:-}" ] ; then + echo "ERROR: Could not determine the MicroShift version from COPR repository" + exit 1 + fi + + "${WORKDIR}/create_repos.sh" -rhocp-mirror "${repo_version}" + install_microshift_packages +} + function install_rpms() { # Download the RPMs from the release mkdir -p "${WORKDIR}/rpms" @@ -64,25 +112,10 @@ function install_rpms() { "https://github.com/${OWNER}/${REPO}/releases/download/${TAG}/microshift-rpms-$(uname -m).tgz" | \ tar zxf - -C "${WORKDIR}/rpms" - # Download the installation scripts - for script in create_repos.sh postinstall.sh ; do - curl -fSsL --retry 5 --max-time 60 \ - "https://github.com/${OWNER}/${REPO}/raw/${BRANCH}/src/rpm/${script}" \ - -o "${WORKDIR}/${script}" - chmod +x "${WORKDIR}/${script}" - done - # Create the RPM repository and install the RPMs "${WORKDIR}/create_repos.sh" -create "${WORKDIR}/rpms" - # Disable weak dependencies to avoid the deployment of the microshift-networking - # RPM, which is not necessary when microshift-kindnet RPM is installed. - dnf install -y --setopt=install_weak_deps=False \ - microshift microshift-kindnet microshift-topolvm + install_microshift_packages "${WORKDIR}/create_repos.sh" -delete - - # Pin the greenboot package to 0.15.z until the following issue is resolved: - # https://github.com/fedora-iot/greenboot-rs/issues/132 - dnf install -y 'greenboot-0.15.*' } function prepare_lvm_disk() { @@ -123,8 +156,8 @@ if [ "$(id -u)" -ne 0 ]; then exit 1 fi -# Update the 'latest' tag to the latest released version -if [ "${TAG}" == "latest" ] ; then +# Update the 'latest' tag to the latest released version (only for github source) +if [ "${RPM_SOURCE}" == "github" ] && [ "${TAG}" == "latest" ] ; then dnf install -y jq TAG="$(curl -s --max-time 60 "https://api.github.com/repos/${OWNER}/${REPO}/releases/latest" | jq -r .tag_name)" if [ -z "${TAG}" ] || [ "${TAG}" == "null" ] ; then @@ -136,7 +169,21 @@ fi # Run the procedures check_prerequisites centos10_cni_plugins -install_rpms +download_script create_repos.sh +download_script postinstall.sh + +case "${RPM_SOURCE}" in +github) + install_rpms + ;; +copr-nightly) + install_rpms_copr + ;; +*) + echo "ERROR: Unsupported RPM_SOURCE: ${RPM_SOURCE}. Use 'github' or 'copr-nightly'." + exit 1 + ;; +esac prepare_lvm_disk "${LVM_DISK}" "${VG_NAME}" setup_lvm_service "${LVM_DISK}" "${VG_NAME}" start_microshift diff --git a/src/rpm/create_repos.sh b/src/rpm/create_repos.sh index ac5f183c..c3013e10 100755 --- a/src/rpm/create_repos.sh +++ b/src/rpm/create_repos.sh @@ -5,10 +5,23 @@ USHIFT_LOCAL_REPO_FILE=/etc/yum.repos.d/microshift-local.repo OCP_MIRROR_REPO_FILE=/etc/yum.repos.d/openshift-mirror-beta.repo function usage() { - echo "Usage: $(basename "$0") [-create ] | [-delete]" + echo "Usage: $(basename "$0") [-create ] | [-rhocp-mirror ] | [-delete]" exit 1 } +function create_rhocp_repo() { + local -r repo_version=$1 + + cat > "${OCP_MIRROR_REPO_FILE}" < "${OCP_MIRROR_REPO_FILE}" < Date: Fri, 30 Jan 2026 10:43:46 +0100 Subject: [PATCH 2/3] If quickrpm.sh is ran from repo, copy extra scripts --- src/quickrpm.sh | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/quickrpm.sh b/src/quickrpm.sh index aaf478a3..59888f3c 100755 --- a/src/quickrpm.sh +++ b/src/quickrpm.sh @@ -61,10 +61,20 @@ function centos10_cni_plugins() { function download_script() { local -r script=$1 - curl -fSsL --retry 5 --max-time 60 \ - "https://github.com/${OWNER}/${REPO}/raw/${BRANCH}/src/rpm/${script}" \ - -o "${WORKDIR}/${script}" - chmod +x "${WORKDIR}/${script}" + local -r scriptpath="src/rpm/${script}" + + curscriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + + # If the quickrpm.sh is executed from the repository, copy local script. + # Otherwise, fetch them from the github. + if [ -f "${curscriptdir}/../${scriptpath}" ]; then + cp -v "${curscriptdir}/../${scriptpath}" "${WORKDIR}/${script}" + else + curl -fSsL --retry 5 --max-time 60 \ + "https://github.com/${OWNER}/${REPO}/raw/${BRANCH}/src/rpm/${script}" \ + -o "${WORKDIR}/${script}" + chmod +x "${WORKDIR}/${script}" + fi } function install_microshift_packages() { From 60916b86ec8dab2ad304a67f2c88a8fc67a146a0 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Fri, 30 Jan 2026 10:44:58 +0100 Subject: [PATCH 3/3] Simplify RHOCP setup for users --- docs/run.md | 6 ++++-- src/quickrpm.sh | 17 +++-------------- src/rpm/create_repos.sh | 26 +++++++++++++------------- 3 files changed, 20 insertions(+), 29 deletions(-) diff --git a/docs/run.md b/docs/run.md index 1222a972..5d2f5541 100644 --- a/docs/run.md +++ b/docs/run.md @@ -40,10 +40,12 @@ sudo ./src/rpm/create_repos.sh -delete Run the following commands to install MicroShift nightly RPM packages from the COPR. Before installing MicroShift, RHOCP beta mirror must be enabled to provide dependencies. +> Note: This approach does not remove the configured repositories in order to get updates for +> MicroShift and dependencies whenever `dnf update` is executed. + ```bash sudo dnf copr enable -y @microshift-io/microshift-nightly -XY=$(sudo dnf repoquery --repo='copr*microshift-nightly' --qf '%{VERSION}' microshift --latest-limit=1 2>/dev/null | cut -d. -f1,2) -sudo ./src/rpm/create_repos.sh -rhocp-mirror "${XY}" +sudo ./src/rpm/create_repos.sh -rhocp-mirror sudo dnf install -y microshift microshift-kindnet ``` diff --git a/src/quickrpm.sh b/src/quickrpm.sh index 59888f3c..16c5afd4 100755 --- a/src/quickrpm.sh +++ b/src/quickrpm.sh @@ -98,21 +98,10 @@ function install_microshift_packages() { function install_rpms_copr() { dnf copr enable -y "${COPR_REPO}" - # Transform: - # "@microshift-io/microshift-nightly" -> "copr:copr.fedorainfracloud.org:group_microshift-io:microshift-nightly" - # "USER/PROJECT" -> "copr:copr.fedorainfracloud.org:USER:PROJECT" - local -r repo_name="copr:copr.fedorainfracloud.org:$(echo "${COPR_REPO}" | sed -e 's,/,:,g' -e 's,@,group_,g')" - - # Query the MicroShift version from COPR to determine the OpenShift mirror version - local repo_version - repo_version=$(dnf repoquery --repo="${repo_name}" --qf '%{VERSION}' --latest-limit=1 microshift 2>/dev/null | cut -d. -f1,2) - if [ -z "${repo_version:-}" ] ; then - echo "ERROR: Could not determine the MicroShift version from COPR repository" - exit 1 - fi - - "${WORKDIR}/create_repos.sh" -rhocp-mirror "${repo_version}" + "${WORKDIR}/create_repos.sh" -rhocp-mirror install_microshift_packages + # Keep the repos, so the `dnf update` works for updated MicroShift RPMs and + # updated dependencies. } function install_rpms() { diff --git a/src/rpm/create_repos.sh b/src/rpm/create_repos.sh index c3013e10..041e7682 100755 --- a/src/rpm/create_repos.sh +++ b/src/rpm/create_repos.sh @@ -1,8 +1,9 @@ #!/bin/bash set -euo pipefail -USHIFT_LOCAL_REPO_FILE=/etc/yum.repos.d/microshift-local.repo -OCP_MIRROR_REPO_FILE=/etc/yum.repos.d/openshift-mirror-beta.repo +YUM_REPOS_D=/etc/yum.repos.d +USHIFT_LOCAL_REPO_FILE=microshift-local.repo +OCP_MIRROR_REPO_FILE_PREFIX=microshift-deps function usage() { echo "Usage: $(basename "$0") [-create ] | [-rhocp-mirror ] | [-delete]" @@ -12,7 +13,8 @@ function usage() { function create_rhocp_repo() { local -r repo_version=$1 - cat > "${OCP_MIRROR_REPO_FILE}" < "${file}" < "${USHIFT_LOCAL_REPO_FILE}" < "${YUM_REPOS_D}/${USHIFT_LOCAL_REPO_FILE}" </dev/null | cut -d. -f1,2) if [ -z "${repo_version}" ] ; then - echo "ERROR: Version argument is required for -rhocp-mirror. Example: -rhocp-mirror 4.21" + echo "ERROR: Failed to find version of MicroShift available in the repositories" usage fi create_rhocp_repo "${repo_version}"