diff --git a/Makefile b/Makefile index 4bd8c091..7ce6950c 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ # ARCH := $(shell uname -m) -# Options used in the 'rpm' target +# Options used in the 'srpm' and 'rpm' targets USHIFT_GIT_URL ?= https://github.com/openshift/microshift.git USHIFT_GITREF ?= main ifeq ($(ARCH),aarch64) @@ -41,9 +41,6 @@ SRPM_IMAGE := microshift-okd-srpm LVM_DISK := /var/lib/microshift-okd/lvmdisk.image VG_NAME := myvg1 -PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) -include $(PROJECT_DIR)/src/copr/copr.mk - # # Define the main targets # @@ -63,6 +60,7 @@ all: @echo " env CMD=...: run a command in MicroShift kubeconfig environment" @echo "" @echo "Sub-targets:" + @echo " copr-help: show the help message for the COPR sub-targets" @echo " rpm-to-deb: convert the MicroShift RPMs to Debian packages" @echo " run-ready: wait until the MicroShift service is ready across the cluster" @echo " run-healthy: wait until the MicroShift service is healthy across the cluster" @@ -70,6 +68,11 @@ all: @echo " clean-all: perform a full cleanup, including the container images" @echo "" +# Additional targets must be included after the 'all' target to make sure proper +# help message is generated when running 'make' without any arguments. +PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(PROJECT_DIR)/src/copr/copr.mk + .PHONY: rpm rpm: srpm @echo "Building the MicroShift RPMs image" diff --git a/packaging/srpm.Containerfile b/packaging/srpm.Containerfile index 19e79268..56a43b3f 100644 --- a/packaging/srpm.Containerfile +++ b/packaging/srpm.Containerfile @@ -3,7 +3,7 @@ FROM quay.io/fedora/fedora:latest RUN dnf install -y \ --setopt=install_weak_deps=False \ - git rpm-build jq python3-pip python3-specfile && \ + git rpm-build jq python3-pip python3-specfile skopeo && \ dnf clean all # Variables controlling the source of MicroShift components to build @@ -17,6 +17,7 @@ ARG USHIFT_GIT_URL=https://github.com/openshift/microshift.git ENV HOME=/home/microshift ARG USHIFT_PREBUILD_SCRIPT=/tmp/prebuild.sh ARG USHIFT_BUILDRPMS_SCRIPT=/tmp/build-rpms.sh +ARG OKD_GET_VERSION_SCRIPT=/tmp/get_version.sh ARG USHIFT_MODIFY_SPEC_SCRIPT=/tmp/modify-spec.py ARG SPEC_KINDNET=/tmp/kindnet.spec ARG SPEC_TOPOLVM=/tmp/topolvm.spec @@ -28,6 +29,19 @@ RUN if [ -z "${OKD_VERSION_TAG}" ]; then \ exit 1; \ fi +# Resolve per-architecture OKD version tags +# OKD_VERSION_TAG is for the host arch; the cross-arch version is auto-detected +COPY --chmod=755 ./src/okd/get_version.sh ${OKD_GET_VERSION_SCRIPT} +RUN if [ "$(uname -m)" = "aarch64" ]; then \ + echo "${OKD_VERSION_TAG}" > /tmp/okd_version_aarch64 ; \ + "${OKD_GET_VERSION_SCRIPT}" latest-amd64 > /tmp/okd_version_x86_64 ; \ + else \ + echo "${OKD_VERSION_TAG}" > /tmp/okd_version_x86_64 ; \ + "${OKD_GET_VERSION_SCRIPT}" latest-arm64 > /tmp/okd_version_aarch64 ; \ + fi && \ + echo "OKD version x86_64: $(cat /tmp/okd_version_x86_64)" && \ + echo "OKD version aarch64: $(cat /tmp/okd_version_aarch64)" + RUN [ "$(uname -m)" = "aarch64" ] && ARCH="-arm64" || ARCH="" ; \ 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}" && \ @@ -41,8 +55,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}" && \ - 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}" "$(cat /tmp/okd_version_x86_64)" && \ + ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace "${OKD_RELEASE_IMAGE_AARCH64}" "$(cat /tmp/okd_version_aarch64)" WORKDIR ${HOME}/microshift/ @@ -57,10 +71,10 @@ 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}" && \ - ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_RELEASE_IMAGE_AARCH64}" "${OKD_VERSION_TAG}" && \ - ARCH="x86_64" "${USHIFT_PREBUILD_SCRIPT}" --replace-multus "${OKD_RELEASE_IMAGE_X86_64}" "${OKD_VERSION_TAG}" && \ - ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace-multus "${OKD_RELEASE_IMAGE_AARCH64}" "${OKD_VERSION_TAG}" +RUN ARCH="x86_64" "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_RELEASE_IMAGE_X86_64}" "$(cat /tmp/okd_version_x86_64)" && \ + ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace-kindnet "${OKD_RELEASE_IMAGE_AARCH64}" "$(cat /tmp/okd_version_aarch64)" && \ + ARCH="x86_64" "${USHIFT_PREBUILD_SCRIPT}" --replace-multus "${OKD_RELEASE_IMAGE_X86_64}" "$(cat /tmp/okd_version_x86_64)" && \ + ARCH="aarch64" "${USHIFT_PREBUILD_SCRIPT}" --replace-multus "${OKD_RELEASE_IMAGE_AARCH64}" "$(cat /tmp/okd_version_aarch64)" COPY --chmod=755 ./src/image/modify-spec.py ${USHIFT_MODIFY_SPEC_SCRIPT} # Disable the RPM and SRPM checks in the make-rpm.sh script diff --git a/src/rpm/create_repos.sh b/src/rpm/create_repos.sh index 83eea798..8da0bf01 100755 --- a/src/rpm/create_repos.sh +++ b/src/rpm/create_repos.sh @@ -68,6 +68,10 @@ case $1 in echo "ERROR: Could not determine the MicroShift version from the RPM repository at '${repo_path}'" exit 1 fi + # TODO: Remove this workaround once 5.0 mirror repositories are available + if [ "${repo_version}" = "5.0" ]; then + repo_version="4.22" + fi create_rhocp_repo "${repo_version}" ;;