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
114 changes: 114 additions & 0 deletions .github/actions/build-deb/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: build-deb-packages
description: Reusable action to build MicroShift Debian packages

inputs:
ushift-branch:
description: MicroShift branch from https://github.com/openshift/microshift/branches
required: true
type: string
okd-version-tag:
description: OKD version tag from https://quay.io/repository/okd/scos-release?tab=tags
required: true
type: string

runs:
using: "composite"
steps:
- name: Detect the CPU architecture
id: detect-cpu-arch
uses: ./.github/actions/arch

- name: Collect debug information before the build
if: always()
uses: ./.github/actions/debug-info

- name: Prepare the build and run environment
uses: ./.github/actions/prebuild

- name: Build MicroShift RPMs
shell: bash
run: |
# See https://github.com/microshift-io/microshift/blob/main/docs/build.md
# for more information about the build process.

# Run the RPM build process.
cd ${GITHUB_WORKSPACE}/
make rpm \
USHIFT_BRANCH=${{ inputs.ushift-branch }} \
OKD_VERSION_TAG=${{ inputs.okd-version-tag }} \
RPM_OUTDIR=/mnt/rpms

- name: Convert the MicroShift RPMs to Debian packages
shell: bash
run: |
make rpm-to-deb RPM_OUTDIR=/mnt/rpms

- name: Install the MicroShift Debian packages
shell: bash
run: |
sudo ./src/deb/install.sh /mnt/rpms/deb
Comment thread
ggiguash marked this conversation as resolved.

- name: Start the MicroShift service
shell: bash
run: |
make _topolvm_create
sudo systemctl start --no-block microshift.service

- name: Run a test to verify that MicroShift is functioning properly
shell: bash
run: |
echo "Waiting 5m for the MicroShift service to be ready"
for _ in $(seq 60); do
if sudo systemctl -q is-active microshift.service ; then
printf "\nOK\n"
break
fi
echo -n "." && sleep 5
done
if ! sudo systemctl -q is-active microshift.service ; then
printf "\nFAILED\n" && exit 1
fi

# Storage deployments and daemonsets are last to become ready, so it is
# a good indicator of the MicroShift service being healthy
echo "Waiting 15m for the MicroShift service to be healthy"
if ! sudo microshift healthcheck -v=2 --timeout="900s" --custom \
'{"topolvm-system":{"deployments": ["topolvm-controller"], "daemonsets": ["topolvm-node"]}}'; then
echo "ERROR: Failed to verify that the MicroShift service is healthy"
exit 1
fi

# Uncomment this to enable tmate-debug on failure
# - name: Pause and open tmate debug session
# if: failure()
# uses: ./.github/actions/tmate-debug

- name: Collect debug information after the build
if: always()
uses: ./.github/actions/debug-info

- name: Collect sos report for MicroShift
if: failure()
shell: bash
run: |
# Change the default profiles and plugins to adapt to the Debian environment
# Profiles:
# - Remove non-existent microshift
# - Add storage
# Plugins:
# - Remove unused firewalld and rpm
# - Remove non-existent rpmostree
# - Add ufw, apt
sudo microshift-sos-report \
--profiles network,security,storage \
--plugins container_log,crio,logs,ufw,apt \
--tmp-dir /mnt/tmp
sudo chmod 644 /mnt/tmp/sosreport-*

- name: Upload sos report to the GitHub Actions artifact
if: failure()
uses: actions/upload-artifact@v4
with:
name: sosreport-microshift-okd-${{ github.job }}-${{ steps.detect-cpu-arch.outputs.arch }}-${{ github.run_id }}
path: /mnt/tmp/sosreport-*
compression-level: 0
30 changes: 8 additions & 22 deletions .github/actions/build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,7 @@ runs:
uses: ./.github/actions/debug-info

- name: Prepare the build and run environment
shell: bash
run: |
set -euo pipefail
set -x

# The /dev/sdb1 partition is mounted as /mnt.
sudo mkdir -p /mnt/tmp /mnt/rpms /mnt/release
sudo chmod 1777 /mnt/tmp

sudo apt-get install -y make lvm2 podman

# Redirect the container build directories to /mnt/ to avoid running out of disk space.
sudo mv /var/tmp /var/tmp.orig
sudo mv /var/lib/containers /mnt/containers
sudo ln -s /mnt/tmp /var/tmp
sudo ln -s /mnt/containers /var/lib/containers

# Raise open file limits to avoid "too many open files" errors
echo '* soft nofile 524288' | sudo tee -a /etc/security/limits.conf &>/dev/null
echo '* hard nofile 524288' | sudo tee -a /etc/security/limits.conf &>/dev/null
uses: ./.github/actions/prebuild

- name: Build MicroShift RPMs
shell: bash
Expand Down Expand Up @@ -124,7 +105,7 @@ runs:
if [ "${{ inputs.isolated-network }}" = "1" ]; then
for cmd in "ping -c1 8.8.8.8" "curl -I quay.io" "curl -I ghcr.io"; do
if sudo podman exec -i microshift-okd ${cmd} ; then
echo "Error: Internet access is available in the isolated network container"
echo "ERROR: Internet access is available in the isolated network container"
exit 1
fi
done
Expand All @@ -137,6 +118,11 @@ runs:
# Stop the MicroShift container
make stop

# Uncomment this to enable tmate-debug on failure
# - name: Pause and open tmate debug session
# if: failure()
# uses: ./.github/actions/tmate-debug

- name: Collect debug information after the build
if: always()
uses: ./.github/actions/debug-info
Expand All @@ -150,7 +136,7 @@ runs:

# Check if the MicroShift container is running
if ! sudo podman ps --format "{{.Names}}" | grep -q '^microshift-okd$' ; then
echo "Warning: MicroShift container is not running - cannot collect sos report"
echo "WARNING: MicroShift container is not running - cannot collect sos report"
exit 0
fi

Expand Down
2 changes: 1 addition & 1 deletion .github/actions/okd-version/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ runs:
# Get the latest OKD version tag
okd_version_tag="$(curl -s https://quay.io/api/v1/repository/okd/scos-release/tag/ | jq -r ".tags[].name" | sort | tail -1)"
if [ -z "${okd_version_tag}" ]; then
echo "Error: No OKD version tag found"
echo "ERROR: No OKD version tag found"
exit 1
fi
echo "okd_version_tag=${okd_version_tag}" >> $GITHUB_OUTPUT
24 changes: 24 additions & 0 deletions .github/actions/prebuild/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: prebuild-environment-setup
description: Reusable action to configure the build environment for MicroShift

runs:
using: "composite"
steps:
- name: Prepare the build and run environment
shell: bash
run: |
set -euo pipefail
set -x

# The /dev/sdb1 partition is mounted as /mnt.
sudo mkdir -p /mnt/tmp /mnt/rpms /mnt/release
sudo chmod 1777 /mnt/tmp

sudo apt-get update -y -q
sudo apt-get install -y -q make lvm2 podman jq curl

# Redirect the container build directories to /mnt/ to avoid running out of disk space.
sudo mv /var/tmp /var/tmp.orig
sudo mv /var/lib/containers /mnt/containers
sudo ln -s /mnt/tmp /var/tmp
sudo ln -s /mnt/containers /var/lib/containers
19 changes: 19 additions & 0 deletions .github/actions/tmate-debug/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copy the following code to an action or a workflow to open a tmate debug
# session on failure.
# Change the if condition to 'always()' to open the session unconditionally.
#
# - name: Pause and open tmate debug session
# if: failure()
# uses: ./.github/actions/tmate-debug
#
name: tmate-debug
description: Reusable action to open a tmate debug session

runs:
using: "composite"
steps:
- name: Pause and open tmate debug session
uses: mxschmitt/action-tmate@v3
with:
limit-access-to-actor: false
26 changes: 21 additions & 5 deletions .github/workflows/builders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
centos9-bootc:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
Expand All @@ -25,7 +25,7 @@ jobs:
build: bootc-image

centos10-bootc:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
Expand All @@ -44,7 +44,7 @@ jobs:
build: bootc-image

fedora-bootc:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
Expand All @@ -62,8 +62,24 @@ jobs:
bootc-image-tag: latest
build: bootc-image

ubuntu-rpm2deb:
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4

- name: Detect OKD version tag
id: detect-okd-version
uses: ./.github/actions/okd-version

- name: Run the build action
uses: ./.github/actions/build-deb
with:
ushift-branch: main
okd-version-tag: ${{ steps.detect-okd-version.outputs.okd-version-tag }}

isolated-network-kindnet:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
Expand All @@ -82,7 +98,7 @@ jobs:
build: bootc-image

isolated-network-ovnk:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/installers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
quick-start-and-clean:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
shellcheck:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
Expand All @@ -16,7 +16,7 @@ jobs:
make _shellcheck

hadolint:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4
Expand Down
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ all:
@echo " check: run the presubmit checks"
@echo ""
@echo "Sub-targets:"
@echo " rpm-to-deb: convert the MicroShift RPMs to Debian packages"
@echo " run-ready: wait until the MicroShift service is ready"
@echo " run-healthy: wait until the MicroShift service is healthy"
@echo " clean-all: perform a full cleanup, including the container images"
Expand All @@ -64,16 +65,28 @@ rpm:
echo "Build completed successfully" && \
echo "RPMs are available in '$${outdir}'"

.PHONY: rpm-to-deb
rpm-to-deb:
if [ -z "${RPM_OUTDIR}" ] ; then \
echo "ERROR: RPM_OUTDIR is not set" ; \
exit 1 ; \
fi && \
sudo ./src/deb/convert.sh "${RPM_OUTDIR}" && \
echo "" && \
echo "Conversion completed successfully" && \
echo "Debian packages are available in '${RPM_OUTDIR}/deb'"

.PHONY: image
image:
@if ! sudo podman image exists microshift-okd-builder ; then \
echo "Error: Run 'make rpm' to build the MicroShift RPMs"; \
exit 1; \
echo "ERROR: Run 'make rpm' to build the MicroShift RPMs" ; \
exit 1 ; \
fi

@echo "Building the MicroShift bootc container image"
sudo podman build \
-t "${USHIFT_IMAGE}" \
--ulimit nofile=524288:524288 \
--label microshift.branch="${USHIFT_BRANCH}" \
--label okd.version="${OKD_VERSION_TAG}" \
--build-arg BOOTC_IMAGE_URL="${BOOTC_IMAGE_URL}" \
Expand Down Expand Up @@ -141,7 +154,7 @@ run-healthy:
.PHONY: login
login:
@echo "Logging into the MicroShift container"
sudo podman exec -it "${USHIFT_IMAGE}" bash
sudo podman exec -it "${USHIFT_IMAGE}" bash -l

.PHONY: stop
stop:
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ outside the downstream Red Hat payloads.
# Operating System Support

MicroShift and its main components are available on the `x86_64` architecture.
RPM packages built in a CentOS Stream 9 Bootc container can be installed and
run on the following operating systems.

| OS | Bootc| OVN-K | Kindnet | TopoLVM | Comments |
|-----------|------|-------|---------|---------|----------|
| CentOS 9 | Y | Y | Y | Y | Latest version in Stream 9
| CentOS 10 | Y | Y | Y | Y | Latest version in Stream 10
| Fedora | Y | N | Y | Y | Latest released version (e.g. 42)
RPM and DEB packages built in a container can be installed and run on the
following operating systems.

| OS |Package|Bootc|OVN-K|Kindnet|TopoLVM|Greenboot|Comments|
|-----------|-------|-----|-----|-------|-------|---------|--------|
| CentOS 9 | RPM | Y | Y | Y | Y | Y | Latest version in Stream 9 |
| CentOS 10 | RPM | Y | Y | Y | Y | Y | Latest version in Stream 10 |
| Fedora | RPM | Y | N | Y | Y | Y | Latest released version (e.g. 42) |
| Ubuntu | DEB | N | N | Y | Y | N | Latest LTS version (e.g. 24.04) |

Notes:
- MicroShift Bootc container images can be run on any operating system supported
Expand Down
Loading
Loading