diff --git a/.github/actions/quick-start-clean/action.yaml b/.github/actions/quick-start-clean/action.yaml index f4586bc3..1e668fc0 100644 --- a/.github/actions/quick-start-clean/action.yaml +++ b/.github/actions/quick-start-clean/action.yaml @@ -6,12 +6,10 @@ inputs: description: Image reference to use for the MicroShift container required: false default: "" - type: string run-clean: description: Run the clean script required: false - default: true - type: boolean + default: "true" runs: using: "composite" @@ -19,8 +17,17 @@ runs: - name: Run the quick start script shell: bash run: | - set -xeuo pipefail - sudo IMAGE_REF=${{ inputs.image-ref }} bash -xeuo pipefail < ./src/quickstart.sh + set -euo pipefail + set -x + + IMAGE="" + TAG="" + image_ref="${{ inputs.image-ref }}" + if [ -n "${image_ref}" ]; then + IMAGE="${image_ref%%:*}" + TAG="${image_ref##*:}" + fi + sudo IMAGE="${IMAGE}" TAG="${TAG}" bash -xeuo pipefail < ./src/quickstart.sh # Wait until the MicroShift service is ready and healthy for _ in $(seq 100); do @@ -33,10 +40,11 @@ runs: exit 1 - name: Run the quick clean script - if: inputs.run-clean == true + if: ${{ inputs.run-clean == 'true' }} shell: bash run: | - set -xeuo pipefail + set -euo pipefail + set -x sudo bash -xeuo pipefail < ./src/quickclean.sh # Verify the container and its image are removed diff --git a/.github/workflows/installers.yaml b/.github/workflows/installers.yaml index 4c10fffd..ae5de793 100644 --- a/.github/workflows/installers.yaml +++ b/.github/workflows/installers.yaml @@ -7,7 +7,10 @@ on: jobs: quick-start-and-clean: if: ${{ !github.event.pull_request.draft }} - runs-on: ubuntu-24.04 + strategy: + matrix: + runners: [ubuntu-24.04, ubuntu-24.04-arm] + runs-on: ${{ matrix.runners }} steps: - name: Check out MicroShift upstream repository uses: actions/checkout@v4 diff --git a/README.md b/README.md index 5e884f38..0f6b7ad9 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,9 @@ outside the downstream Red Hat payloads. # Operating System Support -MicroShift and its main components are available on the `x86_64` architecture. -RPM and DEB packages built in a container can be installed and run on the -following operating systems. +MicroShift and its main components are available for the `x86_64` and `aarch64` +architectures. 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| |-----------|-------|-----|-----|-------|-------|---------|--------| @@ -29,10 +29,11 @@ following operating systems. | 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 - by [Podman](https://podman.io/). -- The support for the `aarch64` architecture depends on - [OKD Build of OpenShift on Arm](https://issues.redhat.com/browse/OKD-215). +- MicroShift Bootc container images can be run on `x86_64` and `aarch64` systems + using any OS supported by [Podman](https://podman.io/). +- OKD builds for the `aarch64` architecture are performed using MicroShift-specific + build procedure until [OKD Build of OpenShift on Arm](https://issues.redhat.com/browse/OKD-215) + is implemented by the OKD team. ## Quick Start diff --git a/docs/workflows.md b/docs/workflows.md index 2bab8e09..01db84d8 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -1,56 +1,98 @@ ## GitHub Workflows -The following GitHub workflows are defined at the `.github/workflows` folder: -* `MicroShift RPM and Container Image Builder` in `build-rpms.yaml` +The GitHub Workflows are defined at the `.github/workflows` folder, including +pre-submit tests and software release procedures. -These workflows can be run under the [Actions](https://github.com/microshift-io/microshift/actions) -tab by the repository maintainers. Other contributors can -[create a fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo#forking-a-repository) -from the [MicroShift Upstream](https://github.com/microshift-io/microshift) repository -and run existing or create new workflows in their private repository branches. +* Pre-submit tests are run automatically before a pull request can be merged +* Software release procedures can be run under the [Actions](https://github.com/microshift-io/microshift/actions) + tab by the repository maintainers, or scheduled for regular automatic execution + +> Note: Contributors can create a fork from the [MicroShift Upstream](https://github.com/microshift-io/microshift) +> repository and run software release workflows in their private repository branches. The remainder of this document describes the existing workflows and their functionality. -### Release MicroShift RPMs and Container Images +### Pre-submit Workflows + +The workflows described in this section are run as a prerequisite for merging a +pull request into the main branch. If any of these procedures exit with errors, +the pull request cannot be merged before all the errors are fixed. + +#### Builders + +Build a MicroShift Bootc image from the `main` MicroShift source branch and the +latest published OKD version tag. Run this image to verify that all the MicroShift +services are functional. + +The following operating systems are tested: +* Fedora, CentOS 9 and CentOS 10 for RPM packages and Bootc images +* Ubuntu for DEB packages + +The following configurations are tested: +* The `x86_64` and `aarch64` architectures +* Isolated network for OVN-K and Kindnet CNI + +#### Installers + +Run the [Quick Start](../README.md#quick-start) procedure followed by the +[quick clean](./quickclean.sh) script invocation. + +#### Linters + +Run [ShellCheck](https://github.com/koalaman/shellcheck) on all shell scripts and +[hadolint](https://github.com/hadolint/hadolint) on all container files in the repository. + +### Software Release Procedures + +#### MicroShift + +The workflow implements a build process producing MicroShift RPM 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 +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 workflow implements a build process producing MicroShift RPM and Bootc -container image artifacts. +The following actions are supported: +* `rpms`: Build MicroShift RPM packages +* `bootc-image`: Build a MicroShift Bootc container image +* `all`: Build all of the above -The following parameters determine the MicroShift source code branch and OKD -container dependencies used during the build process. -* MicroShift branch from https://github.com/openshift/microshift/branches -* OKD version tag from https://quay.io/repository/okd/scos-release?tab=tags +> 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. -The following actions are suppported. -* `rpms`: Builds the MicroShift RPM packages -* `bootc-image`: Builds the Bootc container images -* `okd-release-arm`: Builds an OKD release for the ARM architecture -* `all`: Builds all of the above +If the build job finishes successfully, the artifact download and installation +instructions are available at [Releases](https://github.com/microshift-io/microshift/releases). -Note: When the Bootc container images are built, one of the workflow steps tests -the validity of the produced artifacts by attempting to run the container image -and making sure all the MicroShift services are functional. +> 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. -If the build job finishes successfully, the build artifacts are available for -download in the following locations: -* [Releases](https://github.com/microshift-io/microshift/releases) for RPMs -* [Packages](https://github.com/microshift-io/microshift/packages) for container images +#### OKD on ARM -The container images can be pulled directly from the `ghcr.io/microshift-io` registry. +The workflow implements a build process producing a subset of OKD container image +artifacts that are required by MicroShift on the `aarch64` architecture. It runs +every day at 03:00 UTC to make sure ARM artifacts are available for the latest +OKD releases. -### Presubmit Pull Request Verification +> Note: OKD `aarch64` builds are performed using MicroShift-specific build procedure +> until [OKD Build of OpenShift on Arm](https://issues.redhat.com/browse/OKD-215) +> is implemented by the OKD team. -The workflow is run as a prerequisite for merging a pull request into the main -branch. +The following parameters determine the MicroShift source code branch and the OKD +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) -It implements the following verification procedures: -* Run `shellcheck` on all scripts in the repository -* Run `hadolint` on all container files in the repository -* Build and test MicroShift Bootc image on selected configurations -* Build and test MicroShift Debian Packages on Ubuntu +The default target registry for publishing OKD container image artifacts is +`ghcr.io/microshift-io/okd`. -Note: The Bootc image build is performed on the `main` MicroShift branch and the -latest published OKD version tag. +> Note: After the OKD container images are built, a workflow step checks them by +> creating a MicroShift Bootc image with the new artifacts, attempting to run it, +> and verifying that all the MicroShift services work. -If any of these procedures exit with errors, the pull request cannot be merged -before all the errors are fixed. +If the build job finishes successfully, 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. diff --git a/src/quickstart.sh b/src/quickstart.sh index 14cdfa84..7396bb8b 100755 --- a/src/quickstart.sh +++ b/src/quickstart.sh @@ -3,8 +3,8 @@ set -euo pipefail OWNER=${OWNER:-microshift-io} REPO=${REPO:-microshift} +IMAGE=${IMAGE:-"ghcr.io/${OWNER}/${REPO}"} TAG=${TAG:-latest} -IMAGE_REF=${IMAGE_REF:-"ghcr.io/${OWNER}/${REPO}:${TAG}"} LVM_DISK="/var/lib/microshift-okd/lvmdisk.image" VG_NAME="myvg1" @@ -81,10 +81,19 @@ if [ "$(id -u)" -ne 0 ]; then exit 1 fi +# Update the tag for the latest version +if [ "${TAG}" == "latest" ] ; then + TAG="$(curl -s "https://api.github.com/repos/${OWNER}/${REPO}/releases/latest" | jq -r .tag_name)" + if [ -z "${TAG}" ] || [ "${TAG}" == "null" ] ; then + echo "ERROR: Could not determine the latest release tag from GitHub" + exit 1 + fi +fi + # Run the procedures -pull_bootc_image "${IMAGE_REF}" +pull_bootc_image "${IMAGE}:${TAG}" prepare_lvm_disk "${LVM_DISK}" "${VG_NAME}" -run_bootc_image "${IMAGE_REF}" +run_bootc_image "${IMAGE}:${TAG}" # Follow-up instructions echo