From f2f12d152a1f8d60f3b2f2c0e4a280251a6b1fd9 Mon Sep 17 00:00:00 2001 From: Gregory Giguashvili Date: Tue, 4 Nov 2025 16:08:39 +0200 Subject: [PATCH 1/3] Fix global variable name in prebuild.sh --- src/image/prebuild.sh | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/image/prebuild.sh b/src/image/prebuild.sh index 63f1ff0e..70b43cb5 100755 --- a/src/image/prebuild.sh +++ b/src/image/prebuild.sh @@ -2,7 +2,7 @@ set -euo pipefail MICROSHIFT_ROOT="/home/microshift/microshift" -UNAME_M="$(uname -m)" +ARCH="$(uname -m)" declare -A UNAME_TO_GOARCH_MAP=( ["x86_64"]="amd64" ["aarch64"]="arm64" ) oc_release_info() { @@ -36,10 +36,10 @@ verify_okd_release() { replace_base_assets() { local -r okd_url=$1 local -r okd_releaseTag=$2 - local -r temp_json="$(mktemp "/tmp/release-${UNAME_M}.XXXXX.json")" + local -r temp_json="$(mktemp "/tmp/release-${ARCH}.XXXXX.json")" # Replace MicroShift images with OKD upstream images - for cur_image in $(jq -e -r '.images | keys []' "${MICROSHIFT_ROOT}/assets/release/release-${UNAME_M}.json") ; do + for cur_image in $(jq -e -r '.images | keys []' "${MICROSHIFT_ROOT}/assets/release/release-${ARCH}.json") ; do # LVMS operator is not part of the OKD release if [ "${cur_image}" = "lvms_operator" ] ; then echo "Skipping '${cur_image}'" @@ -50,13 +50,13 @@ replace_base_assets() { new_image=$(oc_release_info "${okd_url}" "${okd_releaseTag}" "${cur_image}") echo "Replacing '${cur_image}' with '${new_image}'" - jq --arg a "${cur_image}" --arg b "${new_image}" '.images[$a] = $b' "${MICROSHIFT_ROOT}/assets/release/release-${UNAME_M}.json" >"${temp_json}" - mv "${temp_json}" "${MICROSHIFT_ROOT}/assets/release/release-${UNAME_M}.json" + jq --arg a "${cur_image}" --arg b "${new_image}" '.images[$a] = $b' "${MICROSHIFT_ROOT}/assets/release/release-${ARCH}.json" >"${temp_json}" + mv "${temp_json}" "${MICROSHIFT_ROOT}/assets/release/release-${ARCH}.json" done # Update the infra pods for crio local -r pod_image=$(oc_release_info "${okd_url}" "${okd_releaseTag}" "pod") - sed -i 's,pause_image .*,pause_image = '"\"${pod_image}\""',' "${MICROSHIFT_ROOT}/packaging/crio.conf.d/10-microshift_${UNAME_TO_GOARCH_MAP[${UNAME_M}]}.conf" + sed -i 's,pause_image .*,pause_image = '"\"${pod_image}\""',' "${MICROSHIFT_ROOT}/packaging/crio.conf.d/10-microshift_${UNAME_TO_GOARCH_MAP[${ARCH}]}.conf" } # This code is extracted from openshift/microshift/scripts/auto-rebase/rebase.sh @@ -64,15 +64,15 @@ replace_base_assets() { replace_olm_assets() { local -r okd_url=$1 local -r okd_releaseTag=$2 - local -r temp_json=$(mktemp "/tmp/release-olm-${UNAME_M}.XXXXX.json") + local -r temp_json=$(mktemp "/tmp/release-olm-${ARCH}.XXXXX.json") # Install the yq tool "${MICROSHIFT_ROOT}"/scripts/fetch_tools.sh yq # Replace OLM images with OKD upstream images local olm_image_refs_file="${MICROSHIFT_ROOT}/assets/optional/operator-lifecycle-manager/image-references" - local kustomization_arch_file="${MICROSHIFT_ROOT}/assets/optional/operator-lifecycle-manager/kustomization.${UNAME_M}.yaml" - local olm_release_json="${MICROSHIFT_ROOT}/assets/optional/operator-lifecycle-manager/release-olm-${UNAME_M}.json" + local kustomization_arch_file="${MICROSHIFT_ROOT}/assets/optional/operator-lifecycle-manager/kustomization.${ARCH}.yaml" + local olm_release_json="${MICROSHIFT_ROOT}/assets/optional/operator-lifecycle-manager/release-olm-${ARCH}.json" # Create the OLM release json file with base structure jq -n '{"release": {"base": "upstream"}, "images": {}}' > "${olm_release_json}" @@ -135,7 +135,7 @@ EOF replace_kindnet_assets() { local -r okd_url=$1 local -r okd_releaseTag=$2 - local -r temp_json="$(mktemp "/tmp/release-kindnet-${UNAME_M}.XXXXX.json")" + local -r temp_json="$(mktemp "/tmp/release-kindnet-${ARCH}.XXXXX.json")" # Install the yq tool "${MICROSHIFT_ROOT}"/scripts/fetch_tools.sh yq @@ -155,10 +155,10 @@ replace_kindnet_assets() { # Update the image and hash "${MICROSHIFT_ROOT}"/_output/bin/yq eval \ ".images[] |= select(.name == \"kube-proxy\") |= (.newName = \"${image_name}\" | .digest = \"${image_hash}\")" \ - -i "${MICROSHIFT_ROOT}/assets/optional/kube-proxy/kustomization.${UNAME_M}.yaml" + -i "${MICROSHIFT_ROOT}/assets/optional/kube-proxy/kustomization.${ARCH}.yaml" jq --arg img "$image_with_hash" '.images["kube-proxy"] = $img' \ - "${MICROSHIFT_ROOT}/assets/optional/kube-proxy/release-kube-proxy-${UNAME_M}.json" >"${temp_json}" - mv "${temp_json}" "${MICROSHIFT_ROOT}/assets/optional/kube-proxy/release-kube-proxy-${UNAME_M}.json" + "${MICROSHIFT_ROOT}/assets/optional/kube-proxy/release-kube-proxy-${ARCH}.json" >"${temp_json}" + mv "${temp_json}" "${MICROSHIFT_ROOT}/assets/optional/kube-proxy/release-kube-proxy-${ARCH}.json" } fix_rpm_spec() { From 26e4e381bbe785c4a1378f805de777e184220a9f Mon Sep 17 00:00:00 2001 From: Gregory Giguashvili Date: Tue, 4 Nov 2025 16:22:52 +0200 Subject: [PATCH 2/3] Update workflows documentation --- docs/workflows.md | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/workflows.md b/docs/workflows.md index b0e3809f..2bab8e09 100644 --- a/docs/workflows.md +++ b/docs/workflows.md @@ -22,16 +22,21 @@ container dependencies used during the build process. * OKD version tag from https://quay.io/repository/okd/scos-release?tab=tags The following actions are suppported. -* `build-all`: Builds both MicroShift RPMs and Bootc container images -* `build-rpms`: Builds only the MicroShift RPM packages -* `build-bootc-images`: Builds only the Bootc container images +* `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 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. -The build artifacts are available for download under [Releases](https://github.com/microshift-io/microshift/releases) -after the job finishes successfully. +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 + +The container images can be pulled directly from the `ghcr.io/microshift-io` registry. ### Presubmit Pull Request Verification @@ -41,9 +46,10 @@ branch. It implements the following verification procedures: * Run `shellcheck` on all scripts in the repository * Run `hadolint` on all container files in the repository -* Run MicroShift bootc image build and test the services are up and running +* Build and test MicroShift Bootc image on selected configurations +* Build and test MicroShift Debian Packages on Ubuntu -Note: The bootc image build is performed on the `main` MicroShift branch and the +Note: The Bootc image build is performed on the `main` MicroShift branch and the latest published OKD version tag. If any of these procedures exit with errors, the pull request cannot be merged From 8d092cfd9f2bface0799e07eced80b65154781fb Mon Sep 17 00:00:00 2001 From: Gregory Giguashvili Date: Tue, 4 Nov 2025 17:30:33 +0200 Subject: [PATCH 3/3] Add release-okd.yaml workflow --- .github/workflows/release-okd.yaml | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/release-okd.yaml diff --git a/.github/workflows/release-okd.yaml b/.github/workflows/release-okd.yaml new file mode 100644 index 00000000..9fa0ae1a --- /dev/null +++ b/.github/workflows/release-okd.yaml @@ -0,0 +1,41 @@ +name: release-okd +description: Workflow to build and release OKD images + +on: + schedule: + - cron: '0 3 * * *' + workflow_dispatch: + inputs: + ushift-branch: + default: "main" + description: MicroShift branch from https://github.com/openshift/microshift/branches + type: string + okd-version-tag: + default: "latest" + description: OKD version tag from https://quay.io/repository/okd/scos-release?tab=tags + type: string + okd-target-registry: + default: ghcr.io/microshift-io/okd + description: Target registry for the OKD release images for ARM + type: string + +jobs: + build-okd-release: + name: Build OKD release images for ARM + runs-on: ubuntu-24.04-arm + 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 OKD release images build action + uses: ./.github/actions/build-okd + with: + ushift-branch: ${{ inputs.ushift-branch }} + okd-version-tag: ${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }} + target-arch: arm64 + target-registry: ${{ inputs.okd-target-registry }} + token: ${{ secrets.GITHUB_TOKEN }}