From 2e49ff8dea260f246d9191e04ab88ee9a0e69ba5 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Mon, 1 Dec 2025 18:06:01 +0100 Subject: [PATCH 01/12] SRPM builder --- Makefile | 14 +++++++ packaging/srpm.Containerfile | 76 ++++++++++++++++++++++++++++++++++++ src/image/build-rpms.sh | 3 +- 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 packaging/srpm.Containerfile diff --git a/Makefile b/Makefile index f625cd68..e42479cf 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ BUILDER_IMAGE := microshift-okd-builder USHIFT_IMAGE := microshift-okd LVM_DISK := /var/lib/microshift-okd/lvmdisk.image VG_NAME := myvg1 +SRPM_IMAGE := microshift-okd-srpm # # Define the main targets @@ -76,6 +77,19 @@ rpm: echo "Build completed successfully" && \ echo "RPMs are available in '$${outdir}'" +.PHONY: srpm +srpm: + @echo "Building the MicroShift SRPM image" + outdir="$${SRPM_WORKDIR:-$$(mktemp -d /tmp/microshift-srpms-XXXXXX)}" && \ + podman build \ + -t "${SRPM_IMAGE}" \ + --build-arg USHIFT_GITREF="${USHIFT_GITREF}" \ + --build-arg OKD_VERSION_TAG="${OKD_VERSION_TAG}" \ + --build-arg OKD_RELEASE_IMAGE="${OKD_RELEASE_IMAGE}" \ + --volume "$${outdir}:/output:Z" \ + -f packaging/srpm.Containerfile . && \ + echo "SRPMs are available in '$${outdir}'" + .PHONY: rpm-to-deb rpm-to-deb: if [ -z "${RPM_OUTDIR}" ] ; then \ diff --git a/packaging/srpm.Containerfile b/packaging/srpm.Containerfile new file mode 100644 index 00000000..1fd6e0ab --- /dev/null +++ b/packaging/srpm.Containerfile @@ -0,0 +1,76 @@ +# Using Fedora for easy dnf install +FROM quay.io/fedora/fedora:42 + +RUN dnf install -y \ + --setopt=install_weak_deps=False \ + git rpm-build jq python3-pip python3-specfile && \ + dnf clean all + +# Variables controlling the source of MicroShift components to build +ARG USHIFT_GITREF=main +ARG OKD_VERSION_TAG + +ENV OKD_VERSION_TAG=${OKD_VERSION_TAG} +ENV USHIFT_GITREF=${USHIFT_GITREF} + +# Internal variables +ARG OKD_REPO=quay.io/okd/scos-release +ARG USHIFT_GIT_URL=https://github.com/openshift/microshift.git +ENV HOME=/home/microshift +ARG BUILDER_RPM_REPO_PATH=${HOME}/microshift/_output/rpmbuild/RPMS +ARG USHIFT_PREBUILD_SCRIPT=/tmp/prebuild.sh +ARG USHIFT_POSTBUILD_SCRIPT=/tmp/postbuild.sh +ARG USHIFT_BUILDRPMS_SCRIPT=/tmp/build-rpms.sh +ARG USHIFT_MODIFY_SPEC_SCRIPT=/tmp/modify-spec.py +ARG USHIFT_BUILDRPMS_SCRIPT=/tmp/build-rpms.sh + +# Verify mandatory build arguments +RUN if [ -z "${OKD_VERSION_TAG}" ]; then \ + echo "ERROR: OKD_VERSION_TAG is not set"; \ + echo "See quay.io/okd/scos-release for a list of tags"; \ + exit 1; \ + fi + +RUN ARCH="" ; if [ "$(uname -m)" = "aarch64" ]; then ARCH="-arm64"; fi && \ + OKD_CLIENT_URL=https://github.com/okd-project/okd/releases/download/${OKD_VERSION_TAG}/openshift-client-linux${ARCH}-${OKD_VERSION_TAG}.tar.gz && \ + echo "OKD_CLIENT_URL: ${OKD_CLIENT_URL}" && \ + curl -L -o /tmp/okd-client.tar.gz "${OKD_CLIENT_URL}" && \ + tar -xzf /tmp/okd-client.tar.gz -C /tmp && \ + mv /tmp/oc /usr/local/bin/oc && \ + rm -rf /tmp/okd-client.tar.gz ; + +WORKDIR ${HOME} + +RUN git clone --branch "${USHIFT_GITREF}" --single-branch "${USHIFT_GIT_URL}" "${HOME}/microshift" + +# Replace component images with OKD image references +COPY --chmod=755 ./src/image/prebuild.sh ${USHIFT_PREBUILD_SCRIPT} +RUN "${USHIFT_PREBUILD_SCRIPT}" --replace "${OKD_REPO}" "${OKD_VERSION_TAG}" + +WORKDIR ${HOME}/microshift/ + + +COPY ./src/kindnet/kindnet.spec /tmp/kindnet.spec +COPY ./src/kindnet/assets/ ./assets/optional/ +COPY ./src/kindnet/dropins/ ./packaging/kindnet/ +COPY ./src/kindnet/crio.conf.d/ ./packaging/crio.conf.d/ + +COPY ./src/topolvm/topolvm.spec /tmp/topolvm.spec +COPY ./src/topolvm/assets/ ./assets/optional/topolvm/ +COPY ./src/topolvm/dropins/ ./packaging/microshift/dropins/ +COPY ./src/topolvm/greenboot/ ./packaging/greenboot/ +COPY ./src/topolvm/release/ ./assets/optional/topolvm/ + +RUN "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_REPO}" "${OKD_VERSION_TAG}" + +COPY --chmod=755 ./src/image/modify-spec.py ${USHIFT_MODIFY_SPEC_SCRIPT} +RUN python3 ${USHIFT_MODIFY_SPEC_SCRIPT} /tmp/kindnet.spec /tmp/topolvm.spec + +# Disable the RPM and SRPM checks in the make-rpm.sh script +# and modify the microshift.spec to remove packages not yet supported by the upstream +RUN sed -i -e 's,CHECK_RPMS="y",,g' -e 's,CHECK_SRPMS="y",,g' ./packaging/rpm/make-rpm.sh + +COPY --chmod=755 ./src/image/build-rpms.sh ${USHIFT_BUILDRPMS_SCRIPT} +RUN "${USHIFT_BUILDRPMS_SCRIPT}" srpm + +RUN cp ./_output/rpmbuild/SRPMS/* /output/ diff --git a/src/image/build-rpms.sh b/src/image/build-rpms.sh index 0b3e24e3..2e189a2e 100755 --- a/src/image/build-rpms.sh +++ b/src/image/build-rpms.sh @@ -73,10 +73,11 @@ export MICROSHIFT_VARIANT if [[ "${target}" == "all" || "${target}" == "rpm" ]]; then ./packaging/rpm/make-rpm.sh rpm local + echo "${MICROSHIFT_VERSION}" > _output/rpmbuild/RPMS/version.txt fi if [[ "${target}" == "all" || "${target}" == "srpm" ]]; then ./packaging/rpm/make-rpm.sh srpm local + echo "${MICROSHIFT_VERSION}" > _output/rpmbuild/SRPMS/version.txt fi -echo "${MICROSHIFT_VERSION}" > _output/rpmbuild/RPMS/version.txt From 60b616d6ddb26a2f24992062fd939208ef107041 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Mon, 1 Dec 2025 18:08:00 +0100 Subject: [PATCH 02/12] Make targets for COPR interactions --- Makefile | 3 ++ packaging/rpms-copr.Containerfile | 20 ++++++++ src/copr/copr-cli.Containerfile | 3 ++ src/copr/copr.mk | 80 +++++++++++++++++++++++++++++++ src/copr/create-build.sh | 7 +++ 5 files changed, 113 insertions(+) create mode 100644 packaging/rpms-copr.Containerfile create mode 100644 src/copr/copr-cli.Containerfile create mode 100644 src/copr/copr.mk create mode 100644 src/copr/create-build.sh diff --git a/Makefile b/Makefile index e42479cf..4a2cab9f 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,9 @@ LVM_DISK := /var/lib/microshift-okd/lvmdisk.image VG_NAME := myvg1 SRPM_IMAGE := microshift-okd-srpm +PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(PROJECT_DIR)/src/copr/copr.mk + # # Define the main targets # diff --git a/packaging/rpms-copr.Containerfile b/packaging/rpms-copr.Containerfile new file mode 100644 index 00000000..84cc38c9 --- /dev/null +++ b/packaging/rpms-copr.Containerfile @@ -0,0 +1,20 @@ +FROM quay.io/fedora/fedora:42 + +RUN dnf install -y \ + --setopt=install_weak_deps=False \ + copr-cli createrepo rpm2cpio cpio && \ + dnf clean all + +ARG COPR_BUILD_ID= +ARG BUILDER_RPM_REPO_PATH=/home/microshift/microshift/_output/rpmbuild/RPMS + +RUN \ + copr download-build --rpms --chroot "epel-9-$(uname -m)" --dest /tmp/rpms ${COPR_BUILD_ID} && \ + mkdir -p /home/microshift/microshift && \ + cd /tmp/rpms/"epel-9-$(uname -m)"/ && \ + rpm2cpio microshift-*.src.rpm | cpio -idmv && \ + tar xf microshift-*.tar.gz -C /home/microshift/microshift --strip-components=1 && \ + mkdir -p ${BUILDER_RPM_REPO_PATH} && \ + mv /tmp/rpms/"epel-9-$(uname -m)"/*.rpm ${BUILDER_RPM_REPO_PATH}/ && \ + createrepo -v ${BUILDER_RPM_REPO_PATH} && \ + rm -rf /tmp/rpms diff --git a/src/copr/copr-cli.Containerfile b/src/copr/copr-cli.Containerfile new file mode 100644 index 00000000..6a00140e --- /dev/null +++ b/src/copr/copr-cli.Containerfile @@ -0,0 +1,3 @@ +FROM quay.io/fedora/fedora:42 + +RUN dnf install -y copr-cli && dnf clean all diff --git a/src/copr/copr.mk b/src/copr/copr.mk new file mode 100644 index 00000000..1b5c7d5f --- /dev/null +++ b/src/copr/copr.mk @@ -0,0 +1,80 @@ +COPR_CONFIG ?= $(HOME)/.config/copr +COPR_REPO_NAME ?= "@microshift-io/microshift" + +COPR_SECRET_NAME := copr-cfg +COPR_BUILDER_IMAGE := rpm-copr-builder +COPR_CLI_IMAGE := localhost/copr-cli:latest + +COPR_BUILD_ID ?= $$(cat "${SRPM_WORKDIR}/build.txt") + +.PHONY: rpm-copr +rpm-copr: + @echo "Building MicroShift RPM image using COPR" + sudo podman build \ + --tag "${COPR_BUILDER_IMAGE}" \ + --build-arg COPR_BUILD_ID="${COPR_BUILD_ID}" \ + --file packaging/rpms-copr.Containerfile . + + @echo "Extracting the MicroShift RPMs" + outdir="$${RPM_OUTDIR:-$$(mktemp -d /tmp/microshift-rpms-XXXXXX)}" && \ + mntdir="$$(sudo podman image mount "${COPR_BUILDER_IMAGE}")" && \ + sudo cp -r "$${mntdir}/home/microshift/microshift/_output/rpmbuild/RPMS/." "$${outdir}" && \ + sudo podman image umount "${COPR_BUILDER_IMAGE}" && \ + echo "" && \ + echo "Build completed successfully" && \ + echo "RPMs are available in '$${outdir}'" + +.PHONY: copr-cfg-ensure-podman-secret +copr-cfg-ensure-podman-secret: + @echo "Ensuring the COPR secret is available and is up to date" + if sudo podman secret exists "${COPR_SECRET_NAME}"; then \ + sudo podman secret rm "${COPR_SECRET_NAME}" ; \ + fi && \ + sudo podman secret create "${COPR_SECRET_NAME}" "${COPR_CONFIG}" + +.PHONY: copr-cli +copr-cli: + @echo "Building the COPR CLI container" + sudo podman build \ + --tag "${COPR_CLI_IMAGE}" \ + --file src/copr/copr-cli.Containerfile . + +.PHONY: copr-delete-builds +copr-delete-builds: copr-cfg-ensure-podman-secret copr-cli + @echo "Deleting the COPR builds" + sudo podman run \ + --rm \ + --secret ${COPR_SECRET_NAME} \ + "${COPR_CLI_IMAGE}" \ + bash -c "copr-cli --config /run/secrets/copr-cfg delete-build ${COPR_BUILDS}" + +.PHONY: copr-regenerate-repos +copr-regenerate-repos: copr-cfg-ensure-podman-secret copr-cli + @echo "Regenerating the COPR repository" + sudo podman run \ + --rm \ + --secret ${COPR_SECRET_NAME} \ + "${COPR_CLI_IMAGE}" \ + bash -c "copr-cli --config /run/secrets/copr-cfg regenerate-repos ${COPR_REPO_NAME}" + +.PHONY: copr-create-build +copr-create-build: copr-cfg-ensure-podman-secret copr-cli + @echo "Creating the COPR build" + sudo podman run \ + --rm \ + --secret ${COPR_SECRET_NAME} \ + --env COPR_REPO_NAME="${COPR_REPO_NAME}" \ + --volume "${SRPM_WORKDIR}:/srpms:Z" \ + --volume "./src/copr/create-build.sh:/create-build.sh:Z" \ + "${COPR_CLI_IMAGE}" \ + bash -c "bash -x /create-build.sh" + +.PHONY: copr-watch-build +copr-watch-build: copr-cli + @echo "Watching the COPR build" + sudo podman run \ + --rm \ + --secret ${COPR_SECRET_NAME} \ + --volume "${SRPM_WORKDIR}:/srpms:Z" \ + "${COPR_CLI_IMAGE}" \ + bash -c "copr-cli watch-build \$$(cat /srpms/build.txt)" diff --git a/src/copr/create-build.sh b/src/copr/create-build.sh new file mode 100644 index 00000000..116b26ba --- /dev/null +++ b/src/copr/create-build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -euo pipefail + +out="$(copr-cli --config /run/secrets/copr-cfg build --nowait "${COPR_REPO_NAME}" /srpms/microshift*.src.rpm)" +echo "${out}" +build=$(echo "${out}" | grep "Created builds" | cut -d: -f2 | xargs) +echo "${build}" > /srpms/build.txt From a3850db61777851449ad8e50b0122e77cf846a54 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Mon, 1 Dec 2025 18:09:53 +0100 Subject: [PATCH 03/12] Configurable FROM for the runner --- Makefile | 7 ++++--- packaging/microshift-runner.Containerfile | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4a2cab9f..bfc5fd91 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ else OKD_RELEASE_IMAGE ?= quay.io/okd/scos-release endif -BUILDER_IMAGE := microshift-okd-builder +BUILDER_IMAGE ?= microshift-okd-builder USHIFT_IMAGE := microshift-okd LVM_DISK := /var/lib/microshift-okd/lvmdisk.image VG_NAME := myvg1 @@ -106,8 +106,8 @@ rpm-to-deb: .PHONY: image image: - @if ! sudo podman image exists microshift-okd-builder ; then \ - echo "ERROR: Run 'make rpm' to build the MicroShift RPMs" ; \ + @if ! sudo podman image exists "${BUILDER_IMAGE}" ; then \ + echo "ERROR: Run 'make rpm' or 'make rpm-copr' to build the MicroShift RPMs" ; \ exit 1 ; \ fi @@ -119,6 +119,7 @@ image: --label okd.version="${OKD_VERSION_TAG}" \ --build-arg BOOTC_IMAGE_URL="${BOOTC_IMAGE_URL}" \ --build-arg BOOTC_IMAGE_TAG="${BOOTC_IMAGE_TAG}" \ + --build-arg RPM_BUILDER_IMAGE="${BUILDER_IMAGE}" \ --env WITH_KINDNET="${WITH_KINDNET}" \ --env WITH_TOPOLVM="${WITH_TOPOLVM}" \ --env WITH_OLM="${WITH_OLM}" \ diff --git a/packaging/microshift-runner.Containerfile b/packaging/microshift-runner.Containerfile index 3c16b991..4b2a709e 100644 --- a/packaging/microshift-runner.Containerfile +++ b/packaging/microshift-runner.Containerfile @@ -1,8 +1,9 @@ # Optionally allow for the base image override ARG BOOTC_IMAGE_URL=quay.io/centos-bootc/centos-bootc ARG BOOTC_IMAGE_TAG=stream9 +ARG RPM_BUILDER_IMAGE=microshift-okd-builder -FROM localhost/microshift-okd-builder:latest AS builder +FROM localhost/${RPM_BUILDER_IMAGE} AS builder FROM ${BOOTC_IMAGE_URL}:${BOOTC_IMAGE_TAG} ARG REPO_CONFIG_SCRIPT=/tmp/create_repos.sh From 58fc2ae49158e4a767889fcd42d4581753c73564 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Wed, 3 Dec 2025 13:26:58 +0100 Subject: [PATCH 04/12] Multi arch SRPM --- Makefile | 11 +++++++---- packaging/srpm.Containerfile | 10 ++++++---- src/image/prebuild.sh | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index bfc5fd91..ec707842 100644 --- a/Makefile +++ b/Makefile @@ -22,10 +22,12 @@ ISOLATED_NETWORK ?= 0 SHELL := /bin/bash ARCH := $(shell uname -m) # Override the default OKD_RELEASE_IMAGE variable based on the architecture +OKD_RELEASE_IMAGE_X86_64 ?= quay.io/okd/scos-release +OKD_RELEASE_IMAGE_AARCH64 ?= ghcr.io/microshift-io/okd/okd-release-arm64 ifeq ($(ARCH),aarch64) -OKD_RELEASE_IMAGE ?= ghcr.io/microshift-io/okd/okd-release-arm64 +OKD_RELEASE_IMAGE ?= $(OKD_RELEASE_IMAGE_AARCH64) else -OKD_RELEASE_IMAGE ?= quay.io/okd/scos-release +OKD_RELEASE_IMAGE ?= $(OKD_RELEASE_IMAGE_X86_64) endif BUILDER_IMAGE ?= microshift-okd-builder @@ -84,11 +86,12 @@ rpm: srpm: @echo "Building the MicroShift SRPM image" outdir="$${SRPM_WORKDIR:-$$(mktemp -d /tmp/microshift-srpms-XXXXXX)}" && \ - podman build \ + sudo podman build \ -t "${SRPM_IMAGE}" \ --build-arg USHIFT_GITREF="${USHIFT_GITREF}" \ --build-arg OKD_VERSION_TAG="${OKD_VERSION_TAG}" \ - --build-arg OKD_RELEASE_IMAGE="${OKD_RELEASE_IMAGE}" \ + --build-arg OKD_RELEASE_IMAGE_X86_64="${OKD_RELEASE_IMAGE_X86_64}" \ + --build-arg OKD_RELEASE_IMAGE_AARCH64="${OKD_RELEASE_IMAGE_AARCH64}" \ --volume "$${outdir}:/output:Z" \ -f packaging/srpm.Containerfile . && \ echo "SRPMs are available in '$${outdir}'" diff --git a/packaging/srpm.Containerfile b/packaging/srpm.Containerfile index 1fd6e0ab..4f5197ae 100644 --- a/packaging/srpm.Containerfile +++ b/packaging/srpm.Containerfile @@ -14,7 +14,8 @@ ENV OKD_VERSION_TAG=${OKD_VERSION_TAG} ENV USHIFT_GITREF=${USHIFT_GITREF} # Internal variables -ARG OKD_REPO=quay.io/okd/scos-release +ARG OKD_RELEASE_IMAGE_X86_64=quay.io/okd/scos-release +ARG OKD_RELEASE_IMAGE_AARCH64=ghcr.io/microshift-io/okd/okd-release-arm64 ARG USHIFT_GIT_URL=https://github.com/openshift/microshift.git ENV HOME=/home/microshift ARG BUILDER_RPM_REPO_PATH=${HOME}/microshift/_output/rpmbuild/RPMS @@ -45,11 +46,11 @@ RUN git clone --branch "${USHIFT_GITREF}" --single-branch "${USHIFT_GIT_URL}" "$ # Replace component images with OKD image references COPY --chmod=755 ./src/image/prebuild.sh ${USHIFT_PREBUILD_SCRIPT} -RUN "${USHIFT_PREBUILD_SCRIPT}" --replace "${OKD_REPO}" "${OKD_VERSION_TAG}" +RUN ARCH="x86_64" "${USHIFT_PREBUILD_SCRIPT}" --replace "${OKD_RELEASE_IMAGE_X86_64}" "${OKD_VERSION_TAG}" +RUN ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace "${OKD_RELEASE_IMAGE_AARCH64}" "${OKD_VERSION_TAG}" WORKDIR ${HOME}/microshift/ - COPY ./src/kindnet/kindnet.spec /tmp/kindnet.spec COPY ./src/kindnet/assets/ ./assets/optional/ COPY ./src/kindnet/dropins/ ./packaging/kindnet/ @@ -61,7 +62,8 @@ COPY ./src/topolvm/dropins/ ./packaging/microshift/dropins/ COPY ./src/topolvm/greenboot/ ./packaging/greenboot/ COPY ./src/topolvm/release/ ./assets/optional/topolvm/ -RUN "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_REPO}" "${OKD_VERSION_TAG}" +RUN ARCH="x86_64" "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_RELEASE_IMAGE_X86_64}" "${OKD_VERSION_TAG}" +RUN ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_RELEASE_IMAGE_AARCH64}" "${OKD_VERSION_TAG}" COPY --chmod=755 ./src/image/modify-spec.py ${USHIFT_MODIFY_SPEC_SCRIPT} RUN python3 ${USHIFT_MODIFY_SPEC_SCRIPT} /tmp/kindnet.spec /tmp/topolvm.spec diff --git a/src/image/prebuild.sh b/src/image/prebuild.sh index 70b43cb5..e5e03b34 100755 --- a/src/image/prebuild.sh +++ b/src/image/prebuild.sh @@ -2,7 +2,7 @@ set -euo pipefail MICROSHIFT_ROOT="/home/microshift/microshift" -ARCH="$(uname -m)" +ARCH="${ARCH:-$(uname -m)}" declare -A UNAME_TO_GOARCH_MAP=( ["x86_64"]="amd64" ["aarch64"]="arm64" ) oc_release_info() { From 5bb2d8997852218da446ba55296a6367d469a1d4 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Wed, 3 Dec 2025 13:27:26 +0100 Subject: [PATCH 05/12] Update release workflow to build using COPR --- .github/actions/build/action.yaml | 13 ++- .github/actions/prebuild/action.yaml | 2 +- .github/workflows/release.yaml | 157 ++++++++++++++++++--------- 3 files changed, 114 insertions(+), 58 deletions(-) diff --git a/.github/actions/build/action.yaml b/.github/actions/build/action.yaml index bc113db5..1605d8aa 100644 --- a/.github/actions/build/action.yaml +++ b/.github/actions/build/action.yaml @@ -19,18 +19,22 @@ inputs: isolated-network: description: Build and test the isolated network container image required: false - default: 0 + default: "0" ovnk-networking: description: Use OVN-K networking required: false - default: 0 + default: "0" node-count: description: Number of nodes in the MicroShift cluster required: false - default: 1 + default: "1" build: description: Types of artifacts to build (all, rpms, bootc-image) required: true + rpm-builder: + description: RPM builder image to use + required: false + default: microshift-okd-builder runs: using: "composite" @@ -40,9 +44,11 @@ runs: uses: ./.github/actions/debug-info - name: Prepare the build and run environment + if: inputs.rpm-builder == 'microshift-okd-builder' uses: ./.github/actions/prebuild - name: Build MicroShift RPMs + if: inputs.rpm-builder == 'microshift-okd-builder' shell: bash run: | # See https://github.com/microshift-io/microshift/blob/main/docs/build.md @@ -73,6 +79,7 @@ runs: make image \ BOOTC_IMAGE_URL="${{ inputs.bootc-image-url }}" \ BOOTC_IMAGE_TAG="${{ inputs.bootc-image-tag }}" \ + BUILDER_IMAGE=${{ inputs.rpm-builder }} \ ${make_opts[@]} - name: Run a test to verify that MicroShift is functioning properly diff --git a/.github/actions/prebuild/action.yaml b/.github/actions/prebuild/action.yaml index a621ff22..25f4abf5 100644 --- a/.github/actions/prebuild/action.yaml +++ b/.github/actions/prebuild/action.yaml @@ -28,7 +28,7 @@ runs: sudo rm -rvf /mnt/* || true # Create the necessary directories on the /mnt partition - sudo mkdir -p /mnt/tmp /mnt/rpms /mnt/release + sudo mkdir -p /mnt/tmp /mnt/rpms /mnt/release /mnt/srpm sudo chmod 1777 /mnt/tmp # Install the pre-requisites for the build and run environment diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 87bf55da..85785958 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -15,46 +15,114 @@ on: default: "latest" description: OKD version tag from https://quay.io/repository/okd/scos-release?tab=tags type: string - build: - type: choice - description: Types of artifacts to build - default: all - options: - - all - - packages - - bootc-image + copr-repo: + default: "@microshift-io/microshift" + description: COPR repository name + type: string jobs: - build-microshift: + build-rpms: + runs-on: ubuntu-24.04 + steps: + - name: Check out MicroShift upstream repository + uses: actions/checkout@v4 + + - name: Prepare the build and run environment + uses: ./.github/actions/prebuild + + - name: Detect OKD version tag + id: detect-okd-version + uses: ./.github/actions/okd-version + + - name: Build SRPM + shell: bash + run: | + cd ${GITHUB_WORKSPACE}/ + make srpm \ + USHIFT_GITREF=${{ inputs.ushift-gitref }} \ + OKD_VERSION_TAG=${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }} \ + SRPM_WORKDIR=/mnt/srpm + + - name: Create COPR build + shell: bash + env: + COPR_CONFIG: | + ${{ secrets.COPR_CONFIG }} + run: | + set -euo pipefail + cd ${GITHUB_WORKSPACE}/ + echo "${COPR_CONFIG}" > /tmp/copr-config + + make copr-create-build \ + SRPM_WORKDIR=/mnt/srpm \ + COPR_REPO_NAME="${{ inputs.copr-repo }}" \ + COPR_CONFIG=/tmp/copr-config + + make copr-watch-build \ + SRPM_WORKDIR=/mnt/srpm \ + COPR_REPO_NAME="${{ inputs.copr-repo }}" + + - name: Persist version and build ID + uses: actions/upload-artifact@v4 + with: + name: srpm-artifacts + path: | + /mnt/srpm/version.txt + /mnt/srpm/build.txt + overwrite: true + + + build-and-test-microshift: + needs: build-rpms strategy: matrix: runners: [ubuntu-24.04, ubuntu-24.04-arm] - name: Build MicroShift upstream + name: Build RPM images based on COPR build runs-on: ${{ matrix.runners }} steps: - name: Check out MicroShift upstream repository uses: actions/checkout@v4 + - name: Prepare the build and run environment + uses: ./.github/actions/prebuild + + - uses: actions/download-artifact@v5 + with: + name: srpm-artifacts + path: /tmp/srpm + + - name: Store version + shell: bash + id: version + run: | + set -euo pipefail + test -f /tmp/srpm/version.txt + echo "version=$(cat /tmp/srpm/version.txt)" >> "${GITHUB_OUTPUT}" + - name: Detect the CPU architecture id: detect-cpu-arch uses: ./.github/actions/arch - - name: Detect OKD version tag - id: detect-okd-version - uses: ./.github/actions/okd-version + - name: Create RPMs image with RPMs from COPR + shell: bash + run: | + set -euo pipefail + cd ${GITHUB_WORKSPACE}/ + + make rpm-copr \ + SRPM_WORKDIR=/tmp/srpm \ + RPM_OUTDIR=/mnt/rpms - name: Run the build action uses: ./.github/actions/build with: - ushift-gitref: ${{ inputs.ushift-gitref }} - okd-version-tag: ${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }} - build: ${{ inputs.build }} + rpm-builder: rpm-copr-builder + build: bootc-image # Test the local container image with the quick start and clean procedures # before releasing the artifacts. Make sure not to run the clean scripts # because the images are needed for the release process. - name: Run the quick start script and clean scripts - if: contains(fromJSON('["all", "bootc-image"]'), inputs.build) uses: ./.github/actions/quick-start-clean with: image-ref: localhost/microshift-okd:latest @@ -62,38 +130,14 @@ jobs: # Prepare the RPM archives to be released before converting to DEB packages. - name: Prepare the RPM archives - if: contains(fromJSON('["all", "packages"]'), inputs.build) shell: bash run : | - # Archive sources separately from the RPMs - sudo mv /mnt/rpms/srpms /mnt/srpms - cd /mnt/srpms - sudo tar zcvf /mnt/release/microshift-src.tgz . - cd /mnt/rpms sudo tar zcvf /mnt/release/microshift-rpms-$(uname -m).tgz . - - name: Store version in a variable - id: version - run: | - set -euo pipefail - if [ ! -f /mnt/rpms/version.txt ]; then - echo "ERROR: version.txt not found at /mnt/rpms/version.txt" - exit 1 - fi - echo "version=$(cat /mnt/rpms/version.txt)" >> "${GITHUB_OUTPUT}" - - - name: Push version.txt to artifacts - uses: actions/upload-artifact@v4 - with: - name: version.txt - path: /mnt/rpms/version.txt - overwrite: true - # This step is run after the RPM archives are prepared to avoid # including DEB packages in the RPM archive. - name: Convert the RPMs to DEB packages - if: contains(fromJSON('["all", "packages"]'), inputs.build) uses: ./.github/actions/build-deb with: ushift-gitref: ${{ inputs.ushift-gitref }} @@ -101,31 +145,25 @@ jobs: build-rpms: false - name: Prepare the DEB archives - if: contains(fromJSON('["all", "packages"]'), inputs.build) shell: bash run: | cd /mnt/rpms/deb sudo tar zcvf /mnt/release/microshift-debs-$(uname -m).tgz . - name: Release RPM and DEB packages - if: contains(fromJSON('["all", "packages"]'), inputs.build) uses: softprops/action-gh-release@v2 with: tag_name: ${{ steps.version.outputs.version }} files: | - /mnt/release/microshift-rpms-*.tgz /mnt/release/microshift-debs-*.tgz - /mnt/release/microshift-src.tgz overwrite_files: true - name: Login to GitHub Container Registry - if: contains(fromJSON('["all", "bootc-image"]'), inputs.build) uses: ./.github/actions/podman-login with: token: ${{ secrets.GITHUB_TOKEN }} - name: Publish Bootc container image for the target architecture - if: contains(fromJSON('["all", "bootc-image"]'), inputs.build) shell: bash run: | set -euo pipefail @@ -137,8 +175,9 @@ jobs: sudo podman tag microshift-okd "${TARGET_IMAGE}:${TARGET_TAG}" sudo podman push "${TARGET_IMAGE}:${TARGET_TAG}" + release-microshift: - needs: build-microshift + needs: build-and-test-microshift runs-on: ubuntu-24.04 steps: - name: Check out MicroShift upstream repository @@ -146,22 +185,22 @@ jobs: - uses: actions/download-artifact@v4 with: - name: version.txt - path: /tmp/ + name: srpm-artifacts + path: /tmp/srpm - name: Store version in a variable id: version run: | - echo "version=$(cat /tmp/version.txt)" >> "${GITHUB_OUTPUT}" + set -euo pipefail + test -f /tmp/srpm/version.txt + echo "version=$(cat /tmp/srpm/version.txt)" >> "${GITHUB_OUTPUT}" - name: Login to GitHub Container Registry - if: contains(fromJSON('["all", "bootc-image"]'), inputs.build) uses: ./.github/actions/podman-login with: token: ${{ secrets.GITHUB_TOKEN }} - name: Publish Bootc container image manifest - if: contains(fromJSON('["all", "bootc-image"]'), inputs.build) shell: bash run: | set -euo pipefail @@ -180,8 +219,18 @@ jobs: OWNER="${{ github.repository_owner }}" IMAGE="${TARGET_IMAGE}" TAG="${TARGET_TAG}" \ envsubst < .github/workflows/release.md > /tmp/release.md + - name: COPR - Regenerate RPM repo + shell: bash + env: + COPR_CONFIG: | + ${{ secrets.COPR_CONFIG }} + run : | + echo "${COPR_CONFIG}" > /tmp/copr-config + make copr-regenerate-repos \ + COPR_CONFIG=/tmp/copr-config \ + COPR_REPO_NAME="${{ inputs.copr-repo }}" + - name: Add release note for bootc image usage - if: contains(fromJSON('["all", "bootc-image"]'), inputs.build) uses: softprops/action-gh-release@v2 with: tag_name: ${{ steps.version.outputs.version }} From 98c775ea163a152399c024d8204c0a28f0ff73ed Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Wed, 3 Dec 2025 13:40:41 +0100 Subject: [PATCH 06/12] Update quickrpm.sh --- src/quickrpm.sh | 24 +++++++++++++++--------- src/rpm/create_repos.sh | 28 +++++++++++++++++++--------- 2 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/quickrpm.sh b/src/quickrpm.sh index 3128b612..b2264488 100755 --- a/src/quickrpm.sh +++ b/src/quickrpm.sh @@ -5,6 +5,7 @@ OWNER=${OWNER:-microshift-io} REPO=${REPO:-microshift} BRANCH=${BRANCH:-main} TAG=${TAG:-latest} +COPR=${COPR:-"@${OWNER}/${REPO}"} LVM_DISK="/var/lib/microshift-okd/lvmdisk.image" VG_NAME="myvg1" @@ -58,11 +59,7 @@ function centos10_cni_plugins() { } function install_rpms() { - # Download the RPMs from the release - mkdir -p "${WORKDIR}/rpms" - curl -L -s --retry 5 \ - "https://github.com/${OWNER}/${REPO}/releases/download/${TAG}/microshift-rpms-$(uname -m).tgz" | \ - tar zxf - -C "${WORKDIR}/rpms" + dnf copr enable -y "${COPR}" # Download the installation scripts for script in create_repos.sh postinstall.sh ; do @@ -72,13 +69,22 @@ function install_rpms() { chmod +x "${WORKDIR}/${script}" done + # Transform: + # "@microshift-io/microshift" -> "copr:copr.fedorainfracloud.org:group_microshift-io:microshift" + # "USER/PROJECT" -> "copr:copr.fedorainfracloud.org:USER:PROJECT" + local -r repo_name="copr:copr.fedorainfracloud.org:$(echo "${COPR}" | sed -e 's,/,:,g' -e 's,@,group_,g')" + + local -r minor_version="$(dnf --quiet \ + --disablerepo='*' --enablerepo="${repo_name}" \ + repoquery microshift \ + --latest-limit 1 \ + --queryformat '%{version}-%{release}' | cut -d. -f1,2)" + # 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. + "${WORKDIR}/create_repos.sh" -deps-only "${minor_version}" + dnf install -y --setopt=install_weak_deps=False \ microshift microshift-kindnet microshift-topolvm - "${WORKDIR}/create_repos.sh" -delete } function prepare_lvm_disk() { diff --git a/src/rpm/create_repos.sh b/src/rpm/create_repos.sh index ac5f183c..0c8c4c03 100755 --- a/src/rpm/create_repos.sh +++ b/src/rpm/create_repos.sh @@ -5,10 +5,22 @@ 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 ] | [-deps-only ] | [-delete]" exit 1 } +function create_deps_repo() { + local -r repo_version=$1 + cat > "${OCP_MIRROR_REPO_FILE}" < "${OCP_MIRROR_REPO_FILE}" < Date: Wed, 3 Dec 2025 16:28:47 +0100 Subject: [PATCH 07/12] Remove OWNER from release.md --- .github/workflows/release.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.md b/.github/workflows/release.md index ad71fa63..02a540e0 100644 --- a/.github/workflows/release.md +++ b/.github/workflows/release.md @@ -8,14 +8,14 @@ MicroShift can be run on the host or inside a Bootc container. ```bash curl -s https://microshift-io.github.io/microshift/quickrpm.sh | \ - sudo OWNER=${OWNER} TAG=${TAG} bash + sudo TAG=${TAG} bash ``` * Bootstrap MicroShift inside a Bootc container on your host. ```bash curl -s https://microshift-io.github.io/microshift/quickstart.sh | \ - sudo OWNER=${OWNER} TAG=${TAG} bash + sudo TAG=${TAG} bash ``` #### RPM and DEB From cccca872a8c4419249a3774e9cf6807505e40d6f Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Wed, 3 Dec 2025 16:32:33 +0100 Subject: [PATCH 08/12] Update docs --- docs/run.md | 80 +++++++++++++++++++++++------------------------ docs/workflows.md | 14 ++++----- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/docs/run.md b/docs/run.md index bbe597a5..31dccc49 100644 --- a/docs/run.md +++ b/docs/run.md @@ -6,21 +6,7 @@ This document describes how to run MicroShift on the host. See [MicroShift Bootc Deployment](./run-bootc.md) on how to run MicroShift inside a Bootc container. -## MicroShift RPM Packages - -### Install RPM - -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). - -```bash -RPM_REPO_DIR=/tmp/microshift-rpms - -sudo ./src/rpm/create_repos.sh -create "${RPM_REPO_DIR}" -sudo dnf install -y microshift microshift-kindnet -sudo ./src/rpm/create_repos.sh -delete -``` +## MicroShift - optional packages The following optional RPM packages are available in the repository. It is mandatory to install either `microshift-kindnet` or `microshift-networking` @@ -33,51 +19,65 @@ to enable the Kindnet or OVN-K networking support. | microshift-topolvm | TopoLVM CSI | Install to enable storage support | | microshift-olm | Operator Lifecycle Manager | See [Operator Hub Catalogs](https://okd.io/docs/operators/) | -### Start MicroShift Service +## Package based systems (non-bootc) -Run the following commands to configure the minimum required firewall rules, -disable LVMS, and start the MicroShift service. +### Installing MicroShift + +#### Local RPMs + +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). ```bash -sudo ./src/rpm/postinstall.sh -sudo systemctl start microshift.service +RPM_REPO_DIR=/tmp/microshift-rpms + +sudo ./src/rpm/create_repos.sh -create "${RPM_REPO_DIR}" +sudo dnf install -y microshift microshift-kindnet +sudo ./src/rpm/create_repos.sh -delete ``` -Verify that all the MicroShift pods are up and running successfully. +#### RPMs from COPR -```bash -mkdir -p ~/.kube -sudo cat /var/lib/microshift/resources/kubeadmin/kubeconfig > ~/.kube/config +Run following command to enable COPR repository: +```sh +sudo dnf copr enable @microshift-io/microshift +``` -oc get pods -A +Optionally specify chroot like `epel-9-{x86_64,aarch64}`, `fedora-42-{x86_64,aarch64}`, for example: +```sh +sudo dnf copr enable @microshift-io/microshift epel-9-x86_64 +sudo dnf copr enable @microshift-io/microshift epel-9-aarch64 +sudo dnf copr enable @microshift-io/microshift fedora-42-x86_64 +sudo dnf copr enable @microshift-io/microshift fedora-42-aarch64 ``` -## MicroShift DEB Packages +Next, install MicroShift: +```sh +sudo dnf install -y microshift microshift-kindnet +``` -### Install DEB +#### Local DEB (Ubuntu) -Run the following commands to install MicroShift DEB packages from the RPM repository. -This repository should be either [built locally](../docs/build.md#create-deb-packages) -or downloaded from [Releases](https://github.com/microshift-io/microshift/releases). +Run the following command to install MicroShift DEB packages from the local +repository copied from the build container image. +See [Create DEB Packages](../docs/build.md#create-deb-packages) for more information. ```bash DEB_REPO_DIR=/tmp/microshift-rpms/deb sudo ./src/deb/install.sh "${DEB_REPO_DIR}" ``` -The following optional DEB packages are available in the repository. - -| Package | Description | Comments | -|--------------------|----------------------------|----------| -| microshift-topolvm | TopoLVM CSI | Install to enable storage support | -| microshift-olm | Operator Lifecycle Manager | See [Operator Hub Catalogs](https://okd.io/docs/operators/) | +### Start MicroShift Service -> Note: All of the optional packages are installed by default. +On RPM-based systems, run the following commands to configure the minimum +required firewall rules, disable LVMS, and enable the MicroShift service. +Skip this command on Ubuntu. -### Start MicroShift Service +```bash +sudo ./src/rpm/postinstall.sh +``` -Run the following command to start the MicroShift service. All the necessary system -configuration was performed during the installation step. +Run the following command to start the MicroShift service. ```bash sudo systemctl start microshift.service diff --git a/docs/workflows.md b/docs/workflows.md index a1011ecc..d93d85fa 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -51,8 +51,9 @@ Run [ShellCheck](https://github.com/koalaman/shellcheck) on all shell scripts an #### MicroShift -The workflow implements a build process producing MicroShift RPM packages, DEB -packages and Bootc container image artifacts. It is executed manually by the +The workflow implements a build process producing MicroShift SRPM package, +MicroShift RPM packages using COPR build service, DEB packages +and Bootc container image artifacts. It is executed manually by the repository maintainers - no scheduled runs are configured at this time. The following parameters determine the MicroShift source code branch and the OKD @@ -60,11 +61,6 @@ container image dependencies used during the build process. * [MicroShift (OpenShift) branch](https://github.com/openshift/microshift/branches) * [OKD version tag](https://quay.io/repository/okd/scos-release?tab=tags) -The following actions are supported: -* `packages`: Build MicroShift RPM and DEB packages -* `bootc-image`: Build a MicroShift Bootc container image -* `all`: Build all of the above - > Note: After the Bootc container image is built, a workflow step checks it by > attempting to run the container image and verifying that all the MicroShift > services are functional. @@ -75,6 +71,10 @@ instructions are available at [Releases](https://github.com/microshift-io/micros > Note: The available container images can be listed at [Packages](https://github.com/microshift-io/microshift/packages) > and pulled from the `ghcr.io/microshift-io` registry. +> Note: The available RPM packages can be listed on +> [COPR @microshift-io/microshift](https://copr.fedorainfracloud.org/coprs/g/microshift-io/microshift/) +> and installed using DNF. + #### OKD on ARM The workflow implements a build process producing a subset of OKD container image From 05662c0f8a6da07454296b54d7e663052a9d7e0e Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Wed, 3 Dec 2025 18:19:30 +0100 Subject: [PATCH 09/12] Hadolint fixes --- packaging/microshift-runner.Containerfile | 2 +- packaging/rpms-copr.Containerfile | 3 +++ packaging/srpm.Containerfile | 17 ++++++++--------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packaging/microshift-runner.Containerfile b/packaging/microshift-runner.Containerfile index 4b2a709e..c509db7f 100644 --- a/packaging/microshift-runner.Containerfile +++ b/packaging/microshift-runner.Containerfile @@ -3,7 +3,7 @@ ARG BOOTC_IMAGE_URL=quay.io/centos-bootc/centos-bootc ARG BOOTC_IMAGE_TAG=stream9 ARG RPM_BUILDER_IMAGE=microshift-okd-builder -FROM localhost/${RPM_BUILDER_IMAGE} AS builder +FROM localhost/${RPM_BUILDER_IMAGE}:latest AS builder FROM ${BOOTC_IMAGE_URL}:${BOOTC_IMAGE_TAG} ARG REPO_CONFIG_SCRIPT=/tmp/create_repos.sh diff --git a/packaging/rpms-copr.Containerfile b/packaging/rpms-copr.Containerfile index 84cc38c9..9e97fa99 100644 --- a/packaging/rpms-copr.Containerfile +++ b/packaging/rpms-copr.Containerfile @@ -8,6 +8,9 @@ RUN dnf install -y \ ARG COPR_BUILD_ID= ARG BUILDER_RPM_REPO_PATH=/home/microshift/microshift/_output/rpmbuild/RPMS +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# hadolint ignore=DL3003 RUN \ copr download-build --rpms --chroot "epel-9-$(uname -m)" --dest /tmp/rpms ${COPR_BUILD_ID} && \ mkdir -p /home/microshift/microshift && \ diff --git a/packaging/srpm.Containerfile b/packaging/srpm.Containerfile index 4f5197ae..ff25425a 100644 --- a/packaging/srpm.Containerfile +++ b/packaging/srpm.Containerfile @@ -46,8 +46,8 @@ RUN git clone --branch "${USHIFT_GITREF}" --single-branch "${USHIFT_GIT_URL}" "$ # Replace component images with OKD image references COPY --chmod=755 ./src/image/prebuild.sh ${USHIFT_PREBUILD_SCRIPT} -RUN ARCH="x86_64" "${USHIFT_PREBUILD_SCRIPT}" --replace "${OKD_RELEASE_IMAGE_X86_64}" "${OKD_VERSION_TAG}" -RUN ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace "${OKD_RELEASE_IMAGE_AARCH64}" "${OKD_VERSION_TAG}" +RUN ARCH="x86_64" "${USHIFT_PREBUILD_SCRIPT}" --replace "${OKD_RELEASE_IMAGE_X86_64}" "${OKD_VERSION_TAG}" && \ + ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace "${OKD_RELEASE_IMAGE_AARCH64}" "${OKD_VERSION_TAG}" WORKDIR ${HOME}/microshift/ @@ -62,17 +62,16 @@ COPY ./src/topolvm/dropins/ ./packaging/microshift/dropins/ COPY ./src/topolvm/greenboot/ ./packaging/greenboot/ COPY ./src/topolvm/release/ ./assets/optional/topolvm/ -RUN ARCH="x86_64" "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_RELEASE_IMAGE_X86_64}" "${OKD_VERSION_TAG}" -RUN ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_RELEASE_IMAGE_AARCH64}" "${OKD_VERSION_TAG}" +RUN ARCH="x86_64" "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_RELEASE_IMAGE_X86_64}" "${OKD_VERSION_TAG}" && \ + ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_RELEASE_IMAGE_AARCH64}" "${OKD_VERSION_TAG}" COPY --chmod=755 ./src/image/modify-spec.py ${USHIFT_MODIFY_SPEC_SCRIPT} -RUN python3 ${USHIFT_MODIFY_SPEC_SCRIPT} /tmp/kindnet.spec /tmp/topolvm.spec # Disable the RPM and SRPM checks in the make-rpm.sh script # and modify the microshift.spec to remove packages not yet supported by the upstream -RUN sed -i -e 's,CHECK_RPMS="y",,g' -e 's,CHECK_SRPMS="y",,g' ./packaging/rpm/make-rpm.sh +RUN python3 ${USHIFT_MODIFY_SPEC_SCRIPT} /tmp/kindnet.spec /tmp/topolvm.spec && \ + sed -i -e 's,CHECK_RPMS="y",,g' -e 's,CHECK_SRPMS="y",,g' ./packaging/rpm/make-rpm.sh COPY --chmod=755 ./src/image/build-rpms.sh ${USHIFT_BUILDRPMS_SCRIPT} -RUN "${USHIFT_BUILDRPMS_SCRIPT}" srpm - -RUN cp ./_output/rpmbuild/SRPMS/* /output/ +RUN "${USHIFT_BUILDRPMS_SCRIPT}" srpm && \ + cp ./_output/rpmbuild/SRPMS/* /output/ From 729b76757577c951a12c7a8d1f2d605257ea221d Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Thu, 4 Dec 2025 10:12:02 +0100 Subject: [PATCH 10/12] rabbit review fixes --- .github/workflows/release.yaml | 6 ++++-- docs/run.md | 6 +++--- packaging/srpm.Containerfile | 1 - src/copr/copr.mk | 3 +-- src/copr/create-build.sh | 4 ++++ src/quickrpm.sh | 5 +++++ src/rpm/create_repos.sh | 4 ++++ 7 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 85785958..04de4e09 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -116,6 +116,8 @@ jobs: - name: Run the build action uses: ./.github/actions/build with: + ushift-gitref: not-required + okd-version-tag: not-required rpm-builder: rpm-copr-builder build: bootc-image @@ -140,8 +142,8 @@ jobs: - name: Convert the RPMs to DEB packages uses: ./.github/actions/build-deb with: - ushift-gitref: ${{ inputs.ushift-gitref }} - okd-version-tag: ${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }} + ushift-gitref: not-required + okd-version-tag: not-required build-rpms: false - name: Prepare the DEB archives diff --git a/docs/run.md b/docs/run.md index 31dccc49..5710a5b7 100644 --- a/docs/run.md +++ b/docs/run.md @@ -19,14 +19,14 @@ to enable the Kindnet or OVN-K networking support. | microshift-topolvm | TopoLVM CSI | Install to enable storage support | | microshift-olm | Operator Lifecycle Manager | See [Operator Hub Catalogs](https://okd.io/docs/operators/) | -## Package based systems (non-bootc) +## Package-based systems (non-bootc) ### Installing MicroShift #### Local RPMs 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). +This repository should be [built locally](./build.md#create-rpm-packages). ```bash RPM_REPO_DIR=/tmp/microshift-rpms @@ -60,7 +60,7 @@ sudo dnf install -y microshift microshift-kindnet Run the following command to install MicroShift DEB packages from the local repository copied from the build container image. -See [Create DEB Packages](../docs/build.md#create-deb-packages) for more information. +See [Create DEB Packages](./build.md#create-deb-packages) for more information. ```bash DEB_REPO_DIR=/tmp/microshift-rpms/deb diff --git a/packaging/srpm.Containerfile b/packaging/srpm.Containerfile index ff25425a..74b18d56 100644 --- a/packaging/srpm.Containerfile +++ b/packaging/srpm.Containerfile @@ -23,7 +23,6 @@ ARG USHIFT_PREBUILD_SCRIPT=/tmp/prebuild.sh ARG USHIFT_POSTBUILD_SCRIPT=/tmp/postbuild.sh ARG USHIFT_BUILDRPMS_SCRIPT=/tmp/build-rpms.sh ARG USHIFT_MODIFY_SPEC_SCRIPT=/tmp/modify-spec.py -ARG USHIFT_BUILDRPMS_SCRIPT=/tmp/build-rpms.sh # Verify mandatory build arguments RUN if [ -z "${OKD_VERSION_TAG}" ]; then \ diff --git a/src/copr/copr.mk b/src/copr/copr.mk index 1b5c7d5f..f8b29e77 100644 --- a/src/copr/copr.mk +++ b/src/copr/copr.mk @@ -29,7 +29,7 @@ copr-cfg-ensure-podman-secret: @echo "Ensuring the COPR secret is available and is up to date" if sudo podman secret exists "${COPR_SECRET_NAME}"; then \ sudo podman secret rm "${COPR_SECRET_NAME}" ; \ - fi && \ + fi ; \ sudo podman secret create "${COPR_SECRET_NAME}" "${COPR_CONFIG}" .PHONY: copr-cli @@ -74,7 +74,6 @@ copr-watch-build: copr-cli @echo "Watching the COPR build" sudo podman run \ --rm \ - --secret ${COPR_SECRET_NAME} \ --volume "${SRPM_WORKDIR}:/srpms:Z" \ "${COPR_CLI_IMAGE}" \ bash -c "copr-cli watch-build \$$(cat /srpms/build.txt)" diff --git a/src/copr/create-build.sh b/src/copr/create-build.sh index 116b26ba..13f42807 100644 --- a/src/copr/create-build.sh +++ b/src/copr/create-build.sh @@ -4,4 +4,8 @@ set -euo pipefail out="$(copr-cli --config /run/secrets/copr-cfg build --nowait "${COPR_REPO_NAME}" /srpms/microshift*.src.rpm)" echo "${out}" build=$(echo "${out}" | grep "Created builds" | cut -d: -f2 | xargs) +if [[ -z "${build}" ]]; then + echo "ERROR: Failed to extract build ID from copr-cli output" + exit 1 +fi echo "${build}" > /srpms/build.txt diff --git a/src/quickrpm.sh b/src/quickrpm.sh index b2264488..f81fb220 100755 --- a/src/quickrpm.sh +++ b/src/quickrpm.sh @@ -80,6 +80,11 @@ function install_rpms() { --latest-limit 1 \ --queryformat '%{version}-%{release}' | cut -d. -f1,2)" + if [[ -z "${minor_version}" ]]; then + echo "ERROR: Could not determine MicroShift version from COPR repo '${COPR}' (${repo_name})" + exit 1 + fi + # Create the RPM repository and install the RPMs "${WORKDIR}/create_repos.sh" -deps-only "${minor_version}" diff --git a/src/rpm/create_repos.sh b/src/rpm/create_repos.sh index 0c8c4c03..af4524d3 100755 --- a/src/rpm/create_repos.sh +++ b/src/rpm/create_repos.sh @@ -72,6 +72,10 @@ case $1 in -deps-only) repo_version="$2" + if [ -z "${repo_version:-}" ] ; then + echo "ERROR: Missing argument" + usage + fi create_deps_repo "${repo_version}" ;; From 58a169fce3516bfed75a283be36e042e7e4b5bf5 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Thu, 4 Dec 2025 13:50:22 +0100 Subject: [PATCH 11/12] Make sure dnf copr plugin is present --- src/quickrpm.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/quickrpm.sh b/src/quickrpm.sh index f81fb220..5bbac8d0 100755 --- a/src/quickrpm.sh +++ b/src/quickrpm.sh @@ -59,6 +59,12 @@ function centos10_cni_plugins() { } function install_rpms() { + if command -v dnf5 &>/dev/null; then + # Make sure that 'dnf copr' plugin is installed + # (it's present in the fedora:42, but missing from the fedora-bootc:42). + dnf install -y 'dnf5-command(copr)' + fi + dnf copr enable -y "${COPR}" # Download the installation scripts From 14d0472e7677215455dc0a21e4729bbca512bc60 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Thu, 4 Dec 2025 14:50:45 +0100 Subject: [PATCH 12/12] Use branch under test files --- .github/actions/quick-rpm-clean/action.yaml | 6 +++++- src/quickrpm.sh | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/quick-rpm-clean/action.yaml b/.github/actions/quick-rpm-clean/action.yaml index 2e0ca6b9..200aeadf 100644 --- a/.github/actions/quick-rpm-clean/action.yaml +++ b/.github/actions/quick-rpm-clean/action.yaml @@ -62,8 +62,12 @@ runs: set -euo pipefail set -x + branch="$(jq -r '.pull_request.head.ref' "${GITHUB_EVENT_PATH}")" + repo="$(jq -r '.pull_request.head.repo.name' "${GITHUB_EVENT_PATH}")" + owner="$(jq -r '.pull_request.head.repo.owner.login' "${GITHUB_EVENT_PATH}")" + sudo podman exec -i microshift-okd \ - env TAG="${{ inputs.install-tag }}" \ + env OWNER="${owner}" REPO="${repo}" BRANCH="${branch}" TAG="${{ inputs.install-tag }}" \ bash -xeuo pipefail < ./src/quickrpm.sh # Restart the greenboot service synchronously to check the health of the system. diff --git a/src/quickrpm.sh b/src/quickrpm.sh index 5bbac8d0..4428659d 100755 --- a/src/quickrpm.sh +++ b/src/quickrpm.sh @@ -5,7 +5,7 @@ OWNER=${OWNER:-microshift-io} REPO=${REPO:-microshift} BRANCH=${BRANCH:-main} TAG=${TAG:-latest} -COPR=${COPR:-"@${OWNER}/${REPO}"} +COPR=${COPR:-"@microshift-io/microshift"} LVM_DISK="/var/lib/microshift-okd/lvmdisk.image" VG_NAME="myvg1"