Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
#
Expand All @@ -63,13 +60,19 @@ 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"
@echo " run-status: show the status of the MicroShift cluster"
@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"
Expand Down
28 changes: 21 additions & 7 deletions packaging/srpm.Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)"
Comment thread
ggiguash marked this conversation as resolved.

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}" && \
Expand All @@ -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/

Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/rpm/create_repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
;;

Expand Down
Loading