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
6 changes: 4 additions & 2 deletions .github/actions/build-deb/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ runs:

# Run the RPM build process.
cd ${GITHUB_WORKSPACE}/
make rpm \
make srpm \
USHIFT_GITREF=${{ inputs.ushift-gitref }} \
OKD_VERSION_TAG=${{ inputs.okd-version-tag }} \
OKD_VERSION_TAG=${{ inputs.okd-version-tag }}

make rpm \
RPM_OUTDIR=/mnt/rpms

- name: Convert the MicroShift RPMs to Debian packages
Expand Down
6 changes: 4 additions & 2 deletions .github/actions/build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ runs:

# Run the RPM build process.
cd ${GITHUB_WORKSPACE}/
make rpm \
make srpm \
USHIFT_GITREF="${{ inputs.ushift-gitref }}" \
OKD_VERSION_TAG="${{ inputs.okd-version-tag }}" \
OKD_VERSION_TAG="${{ inputs.okd-version-tag }}"

make rpm \
RPM_OUTDIR=/mnt/rpms

- name: Build MicroShift bootc container image
Expand Down
28 changes: 16 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ else
OKD_VERSION_TAG ?= $$(./src/okd/get_version.sh latest-amd64)
endif
RPM_OUTDIR ?=
SRPM_WORKDIR ?=

# Options used in the 'image' target
BOOTC_IMAGE_URL ?= quay.io/centos-bootc/centos-bootc
Expand All @@ -37,7 +38,7 @@ else
OKD_RELEASE_IMAGE ?= $(OKD_RELEASE_IMAGE_X86_64)
endif

BUILDER_IMAGE := microshift-okd-builder
RPM_IMAGE := microshift-okd-rpm
USHIFT_IMAGE := microshift-okd
SRPM_IMAGE := microshift-okd-srpm
LVM_DISK := /var/lib/microshift-okd/lvmdisk.image
Expand Down Expand Up @@ -71,20 +72,22 @@ all:

.PHONY: rpm
rpm:
@echo "Building the MicroShift builder image"
@if ! sudo podman image exists "${SRPM_IMAGE}" ; then \
echo "ERROR: Run 'make srpm' to build the MicroShift SRPMs" ; \
exit 1 ; \
fi

@echo "Building the MicroShift RPMs image"
sudo podman build \
-t "${BUILDER_IMAGE}" \
-t "${RPM_IMAGE}" \
--ulimit nofile=524288:524288 \
--build-arg USHIFT_GITREF="${USHIFT_GITREF}" \
--build-arg OKD_VERSION_TAG="${OKD_VERSION_TAG}" \
--build-arg OKD_RELEASE_IMAGE="${OKD_RELEASE_IMAGE}" \
-f packaging/microshift-builder.Containerfile .
-f packaging/rpm.Containerfile .

@echo "Extracting the MicroShift RPMs"
outdir="$${RPM_OUTDIR:-$$(mktemp -d /tmp/microshift-rpms-XXXXXX)}" && \
mntdir="$$(sudo podman image mount "${BUILDER_IMAGE}")" && \
mntdir="$$(sudo podman image mount "${RPM_IMAGE}")" && \
sudo cp -r "$${mntdir}/home/microshift/microshift/_output/rpmbuild/RPMS/." "$${outdir}" && \
sudo podman image umount "${BUILDER_IMAGE}" && \
sudo podman image umount "${RPM_IMAGE}" && \
echo "" && \
echo "Build completed successfully" && \
echo "RPMs are available in '$${outdir}'"
Expand Down Expand Up @@ -116,7 +119,7 @@ rpm-to-deb:

.PHONY: image
image:
@if ! sudo podman image exists microshift-okd-builder ; then \
@if ! sudo podman image exists "${RPM_IMAGE}" ; then \
echo "ERROR: Run 'make rpm' to build the MicroShift RPMs" ; \
exit 1 ; \
fi
Expand All @@ -133,7 +136,7 @@ image:
--env WITH_TOPOLVM="${WITH_TOPOLVM}" \
--env WITH_OLM="${WITH_OLM}" \
--env EMBED_CONTAINER_IMAGES="${EMBED_CONTAINER_IMAGES}" \
-f packaging/microshift-runner.Containerfile .
-f packaging/bootc.Containerfile .

.PHONY: run
run:
Expand Down Expand Up @@ -190,7 +193,8 @@ clean-all:
@echo "Performing a full cleanup"
$(MAKE) clean
sudo podman rmi -f "${USHIFT_IMAGE}" || true
sudo podman rmi -f "${BUILDER_IMAGE}" || true
sudo podman rmi -f "${RPM_IMAGE}" || true
sudo podman rmi -f "${SRPM_IMAGE}" || true

.PHONY: check
check: _hadolint _shellcheck
Expand Down
50 changes: 40 additions & 10 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,60 @@ Install the software necessary for running the build process:
sudo dnf install -y make podman
```

### Create RPM Packages
### Create SRPM Package

Create the MicroShift RPM packages by running the `make rpm` command.
Create the MicroShift SRPM package by running the `make srpm` command.

The following options can be specified in the make command line using the `NAME=VAL` format.

| Name | Required | Default | Comments |
|-----------------|----------|----------|----------|
| USHIFT_GITREF | no | main | [MicroShift repository branches](https://github.com/openshift/microshift/branches) |
| OKD_VERSION_TAG | no | latest | [OKD version tags](https://quay.io/repository/okd/scos-release?tab=tags) |
| RPM_OUTDIR | no | /tmp/... | RPM repository output directory |
| SRPM_WORKDIR | no | /tmp/... | SRPM repository output directory |

The `make rpm` command builds MicroShift RPMs based on CentOS Stream 9 operating
system. The `main` MicroShift repository branch and the latest OKD version tag
The `main` MicroShift repository branch and the latest OKD version tag
are used by default if unspecified.

Comment thread
pmtk marked this conversation as resolved.
```bash
make srpm
```

If the build completes successfully, the `microshift-okd-srpm` container image
is created and the MicroShift SRPM and version.txt file is copied to
the `SRPM_WORKDIR` directory on the host.

```
...
...
SRPMs are available in '/tmp/microshift-srpms-1tzW3h'
```

Notes:
- The MicroShift repository branch and the OKD version tag used to build the
SRPM can be overridden by specifying `USHIFT_GITREF` and `OKD_VERSION_TAG`
make command line arguments.
- The path to the `SRPM_WORKDIR` directory (either temporary or specified in
the `make srpm` command line) is displayed in the end of the build procedure.

Comment thread
pmtk marked this conversation as resolved.
### Create RPM Packages

Create the MicroShift RPM packages by running the `make rpm` command.

The `make rpm` command builds MicroShift RPMs for CentOS Stream 9 operating
system. RPMs are build from the SRPM built by running `make srpm`.

The following options can be specified in the make command line using the `NAME=VAL` format.

| Name | Required | Default | Comments |
|-----------------|----------|----------|----------|
| RPM_OUTDIR | no | /tmp/... | RPM repository output directory |

```bash
make rpm
```

If the build completes successfully, the `microshift-okd-builder` container image
If the build completes successfully, the `microshift-okd-rpm` container image
is created and the MicroShift RPM repository is copied to the `RPM_OUTDIR` directory
on the host. The packages from this repository can be used to install MicroShift
on the supported operating systems.
Expand All @@ -49,9 +82,6 @@ RPMs are available in '/tmp/microshift-rpms-EI3IXg'
```

Notes:
- The MicroShift repository branch and the OKD version tag used to build the
packages can be overridden by specifying `USHIFT_GITREF` and `OKD_VERSION_TAG`
make command line arguments.
- The path to the `RPM_OUTDIR` directory (either temporary or specified in
the `make rpm` command line) is displayed in the end of the build procedure.

Expand Down Expand Up @@ -102,7 +132,7 @@ The following options can be specified in the make command line using the `NAME=

The `make image` command builds a MicroShift Bootc image based on CentOS Stream 9
operating system with the default options. The command uses artifacts from the
`microshift-okd-builder` container image created by `make rpm`.
`microshift-okd-rpm` container image created by `make rpm`.

```bash
make image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
ARG BOOTC_IMAGE_URL=quay.io/centos-bootc/centos-bootc
ARG BOOTC_IMAGE_TAG=stream9

FROM localhost/microshift-okd-builder:latest AS builder
FROM localhost/microshift-okd-rpm:latest AS builder
FROM ${BOOTC_IMAGE_URL}:${BOOTC_IMAGE_TAG}

ARG REPO_CONFIG_SCRIPT=/tmp/create_repos.sh
Expand Down
81 changes: 0 additions & 81 deletions packaging/microshift-builder.Containerfile

This file was deleted.

31 changes: 31 additions & 0 deletions packaging/rpm.Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
FROM localhost/microshift-okd-srpm:latest AS srpm

FROM quay.io/centos/centos:stream9

RUN dnf install -y \
--setopt=install_weak_deps=False \
rpm-build which git cpio createrepo \
gcc gettext golang jq make policycoreutils selinux-policy selinux-policy-devel systemd && \
dnf clean all

COPY --from=srpm /home/microshift/microshift/_output/rpmbuild/SRPMS/ /tmp/

ARG BUILDER_RPM_REPO_PATH=/home/microshift/microshift/_output/rpmbuild/

WORKDIR /tmp

# hadolint ignore=DL4006
RUN \
echo "# Extract the MicroShift source code into /home/microshift/microshift - bootc builder is reusing file" && \
rpm2cpio ./microshift-*.src.rpm | cpio -idmv && \
mkdir -p /home/microshift/microshift && \
tar xf ./microshift-*.tar.gz -C /home/microshift/microshift --strip-components=1 && \
\
echo "# Build the RPMs from the SRPM" && \
rpmbuild --quiet --define 'microshift_variant community' --rebuild ./microshift-*.src.rpm && \
\
echo "# Finally, move the RPMs" && \
mkdir -p ${BUILDER_RPM_REPO_PATH} && \
mv /root/rpmbuild/RPMS ${BUILDER_RPM_REPO_PATH}/ && \
createrepo -v ${BUILDER_RPM_REPO_PATH}/RPMS && \
rm -rf /root/rpmbuild /tmp/*
Loading