Skip to content
Draft
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
13 changes: 10 additions & 3 deletions .github/actions/build/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,22 @@ inputs:
isolated-network:
description: Build and test the isolated network container image
required: false
default: 0
default: "0"
ovnk-networking:
description: Use OVN-K networking
required: false
default: 0
default: "0"
node-count:
description: Number of nodes in the MicroShift cluster
required: false
default: 1
default: "1"
build:
description: Types of artifacts to build (all, rpms, bootc-image)
required: true
rpm-builder:
description: RPM builder image to use
required: false
default: microshift-okd-builder

runs:
using: "composite"
Expand All @@ -40,9 +44,11 @@ runs:
uses: ./.github/actions/debug-info

- name: Prepare the build and run environment
if: inputs.rpm-builder == 'microshift-okd-builder'
uses: ./.github/actions/prebuild

- name: Build MicroShift RPMs
if: inputs.rpm-builder == 'microshift-okd-builder'
shell: bash
run: |
# See https://github.com/microshift-io/microshift/blob/main/docs/build.md
Expand Down Expand Up @@ -73,6 +79,7 @@ runs:
make image \
BOOTC_IMAGE_URL="${{ inputs.bootc-image-url }}" \
BOOTC_IMAGE_TAG="${{ inputs.bootc-image-tag }}" \
BUILDER_IMAGE=${{ inputs.rpm-builder }} \
${make_opts[@]}

- name: Run a test to verify that MicroShift is functioning properly
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/prebuild/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ runs:
sudo rm -rvf /mnt/* || true

# Create the necessary directories on the /mnt partition
sudo mkdir -p /mnt/tmp /mnt/rpms /mnt/release
sudo mkdir -p /mnt/tmp /mnt/rpms /mnt/release /mnt/srpm
sudo chmod 1777 /mnt/tmp

# Install the pre-requisites for the build and run environment
Expand Down
6 changes: 5 additions & 1 deletion .github/actions/quick-rpm-clean/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,12 @@ runs:
set -euo pipefail
set -x

branch="$(jq -r '.pull_request.head.ref' "${GITHUB_EVENT_PATH}")"
repo="$(jq -r '.pull_request.head.repo.name' "${GITHUB_EVENT_PATH}")"
owner="$(jq -r '.pull_request.head.repo.owner.login' "${GITHUB_EVENT_PATH}")"

sudo podman exec -i microshift-okd \
env TAG="${{ inputs.install-tag }}" \
env OWNER="${owner}" REPO="${repo}" BRANCH="${branch}" TAG="${{ inputs.install-tag }}" \
bash -xeuo pipefail < ./src/quickrpm.sh

# Restart the greenboot service synchronously to check the health of the system.
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ MicroShift can be run on the host or inside a Bootc container.

```bash
curl -s https://microshift-io.github.io/microshift/quickrpm.sh | \
sudo OWNER=${OWNER} TAG=${TAG} bash
sudo TAG=${TAG} bash
```

* Bootstrap MicroShift inside a Bootc container on your host.

```bash
curl -s https://microshift-io.github.io/microshift/quickstart.sh | \
sudo OWNER=${OWNER} TAG=${TAG} bash
sudo TAG=${TAG} bash
```

#### RPM and DEB
Expand Down
163 changes: 107 additions & 56 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,117 +15,157 @@ on:
default: "latest"
description: OKD version tag from https://quay.io/repository/okd/scos-release?tab=tags
type: string
build:
type: choice
description: Types of artifacts to build
default: all
options:
- all
- packages
- bootc-image
copr-repo:
default: "@microshift-io/microshift"
description: COPR repository name
type: string

jobs:
build-microshift:
build-rpms:
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4

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

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

- name: Build SRPM
shell: bash
run: |
cd ${GITHUB_WORKSPACE}/
make srpm \
USHIFT_GITREF=${{ inputs.ushift-gitref }} \
OKD_VERSION_TAG=${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }} \
SRPM_WORKDIR=/mnt/srpm

- name: Create COPR build
shell: bash
env:
COPR_CONFIG: |
${{ secrets.COPR_CONFIG }}
run: |
set -euo pipefail
cd ${GITHUB_WORKSPACE}/
echo "${COPR_CONFIG}" > /tmp/copr-config

make copr-create-build \
SRPM_WORKDIR=/mnt/srpm \
COPR_REPO_NAME="${{ inputs.copr-repo }}" \
COPR_CONFIG=/tmp/copr-config

make copr-watch-build \
SRPM_WORKDIR=/mnt/srpm \
COPR_REPO_NAME="${{ inputs.copr-repo }}"

- name: Persist version and build ID
uses: actions/upload-artifact@v4
with:
name: srpm-artifacts
path: |
/mnt/srpm/version.txt
/mnt/srpm/build.txt
overwrite: true


build-and-test-microshift:
needs: build-rpms
strategy:
matrix:
runners: [ubuntu-24.04, ubuntu-24.04-arm]
name: Build MicroShift upstream
name: Build RPM images based on COPR build
runs-on: ${{ matrix.runners }}
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4

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

- uses: actions/download-artifact@v5
with:
name: srpm-artifacts
path: /tmp/srpm

- name: Store version
shell: bash
id: version
run: |
set -euo pipefail
test -f /tmp/srpm/version.txt
echo "version=$(cat /tmp/srpm/version.txt)" >> "${GITHUB_OUTPUT}"

- name: Detect the CPU architecture
id: detect-cpu-arch
uses: ./.github/actions/arch

- name: Detect OKD version tag
id: detect-okd-version
uses: ./.github/actions/okd-version
- name: Create RPMs image with RPMs from COPR
shell: bash
run: |
set -euo pipefail
cd ${GITHUB_WORKSPACE}/

make rpm-copr \
SRPM_WORKDIR=/tmp/srpm \
RPM_OUTDIR=/mnt/rpms

- name: Run the build action
uses: ./.github/actions/build
with:
ushift-gitref: ${{ inputs.ushift-gitref }}
okd-version-tag: ${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }}
build: ${{ inputs.build }}
ushift-gitref: not-required
okd-version-tag: not-required
rpm-builder: rpm-copr-builder
build: bootc-image

# Test the local container image with the quick start and clean procedures
# before releasing the artifacts. Make sure not to run the clean scripts
# because the images are needed for the release process.
- name: Run the quick start script and clean scripts
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
uses: ./.github/actions/quick-start-clean
with:
image-ref: localhost/microshift-okd:latest
run-clean: false

# Prepare the RPM archives to be released before converting to DEB packages.
- name: Prepare the RPM archives
if: contains(fromJSON('["all", "packages"]'), inputs.build)
shell: bash
run : |
# Archive sources separately from the RPMs
sudo mv /mnt/rpms/srpms /mnt/srpms
cd /mnt/srpms
sudo tar zcvf /mnt/release/microshift-src.tgz .

cd /mnt/rpms
sudo tar zcvf /mnt/release/microshift-rpms-$(uname -m).tgz .

- name: Store version in a variable
id: version
run: |
set -euo pipefail
if [ ! -f /mnt/rpms/version.txt ]; then
echo "ERROR: version.txt not found at /mnt/rpms/version.txt"
exit 1
fi
echo "version=$(cat /mnt/rpms/version.txt)" >> "${GITHUB_OUTPUT}"

- name: Push version.txt to artifacts
uses: actions/upload-artifact@v4
with:
name: version.txt
path: /mnt/rpms/version.txt
overwrite: true

# This step is run after the RPM archives are prepared to avoid
# including DEB packages in the RPM archive.
- name: Convert the RPMs to DEB packages
if: contains(fromJSON('["all", "packages"]'), inputs.build)
uses: ./.github/actions/build-deb
with:
ushift-gitref: ${{ inputs.ushift-gitref }}
okd-version-tag: ${{ inputs.okd-version-tag != 'latest' && inputs.okd-version-tag || steps.detect-okd-version.outputs.okd-version-tag }}
ushift-gitref: not-required
okd-version-tag: not-required
build-rpms: false

- name: Prepare the DEB archives
if: contains(fromJSON('["all", "packages"]'), inputs.build)
shell: bash
run: |
cd /mnt/rpms/deb
sudo tar zcvf /mnt/release/microshift-debs-$(uname -m).tgz .

- name: Release RPM and DEB packages
if: contains(fromJSON('["all", "packages"]'), inputs.build)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
files: |
/mnt/release/microshift-rpms-*.tgz
/mnt/release/microshift-debs-*.tgz
/mnt/release/microshift-src.tgz
overwrite_files: true

- name: Login to GitHub Container Registry
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
uses: ./.github/actions/podman-login
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Bootc container image for the target architecture
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
shell: bash
run: |
set -euo pipefail
Expand All @@ -137,31 +177,32 @@ jobs:
sudo podman tag microshift-okd "${TARGET_IMAGE}:${TARGET_TAG}"
sudo podman push "${TARGET_IMAGE}:${TARGET_TAG}"


release-microshift:
needs: build-microshift
needs: build-and-test-microshift
runs-on: ubuntu-24.04
steps:
- name: Check out MicroShift upstream repository
uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: version.txt
path: /tmp/
name: srpm-artifacts
path: /tmp/srpm

- name: Store version in a variable
id: version
run: |
echo "version=$(cat /tmp/version.txt)" >> "${GITHUB_OUTPUT}"
set -euo pipefail
test -f /tmp/srpm/version.txt
echo "version=$(cat /tmp/srpm/version.txt)" >> "${GITHUB_OUTPUT}"

- name: Login to GitHub Container Registry
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
uses: ./.github/actions/podman-login
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Bootc container image manifest
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
shell: bash
run: |
set -euo pipefail
Expand All @@ -180,8 +221,18 @@ jobs:
OWNER="${{ github.repository_owner }}" IMAGE="${TARGET_IMAGE}" TAG="${TARGET_TAG}" \
envsubst < .github/workflows/release.md > /tmp/release.md

- name: COPR - Regenerate RPM repo
shell: bash
env:
COPR_CONFIG: |
${{ secrets.COPR_CONFIG }}
run : |
echo "${COPR_CONFIG}" > /tmp/copr-config
make copr-regenerate-repos \
COPR_CONFIG=/tmp/copr-config \
COPR_REPO_NAME="${{ inputs.copr-repo }}"

- name: Add release note for bootc image usage
if: contains(fromJSON('["all", "bootc-image"]'), inputs.build)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.version }}
Expand Down
Loading
Loading