From 829ad71042f0c450407503a424acd9160e94db81 Mon Sep 17 00:00:00 2001 From: Din Music Date: Thu, 15 Feb 2024 11:14:40 +0100 Subject: [PATCH 01/16] bin: Add script for building distro Signed-off-by: Din Music --- bin/build-distro | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 bin/build-distro diff --git a/bin/build-distro b/bin/build-distro new file mode 100755 index 00000000..4b72beb3 --- /dev/null +++ b/bin/build-distro @@ -0,0 +1,55 @@ +#!/bin/sh +set -eu + +# Check arguments +if [ "${1:-}" = "" ] || [ "${2:-}" = "" ] || [ "${3:-}" = "" ] || [ "${4:-}" = "" ] || [ "${4:-}" = "" ]; then + echo "Usage: ${0} [flags]" + exit 1 +fi + +YAML=${1} +ARCH=${2} +TYPE=${3} +TIMEOUT=${4} +TARGET=${5} +shift 5 + +# Setup build directory. +CACHE_DIR="${TARGET}/cache" +mkdir -p "${CACHE_DIR}" + +cd "${TARGET}" +cp "${YAML}" image.yaml + +# Get lxd-imagebuilder path and create a serial. +BUILDER=$(which lxd-imagebuilder) +SERIAL=$(date -u +%Y%m%d_%H:%M) + +# Build plain rootfs. +sudo "${BUILDER}" build-dir image.yaml rootfs \ + --cache-dir "${CACHE_DIR}" \ + --timeout "${TIMEOUT}" \ + -o image.serial="${SERIAL}" \ + "$@" + +# Build container. +if echo "${TYPE}" | grep -q container; then + sudo "${BUILDER}" pack-lxd image.yaml rootfs \ + --cache-dir "${CACHE_DIR}" \ + --timeout "${TIMEOUT}" \ + -o image.serial="${SERIAL}" \ + "$@" +fi + +# Build VM. +if echo "${TYPE}" | grep -q vm; then + sudo "${BUILDER}" pack-lxd image.yaml rootfs \ + --cache-dir "${CACHE_DIR}" \ + --timeout "${TIMEOUT}" \ + --vm \ + -o image.serial="${SERIAL}" \ + "$@" +fi + +sudo rm -Rf rootfs +echo "${SERIAL}" > serial From 9973902a2d154ec04b7bdd48272f9dcf9defc6bd Mon Sep 17 00:00:00 2001 From: Din Music Date: Wed, 14 Feb 2024 13:44:15 +0100 Subject: [PATCH 02/16] .github/workflows: Build Debian image Signed-off-by: Din Music --- .github/workflows/image-debian.yml | 76 ++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/image-debian.yml diff --git a/.github/workflows/image-debian.yml b/.github/workflows/image-debian.yml new file mode 100644 index 00000000..1c746821 --- /dev/null +++ b/.github/workflows/image-debian.yml @@ -0,0 +1,76 @@ +name: Build Debian Image + +on: + push: + workflow_dispatch: + # schedule: + # # Run at 00:00 UTC daily. + # - cron: '0 0 * * *' + +jobs: + debian: + runs-on: ubuntu-latest + strategy: + matrix: + distro: + - debian + release: + # - buster + # - bullseye + # - sid + # - bookworm + - trixie + architecture: + - amd64 + # - arm64 + variant: + # - default + - cloud + env: + goVersion: 1.22.x + target: "${HOME}/build" + + steps: + - uses: actions/checkout@v4 + + - name: Install Go + uses: actions/setup-go@v4 + with: + go-version: "${{ env.goVersion }}" + + - name: Install dependencies + run: | + sudo apt-get -qq update + sudo apt-get install -y \ + debootstrap \ + qemu-utils \ + git \ + gpg \ + rsync \ + squashfs-tools + + - name: Build LXD imagebuilder + run: make + + - name: Clone LXD CI repository + run: git clone https://github.com/musicdin/lxd-ci --branch cp/images2 + + - name: Build image + run: | + TIMEOUT=1800 + YAML="${{ github.workspace }}/lxd-ci/images/${{ matrix.distro }}.yaml" + ARCH=${{ matrix.architecture }} + + TYPE="container" + if [ "${ARCH}" = "amd64" ] || [ "${ARCH}" = "arm64" ]; then + TYPE="container,vm" + fi + + ./bin/build-distro "${YAML}" "${ARCH}" "${TYPE}" "${TIMEOUT}" "${{ env.target }}" \ + -o image.architecture=${{ matrix.architecture }} \ + -o image.release=${{ matrix.release }} \ + -o image.variant=${{ matrix.variant }} \ + -o source.url="http://ftp.us.debian.org/debian" + + - name: Print build artifacts + run: ls -lah "${{ env.target }}" From 2b7bbe3694988fa5b4971ce28f47651df9bc84d9 Mon Sep 17 00:00:00 2001 From: Din Music Date: Thu, 15 Feb 2024 13:10:14 +0100 Subject: [PATCH 03/16] bin: Add image test script Signed-off-by: Din Music --- bin/test-image | 296 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 296 insertions(+) create mode 100755 bin/test-image diff --git a/bin/test-image b/bin/test-image new file mode 100755 index 00000000..c6a60286 --- /dev/null +++ b/bin/test-image @@ -0,0 +1,296 @@ +#!/bin/sh +set -eu + +# Check input arguments. +if [ "${1:-}" = "" ] || [ "${2:-}" = "" ] || [ "${3:-}" = "" ] || [ "${4:-}" = "" ] || [ "${5:-}" = "" ]; then + echo "Usage: ${0} " + exit 1 +fi + +TYPE=${1} +DIST=${2} +RELEASE=${3} +VARIANT=${4} +TARGET=${5} + +# Ensure lxc is installed. +if ! which lxc >/dev/null; then + echo "==> FAIL: Binary 'lxc' not found!" + exit 1 +fi + +# Skip VM tests on arm64. +if [ "${TYPE}" = "vm" ] && [ "$(uname -m)" = "aarch64" ]; then + echo "==> SKIP: Can't test VM image on arm64 (lack nested support)" + exit +fi + +# Setup the test environment. +TEST_DIR="${HOME}/build-test" +TEST_IMAGE="${TYPE}-${DIST}-${VARIANT}" + +rm -Rf "${TEST_DIR}" +mkdir -p "${TEST_DIR}" + +echo "==> Fetching the image" +if [ "${TYPE}" = "container" ]; then + cp "${TARGET}/lxd.tar.xz" "${TEST_DIR}/meta" + cp "${TARGET}/rootfs.squashfs" "${TEST_DIR}/root" +elif [ "${TYPE}" = "vm" ]; then + cp "${TARGET}/lxd.tar.xz" "${TEST_DIR}/meta" + cp "${TARGET}/disk.qcow2" "${TEST_DIR}/root" +else + echo "==> FAIL: Invalid instance type '${TYPE}'. Valid types: [container, vm]" + exit 1 +fi + +cleanup() { + rm -Rf "${TEST_DIR}" + lxc delete -f "${TEST_IMAGE}" 2>/dev/null || true + lxc delete -f "${TEST_IMAGE}-priv" 2>/dev/null || true + lxc delete -f "${TEST_IMAGE}-unpriv" 2>/dev/null || true + lxc image delete "${TEST_IMAGE}" 2>/dev/null || true + + if [ "${FAIL}" = "1" ]; then + exit 1 + fi + + exit 0 +} + +FAIL=1 +trap cleanup EXIT HUP INT TERM + + +# curl "${META_URL}" -s -o "/tmp/${TEST_IMAGE}/meta" +# curl "${DATA_URL}" -s -o "/tmp/${TEST_IMAGE}/root" + +FINGERPRINT=$(cat "${TEST_DIR}/meta" "${TEST_DIR}/root" | sha256sum | cut -d' ' -f1) +lxc image import "${TEST_DIR}/meta" "${TEST_DIR}/root" --alias "${TEST_IMAGE}" + +echo "==> Creating the instances" +INSTANCES="" +if [ "${TYPE}" = "vm" ]; then + lxc init "${TEST_IMAGE}" "${TEST_IMAGE}" \ + --vm \ + -c limits.cpu=4 \ + -c limits.memory=4GB \ + -c security.secureboot=false + + INSTANCES="${TEST_IMAGE}" + + # Handle distros needing the agent drive. + if [ "${DIST}" = "almalinux" ] || [ "${DIST}" = "centos" ] || [ "${DIST}" = "openeuler" ] || [ "${DIST}" = "rockylinux" ]; then + lxc config device add "${TEST_IMAGE}" agent disk source=agent:config + fi + + # Cloud-init testing. + if [ "${VARIANT}" = "cloud" ]; then + lxc config set "${TEST_IMAGE}" user.user-data "$(cat << EOF +#cloud-config +write_files: + - content: "foo\n" + path: /user-data +EOF +)" + + lxc config set "${TEST_IMAGE}" user.vendor-data "$(cat << EOF +#cloud-config +bootcmd: + - "echo bar > /vendor-data" +EOF +)" + fi +else + for PRIV in "priv" "unpriv"; do + if [ "${PRIV}" = "priv" ] && [ "${DIST}" = "nixos" ] && [ "${RELEASE}" = "23.11" ]; then + # NixOS 23.11 will never support privileged containers, but future versions do. + continue + fi + + lxc init "${TEST_IMAGE}" "${TEST_IMAGE}-${PRIV}" + INSTANCES="${INSTANCES} ${TEST_IMAGE}-${PRIV}" + + # FIXME: workaround for Linux 6.6.3 apparmor regression. + printf "2\ndenylist\nreject_force_umount\n[all]\nfsconfig errno 38\nfsopen errno 38\n" | lxc config set "${TEST_IMAGE}-${PRIV}" raw.seccomp - + + if [ "${PRIV}" = "priv" ]; then + lxc config set "${TEST_IMAGE}-${PRIV}" security.privileged=true + fi + + if [ "${DIST}" = "voidlinux" ]; then + # Workaround weird init system. + lxc config set "${TEST_IMAGE}-${PRIV}" raw.lxc lxc.signal.halt=SIGCONT + fi + + if [ "${DIST}" = "slackware" ]; then + # Workaround weird init system. + lxc config set "${TEST_IMAGE}-${PRIV}" raw.lxc lxc.signal.halt=SIGKILL + fi + + # Cloud-init testing. + if [ "${VARIANT}" = "cloud" ]; then + lxc config set "${TEST_IMAGE}-${PRIV}" user.user-data "$(cat << EOF +#cloud-config +write_files: + - content: "foo\n" + path: /user-data +EOF +)" + + lxc config set "${TEST_IMAGE}-${PRIV}" user.vendor-data "$(cat << EOF +#cloud-config +bootcmd: + - "echo bar > /vendor-data" +EOF +)" + fi + done +fi + +# Start all instances. +echo "==> Starting the instances" +for i in ${INSTANCES}; do + lxc start "${i}" +done + +# Wait for things to settle. +echo "==> Waiting for instances to start" +[ "${TYPE}" = "container" ] && sleep 1m +[ "${TYPE}" = "vm" ] && sleep 3m +lxc list "${TEST_IMAGE}" + +# Check that all instances have an IPv4 and IPv6 address. +echo "==> Performing network tests" +FAIL=0 +for url in $(;xc query "/1.0/instances" | jq -r .[] | grep "${TEST_IMAGE}"); do + name=$(echo "${url}" | cut -d/ -f4) + + # Skip busybox as it wouldn't pass any test + if [ "${DIST}" = "busybox" ]; then + echo "===> SKIP: Busybox is untestable" + continue + fi + + # Skip CentOS 7 VMs due to racy agent + if [ "${TYPE}" = "vm" ] && [ "${DIST}" = "centos" ] && [ "${RELEASE}" = "7" ]; then + echo "===> SKIP: CentOS 7 has an unstable agent: ${name}" + continue + fi + + # Skip Ubuntu noble containers due to cgroup2 being required + if [ "${TYPE}" = "container" ] && [ "${DIST}" = "ubuntu" ] && [ "${RELEASE}" = "noble" ]; then + echo "===> SKIP: Ubuntu noble container due to cgroup2 requirement: ${name}" + continue + fi + + # Systemd cleanliness + if lxc exec "${name}" -- sh -c "type systemctl" >/dev/null 2>&1; then + if lxc exec "${name}" -- systemctl --failed 2>&1 | grep -q '\sfailed\s'; then + echo "===> FAIL: systemd clean: ${name}" + + # Show the systemd failures + echo "===> DEBUG: systemd failed: ${name}" + lxc exec "${name}" -- systemctl --failed + FAIL=1 + else + echo "===> PASS: systemd clean: ${name}" + fi + else + echo "===> SKIP: systemd clean: ${name}" + fi + + # Get the addresses + address=$(lxc query "${url}/state" | jq -r ".network.eth0.addresses | .[] | select(.scope | contains(\"global\")) | .address" 2>/dev/null || true) + if [ -z "${address}" ]; then + address=$(lxc query "${url}/state" | jq -r ".network.enp5s0.addresses | .[] | select(.scope | contains(\"global\")) | .address" 2>/dev/null || true) + fi + + if [ -z "${address}" ]; then + echo "===> FAIL: No network interface: ${name}" + + # Show the network state + echo "===> DEBUG: network state: ${name}" + lxc info "${name}" + FAIL=1 + continue + fi + + # IPv4 address + if echo "${address}" | grep "\." -q; then + echo "===> PASS: IPv4 address: ${name}" + else + echo "===> FAIL: IPv4 address: ${name}" + FAIL=1 + fi + + # IPv6 address + if echo "${address}" | grep ":" -q; then + echo "===> PASS: IPv6 address: ${name}" + else + echo "===> FAIL: IPv6 address: ${name}" + FAIL=1 + fi + + # DNS resolution + DNS=0 + for i in $(seq 3); do + if lxc exec "${name}" -- getent hosts linuxcontainers.org >/dev/null 2>&1; then + DNS=1 + break + fi + + if lxc exec "${name}" -- ping -c1 -W1 linuxcontainers.org >/dev/null 2>&1; then + DNS=1 + break + fi + + sleep 1 + done + if [ "${DNS}" = "1" ]; then + echo "===> PASS: DNS resolution: ${name}" + else + echo "===> FAIL: DNS resolution: ${name}" + FAIL=1 + fi + + # Cloud-init testing + if [ "${VARIANT}" = "cloud" ]; then + if [ "$(lxc file pull "${name}/user-data" - 2>/dev/null)" = "foo" ]; then + echo "===> PASS: cloud-init user-data provisioning: ${name}" + else + echo "===> FAIL: cloud-init user-data provisioning: ${name}" + FAIL=1 + fi + + if [ "$(lxc file pull "${name}/vendor-data" - 2>/dev/null)" = "bar" ]; then + echo "===> PASS: cloud-init vendor-data provisioning: ${name}" + else + echo "===> FAIL: cloud-init vendor-data provisioning: ${name}" + FAIL=1 + fi + fi +done + +# Check that all instances can be stopped +echo "==> Performing shutdown test" +STOPPED=0 +for i in $(seq 10); do + # shellcheck disable=SC2086 + if lxc stop ${INSTANCES} --timeout=30 >/dev/null 2>&1; then + STOPPED=1 + break + else + COUNT="$(lxc list "${TEST_IMAGE}" | grep -c RUNNING)" + if [ "${COUNT}" = "0" ]; then + STOPPED=1 + break + fi + + echo "${COUNT} instances still running" + fi +done + +lxc list "${TEST_IMAGE}" + +[ "${STOPPED}" = "0" ] && FAIL=1 From 6af0c700ec20f47f7c20c78cc27f520c3c2f541c Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 10:20:25 +0100 Subject: [PATCH 04/16] .github/workflwos: Add image-setup composite action Signed-off-by: Din Music --- .github/actions/image-setup/action.yml | 53 ++++++++++++++++++++++++++ .github/workflows/image-debian.yml | 24 +----------- 2 files changed, 55 insertions(+), 22 deletions(-) create mode 100644 .github/actions/image-setup/action.yml diff --git a/.github/actions/image-setup/action.yml b/.github/actions/image-setup/action.yml new file mode 100644 index 00000000..7fabe68e --- /dev/null +++ b/.github/actions/image-setup/action.yml @@ -0,0 +1,53 @@ +name: Setup Environment +description: Composite action that sets up the environment for building and testing images + +inputs: + lxd-channel: + description: LXD snap channel to install + default: latest/edge + go-version: + description: Go version to install + default: 1.22.x + +runs: + using: composite + steps: + - name: Install dependencies + shell: bash + run: | + sudo apt-get -qq update + sudo apt-get install -y --no-install-recommends \ + debootstrap \ + qemu-utils \ + git \ + gpg \ + rsync \ + squashfs-tools + + - name: Setup LXD ${{ inputs.lxd-channel }} + shell: bash + run: | + sudo snap refresh lxd --channel=${{ inputs.lxd-channel }} + sudo lxd waitready --timeout 60 + sudo chmod 777 /var/snap/lxd/common/lxd/unix.socket + sudo lxd init --auto + lxc version + + - name: Install Go ${{ inputs.go-version }} + uses: actions/setup-go@v5 + with: + go-version: "${{ inputs.go-version }}" + + - name: Build LXD imagebuilder + shell: bash + run: make + + - name: Clone LXD CI repository (for image recipes) + shell: bash + run: git clone https://github.com/musicdin/lxd-ci --branch cp/images2 --depth 1 + + - name: Print supported driver + shell: bash + run: | + lxc query /1.0 | jq '.environment.driver' + sudo lxc query /1.0 | jq '.environment.driver' diff --git a/.github/workflows/image-debian.yml b/.github/workflows/image-debian.yml index 1c746821..e2f7bdea 100644 --- a/.github/workflows/image-debian.yml +++ b/.github/workflows/image-debian.yml @@ -27,33 +27,13 @@ jobs: # - default - cloud env: - goVersion: 1.22.x target: "${HOME}/build" steps: - uses: actions/checkout@v4 - - name: Install Go - uses: actions/setup-go@v4 - with: - go-version: "${{ env.goVersion }}" - - - name: Install dependencies - run: | - sudo apt-get -qq update - sudo apt-get install -y \ - debootstrap \ - qemu-utils \ - git \ - gpg \ - rsync \ - squashfs-tools - - - name: Build LXD imagebuilder - run: make - - - name: Clone LXD CI repository - run: git clone https://github.com/musicdin/lxd-ci --branch cp/images2 + - name: Setup environment + uses: ./.github/actions/image-setup - name: Build image run: | From bb139067c68a218df4874e4c21960e91512dd06a Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 10:20:25 +0100 Subject: [PATCH 05/16] .github/workflows: Add image-test composite action Signed-off-by: Din Music --- .github/actions/image-test/action.yml | 52 +++++++++++++++++++++++++++ .github/workflows/image-debian.yml | 41 ++++++++++++++++----- 2 files changed, 84 insertions(+), 9 deletions(-) create mode 100644 .github/actions/image-test/action.yml diff --git a/.github/actions/image-test/action.yml b/.github/actions/image-test/action.yml new file mode 100644 index 00000000..c748572f --- /dev/null +++ b/.github/actions/image-test/action.yml @@ -0,0 +1,52 @@ +name: Test Image +description: Composite action that test built image + +inputs: + target: + description: Directory where built image is located + required: true + distro: + description: Image distribution + required: true + release: + description: Image release + required: true + variant: + description: Image variant + required: true + type: + description: Image type [container, vm] + required: true + +runs: + using: composite + steps: + - name: Test image + shell: bash + run: | + TYPE=${{ inputs.type }} + TARGET=${{ inputs.target }} + DISTRO=${{ inputs.distro }} + RELEASE=${{ inputs.release }} + VARIANT=${{ inputs.variant }} + + set -e + + TEST_ID="${DISTRO}-${RELEASE}-${VARIANT} (${TYPE})" + echo "==> TEST: ${TEST_ID}" + + VIRT_ENABLED=$(lxc query /1.0 | jq '.environment.driver | contains("qemu")') + if [ ${TYPE} = "vm" ] && [ "${VIRT_ENABLED}" != "true" ]; then + echo "==> SKIP: Virtualization is not supported" + exit 0 + fi + + ./bin/test-image "${TYPE}" "${DISTRO}" "${RELEASE}" "${VARIANT}" "${TARGET}" + + if [ "$?" = "0" ]; then + echo "==> PASS: ${TEST_ID}" + exit 0 + fi + + echo "==> FAIL: ${TEST_ID}" + exit 0 diff --git a/.github/workflows/image-debian.yml b/.github/workflows/image-debian.yml index e2f7bdea..122d5700 100644 --- a/.github/workflows/image-debian.yml +++ b/.github/workflows/image-debian.yml @@ -12,8 +12,6 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - distro: - - debian release: # - buster # - bullseye @@ -27,6 +25,8 @@ jobs: # - default - cloud env: + type: "container" + distro: "${{ github.job }}" target: "${HOME}/build" steps: @@ -35,17 +35,20 @@ jobs: - name: Setup environment uses: ./.github/actions/image-setup - - name: Build image + - name: Determine image types run: | - TIMEOUT=1800 - YAML="${{ github.workspace }}/lxd-ci/images/${{ matrix.distro }}.yaml" - ARCH=${{ matrix.architecture }} - - TYPE="container" + ARCH="${{ matrix.architecture }}" if [ "${ARCH}" = "amd64" ] || [ "${ARCH}" = "arm64" ]; then - TYPE="container,vm" + echo "type=container,vm" >> $GITHUB_ENV fi + - name: Build image + run: | + TIMEOUT=1800 + YAML="${{ github.workspace }}/lxd-ci/images/${{ env.distro }}.yaml" + ARCH="${{ matrix.architecture }}" + TYPE="${{ env.type }}" + ./bin/build-distro "${YAML}" "${ARCH}" "${TYPE}" "${TIMEOUT}" "${{ env.target }}" \ -o image.architecture=${{ matrix.architecture }} \ -o image.release=${{ matrix.release }} \ @@ -54,3 +57,23 @@ jobs: - name: Print build artifacts run: ls -lah "${{ env.target }}" + + - name: Test container image + uses: ./.github/actions/image-test + if: contains(env.type, 'container') + with: + type: container + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + + - name: Test VM image + uses: ./.github/actions/image-test + if: contains(env.type, 'vm') + with: + type: vm + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} From 4b4d4c452c76bac3b24b46d50adad356a4adcabc Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 10:20:25 +0100 Subject: [PATCH 06/16] .github/workflows: Add main image workflow Signed-off-by: Din Music --- .github/workflows/image-debian.yml | 5 +---- .github/workflows/images.yml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/images.yml diff --git a/.github/workflows/image-debian.yml b/.github/workflows/image-debian.yml index 122d5700..7578d6b6 100644 --- a/.github/workflows/image-debian.yml +++ b/.github/workflows/image-debian.yml @@ -1,11 +1,8 @@ name: Build Debian Image on: - push: workflow_dispatch: - # schedule: - # # Run at 00:00 UTC daily. - # - cron: '0 0 * * *' + workflow_call: jobs: debian: diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml new file mode 100644 index 00000000..3696ab7c --- /dev/null +++ b/.github/workflows/images.yml @@ -0,0 +1,17 @@ +name: Build and test images + +on: + workflow_dispatch: + push: + pull_request: + # schedule: + # # Run at 00:00 UTC daily. + # - cron: '0 0 * * *' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + debian: + uses: ./.github/workflows/image-debian.yml From 148c207e098f31da54ccca067ab2d3d42504f839 Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 10:20:25 +0100 Subject: [PATCH 07/16] .github/workflows: Add Alpine image build Signed-off-by: Din Music --- .github/workflows/image-alpine.yml | 79 ++++++++++++++++++++++++++++++ .github/workflows/images.yml | 2 + 2 files changed, 81 insertions(+) create mode 100644 .github/workflows/image-alpine.yml diff --git a/.github/workflows/image-alpine.yml b/.github/workflows/image-alpine.yml new file mode 100644 index 00000000..e1baf255 --- /dev/null +++ b/.github/workflows/image-alpine.yml @@ -0,0 +1,79 @@ +name: Build Alpine Images + +on: + workflow_dispatch: + workflow_call: + +jobs: + alpine: + runs-on: ubuntu-latest + strategy: + matrix: + release: + # - "3.16" + # - "3.17" + # - "3.18" + - "3.19" + # - "edge" + architecture: + - amd64 + # - arm64 + variant: + # - default + - cloud + env: + type: "container" + distro: "${{ github.job }}" + target: "${HOME}/build" + + steps: + - uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/image-setup + + - name: Determine image types + run: | + ARCH="${{ matrix.architecture }}" + if [ "${ARCH}" = "amd64" ] || [ "${ARCH}" = "arm64" ]; then + echo "type=container,vm" >> $GITHUB_ENV + fi + + - name: Build image + run: | + TIMEOUT=1800 + YAML="${{ github.workspace }}/lxd-ci/images/${{ env.distro }}.yaml" + ARCH="${{ matrix.architecture }}" + TYPE="${{ env.type }}" + + IMAGE_ARCH="${ARCH}" + [ "${ARCH}" = "amd64" ] && IMAGE_ARCH="x86_64" + [ "${ARCH}" = "arm64" ] && IMAGE_ARCH="aarch64" + + ./bin/build-distro "${YAML}" "${ARCH}" "${TYPE}" "${TIMEOUT}" "${{ env.target }}" \ + -o image.architecture="${IMAGE_ARCH}" \ + -o image.release=${{ matrix.release }} \ + -o image.variant=${{ matrix.variant }} + + - name: Print build artifacts + run: ls -lah "${{ env.target }}" + + - name: Test container image + uses: ./.github/actions/image-test + if: contains(env.type, 'container') + with: + type: container + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + + - name: Test VM image + uses: ./.github/actions/image-test + if: contains(env.type, 'vm') + with: + type: vm + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 3696ab7c..29c98563 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -13,5 +13,7 @@ concurrency: cancel-in-progress: true jobs: + alpine: + uses: ./.github/workflows/image-alpine.yml debian: uses: ./.github/workflows/image-debian.yml From f04a5eb1833dcd3b327d61656be618fe0630668b Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 11:13:13 +0100 Subject: [PATCH 08/16] .github/workflows: Add Ubuntu image build Signed-off-by: Din Music --- .github/workflows/image-ubuntu.yml | 89 ++++++++++++++++++++++++++++++ .github/workflows/images.yml | 2 + 2 files changed, 91 insertions(+) create mode 100644 .github/workflows/image-ubuntu.yml diff --git a/.github/workflows/image-ubuntu.yml b/.github/workflows/image-ubuntu.yml new file mode 100644 index 00000000..77dac665 --- /dev/null +++ b/.github/workflows/image-ubuntu.yml @@ -0,0 +1,89 @@ +name: Build Ubuntu Images + +on: + workflow_dispatch: + workflow_call: + +jobs: + ubuntu: + runs-on: ubuntu-latest + strategy: + matrix: + release: + # - xenial + # - bionic + # - focal + # - jammy + # - lunar + - mantic + # - noble + architecture: + - amd64 + # - arm64 + variant: + # - default + # - desktop + - cloud + env: + type: "container" + distro: "${{ github.job }}" + target: "${HOME}/build" + + steps: + - uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/image-setup + + - name: Determine image types + run: | + ARCH="${{ matrix.architecture }}" + if [ "${ARCH}" = "amd64" ] || [ "${ARCH}" = "arm64" ]; then + echo "type=container,vm" >> $GITHUB_ENV + fi + + if [ "${{ matrix.variant }}" = "desktop" ]; then + echo "type=vm" >> $GITHUB_ENV + fi + + - name: Build image + run: | + TIMEOUT=3600 + YAML="${{ github.workspace }}/lxd-ci/images/${{ env.distro }}.yaml" + ARCH="${{ matrix.architecture }}" + TYPE="${{ env.type }}" + + ARCHIVE="http://archive.ubuntu.com/ubuntu" + if [ "${ARCH}" != "amd64" ] && [ "${ARCH}" != "i386" ]; then + ARCHIVE="http://ports.ubuntu.com/ubuntu-ports" + fi + + ./bin/build-distro "${YAML}" "${ARCH}" "${TYPE}" "${TIMEOUT}" "${{ env.target }}" \ + -o image.architecture=${{ matrix.architecture }} \ + -o image.release=${{ matrix.release }} \ + -o image.variant=${{ matrix.variant }} \ + -o source.url="${ARCHIVE}" + + - name: Print build artifacts + run: ls -lah "${{ env.target }}" + + - name: Test container image + uses: ./.github/actions/image-test + if: contains(env.type, 'container') + with: + type: container + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + + - name: Test VM image + uses: ./.github/actions/image-test + if: contains(env.type, 'vm') + with: + type: vm + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 29c98563..0159dbe3 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -17,3 +17,5 @@ jobs: uses: ./.github/workflows/image-alpine.yml debian: uses: ./.github/workflows/image-debian.yml + ubuntu: + uses: ./.github/workflows/image-ubuntu.yml From bacbfe8573150b3d038043ca285a7a88c8ab2918 Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 12:16:44 +0100 Subject: [PATCH 09/16] .github/workflows: Add image-upload composite action Signed-off-by: Din Music --- .github/actions/image-upload/action.yml | 48 +++++++++++++++++++++++++ .github/workflows/image-alpine.yml | 13 +++++++ .github/workflows/image-debian.yml | 13 +++++++ .github/workflows/image-ubuntu.yml | 12 +++++++ .github/workflows/images.yml | 2 ++ 5 files changed, 88 insertions(+) create mode 100644 .github/actions/image-upload/action.yml diff --git a/.github/actions/image-upload/action.yml b/.github/actions/image-upload/action.yml new file mode 100644 index 00000000..32fc1fa3 --- /dev/null +++ b/.github/actions/image-upload/action.yml @@ -0,0 +1,48 @@ +name: Upload Image +description: Composite action for uploading built images + +inputs: + name: + description: Final image name + required: true + target: + description: Directory where built image is located + required: true + # types: + # description: Image types + # required: true + +runs: + using: composite + steps: + # actions/upload-artifact does not expand env vars. + - name: Expand target path + shell: bash + run: echo "target=${{ inputs.target }}" >> $GITHUB_ENV + + - name: Print artifacts + shell: bash + run: ls -lah "${{ env.target }}" + + # - name: Make tarball + # id: tarball + # shell: bash + # run: | + # files=$(cd ${{ inputs.target }} && ls *.tar.xz *.qcow2 *.squashfs image.yaml serial 2> /dev/null) + # tar -czvf "${{ inputs.name }}.tar.gz" -C ${{ inputs.target }} ${files} + + - name: Publish artifacts + uses: actions/upload-artifact@v4 + with: + name: "${{ inputs.name }}" + # path: "${{ inputs.name }}.tar.gz" + path: | + ${{ env.target }}/*.qcow2 + ${{ env.target }}/*.squashfs + ${{ env.target }}/*.tar.xz + ${{ env.target }}/image.yaml + ${{ env.target }}/serial + if-no-files-found: "error" + retention-days: 1 + compression-level: 0 + overwrite: true diff --git a/.github/workflows/image-alpine.yml b/.github/workflows/image-alpine.yml index e1baf255..110e5a7e 100644 --- a/.github/workflows/image-alpine.yml +++ b/.github/workflows/image-alpine.yml @@ -3,6 +3,11 @@ name: Build Alpine Images on: workflow_dispatch: workflow_call: + inputs: + publish: + type: boolean + default: false + description: Publish built image jobs: alpine: @@ -77,3 +82,11 @@ jobs: distro: ${{ env.distro }} release: ${{ matrix.release }} variant: ${{ matrix.variant }} + + - name: Upload image + uses: ./.github/actions/image-upload + if: inputs.publish == true + with: + name: "${{ env.distro }}-${{ matrix.release }}-${{ matrix.architecture }}-${{ matrix.variant }}" + target: ${{ env.target }} + # types: ${{ env.type }} diff --git a/.github/workflows/image-debian.yml b/.github/workflows/image-debian.yml index 7578d6b6..776db7e1 100644 --- a/.github/workflows/image-debian.yml +++ b/.github/workflows/image-debian.yml @@ -3,6 +3,11 @@ name: Build Debian Image on: workflow_dispatch: workflow_call: + inputs: + publish: + type: boolean + default: false + description: Publish built image jobs: debian: @@ -74,3 +79,11 @@ jobs: distro: ${{ env.distro }} release: ${{ matrix.release }} variant: ${{ matrix.variant }} + + - name: Upload image + uses: ./.github/actions/image-upload + if: inputs.publish == true + with: + name: "${{ env.distro }}-${{ matrix.release }}-${{ matrix.architecture }}-${{ matrix.variant }}" + target: ${{ env.target }} + # types: ${{ env.type }} diff --git a/.github/workflows/image-ubuntu.yml b/.github/workflows/image-ubuntu.yml index 77dac665..a117721b 100644 --- a/.github/workflows/image-ubuntu.yml +++ b/.github/workflows/image-ubuntu.yml @@ -3,6 +3,11 @@ name: Build Ubuntu Images on: workflow_dispatch: workflow_call: + inputs: + publish: + type: boolean + default: false + description: Publish built image jobs: ubuntu: @@ -87,3 +92,10 @@ jobs: release: ${{ matrix.release }} variant: ${{ matrix.variant }} + - name: Upload image + uses: ./.github/actions/image-upload + if: inputs.publish == true + with: + name: "${{ env.distro }}-${{ matrix.release }}-${{ matrix.architecture }}-${{ matrix.variant }}" + target: ${{ env.target }} + # types: ${{ env.type }} diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 0159dbe3..119709dd 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -15,6 +15,8 @@ concurrency: jobs: alpine: uses: ./.github/workflows/image-alpine.yml + with: + publish: false debian: uses: ./.github/workflows/image-debian.yml ubuntu: From 726e0eb72e2077ad21559944f1ad37cbec949c69 Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 13:14:50 +0100 Subject: [PATCH 10/16] .github/workflows: Enable all alpine,debian, and ubuntu releases Signed-off-by: Din Music --- .github/workflows/image-alpine.yml | 10 +++++----- .github/workflows/image-debian.yml | 10 +++++----- .github/workflows/image-ubuntu.yml | 13 ++++++------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/image-alpine.yml b/.github/workflows/image-alpine.yml index 110e5a7e..12266e40 100644 --- a/.github/workflows/image-alpine.yml +++ b/.github/workflows/image-alpine.yml @@ -15,16 +15,16 @@ jobs: strategy: matrix: release: - # - "3.16" - # - "3.17" - # - "3.18" + - "3.16" + - "3.17" + - "3.18" - "3.19" - # - "edge" + - "edge" architecture: - amd64 # - arm64 variant: - # - default + - default - cloud env: type: "container" diff --git a/.github/workflows/image-debian.yml b/.github/workflows/image-debian.yml index 776db7e1..bd31123d 100644 --- a/.github/workflows/image-debian.yml +++ b/.github/workflows/image-debian.yml @@ -15,16 +15,16 @@ jobs: strategy: matrix: release: - # - buster - # - bullseye - # - sid - # - bookworm + - buster + - bullseye + - sid + - bookworm - trixie architecture: - amd64 # - arm64 variant: - # - default + - default - cloud env: type: "container" diff --git a/.github/workflows/image-ubuntu.yml b/.github/workflows/image-ubuntu.yml index a117721b..79ebacd7 100644 --- a/.github/workflows/image-ubuntu.yml +++ b/.github/workflows/image-ubuntu.yml @@ -15,19 +15,18 @@ jobs: strategy: matrix: release: - # - xenial - # - bionic - # - focal - # - jammy - # - lunar + - xenial + - bionic + - focal + - jammy - mantic # - noble architecture: - amd64 # - arm64 variant: - # - default - # - desktop + - default + - desktop - cloud env: type: "container" From eb8e7c14f7dfe720a554f3023fe7794c37a2f816 Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 14:48:34 +0100 Subject: [PATCH 11/16] .github/workflows: Do not fail fast Signed-off-by: Din Music --- .github/workflows/image-alpine.yml | 1 + .github/workflows/image-debian.yml | 1 + .github/workflows/image-ubuntu.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.github/workflows/image-alpine.yml b/.github/workflows/image-alpine.yml index 12266e40..8d4672cf 100644 --- a/.github/workflows/image-alpine.yml +++ b/.github/workflows/image-alpine.yml @@ -13,6 +13,7 @@ jobs: alpine: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: release: - "3.16" diff --git a/.github/workflows/image-debian.yml b/.github/workflows/image-debian.yml index bd31123d..e6864252 100644 --- a/.github/workflows/image-debian.yml +++ b/.github/workflows/image-debian.yml @@ -13,6 +13,7 @@ jobs: debian: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: release: - buster diff --git a/.github/workflows/image-ubuntu.yml b/.github/workflows/image-ubuntu.yml index 79ebacd7..fd1388ea 100644 --- a/.github/workflows/image-ubuntu.yml +++ b/.github/workflows/image-ubuntu.yml @@ -13,6 +13,7 @@ jobs: ubuntu: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: release: - xenial From 09994a553ee4815833215a71cb14dd6442e629ce Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 15:29:17 +0100 Subject: [PATCH 12/16] .github/workflows: Exclude some ubuntu combinations Signed-off-by: Din Music --- .github/workflows/image-ubuntu.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/image-ubuntu.yml b/.github/workflows/image-ubuntu.yml index fd1388ea..724f735c 100644 --- a/.github/workflows/image-ubuntu.yml +++ b/.github/workflows/image-ubuntu.yml @@ -29,6 +29,11 @@ jobs: - default - desktop - cloud + exclude: + - { variant: desktop, release: bionic } + - { variant: desktop, release: xenial } + - { variant: desktop, architecture: arm64 } + env: type: "container" distro: "${{ github.job }}" From d38be30c06bbe16076c17804b452abd4fc47b20d Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 15:38:03 +0100 Subject: [PATCH 13/16] .github/workflows: Add Fedora image build Signed-off-by: Din Music --- .github/workflows/image-fedora.yml | 91 ++++++++++++++++++++++++++++++ .github/workflows/images.yml | 2 + 2 files changed, 93 insertions(+) create mode 100644 .github/workflows/image-fedora.yml diff --git a/.github/workflows/image-fedora.yml b/.github/workflows/image-fedora.yml new file mode 100644 index 00000000..900a00a3 --- /dev/null +++ b/.github/workflows/image-fedora.yml @@ -0,0 +1,91 @@ +name: Build Fedora Images + +on: + workflow_dispatch: + workflow_call: + inputs: + publish: + type: boolean + default: false + description: Publish built image + +jobs: + fedora: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + release: + - 37 + - 38 + - 39 + architecture: + - amd64 + # - arm64 + variant: + - default + - cloud + env: + type: "container" + distro: "${{ github.job }}" + target: "${HOME}/build" + + steps: + - uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/image-setup + + - name: Determine image types + run: | + ARCH="${{ matrix.architecture }}" + if [ "${ARCH}" = "amd64" ] || [ "${ARCH}" = "arm64" ]; then + echo "type=container,vm" >> $GITHUB_ENV + fi + + - name: Build image + run: | + TIMEOUT=1800 + YAML="${{ github.workspace }}/lxd-ci/images/${{ env.distro }}.yaml" + ARCH="${{ matrix.architecture }}" + TYPE="${{ env.type }}" + + IMAGE_ARCH=${ARCH} + [ "${ARCH}" = "amd64" ] && IMAGE_ARCH="x86_64" + [ "${ARCH}" = "arm64" ] && IMAGE_ARCH="aarch64" + + ./bin/build-distro "${YAML}" "${ARCH}" "${TYPE}" "${TIMEOUT}" "${{ env.target }}" \ + -o image.architecture="${IMAGE_ARCH}" \ + -o image.release=${{ matrix.release }} \ + -o image.variant=${{ matrix.variant }} + + - name: Print build artifacts + run: ls -lah "${{ env.target }}" + + - name: Test container image + uses: ./.github/actions/image-test + if: contains(env.type, 'container') + with: + type: container + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + + - name: Test VM image + uses: ./.github/actions/image-test + if: contains(env.type, 'vm') + with: + type: vm + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + + - name: Upload image + uses: ./.github/actions/image-upload + if: inputs.publish == true + with: + name: "${{ env.distro }}-${{ matrix.release }}-${{ matrix.architecture }}-${{ matrix.variant }}" + target: ${{ env.target }} + # types: ${{ env.type }} diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 119709dd..38c664f1 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -19,5 +19,7 @@ jobs: publish: false debian: uses: ./.github/workflows/image-debian.yml + fedora: + uses: ./.github/workflows/image-fedora.yml ubuntu: uses: ./.github/workflows/image-ubuntu.yml From 13a9636d96732fbaf923e823fce00112a1b4d026 Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 15:44:31 +0100 Subject: [PATCH 14/16] .github/workflows: Add CentOS image build Signed-off-by: Din Music --- .github/workflows/image-centos.yml | 110 +++++++++++++++++++++++++++++ .github/workflows/images.yml | 2 + 2 files changed, 112 insertions(+) create mode 100644 .github/workflows/image-centos.yml diff --git a/.github/workflows/image-centos.yml b/.github/workflows/image-centos.yml new file mode 100644 index 00000000..fae6746a --- /dev/null +++ b/.github/workflows/image-centos.yml @@ -0,0 +1,110 @@ +name: Build CentOS Images + +on: + workflow_dispatch: + workflow_call: + inputs: + publish: + type: boolean + default: false + description: Publish built image + +jobs: + centos: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + release: + - 7 + - 8-Stream + - 9-Stream + architecture: + - amd64 + # - arm64 + variant: + - default + - cloud + env: + type: "container" + distro: "${{ github.job }}" + target: "${HOME}/build" + + steps: + - uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/image-setup + + - name: Determine image types + run: | + ARCH="${{ matrix.architecture }}" + if [ "${ARCH}" = "amd64" ]; then + echo "type=container,vm" >> $GITHUB_ENV + fi + + - name: Build image + run: | + TIMEOUT=1800 + YAML="${{ github.workspace }}/lxd-ci/images/${{ env.distro }}.yaml" + ARCH="${{ matrix.architecture }}" + TYPE="${{ env.type }}" + RELEASE="${{ matrix.release }}" + + IMAGE_ARCH=${ARCH} + [ "${ARCH}" = "amd64" ] && IMAGE_ARCH="x86_64" + [ "${ARCH}" = "arm64" ] && IMAGE_ARCH="aarch64" + + EXTRA_ARGS="" + if [ "${RELEASE}" = "7" ] && [ "${ARCH}" != "amd64" ]; then + EXTRA_ARGS="-o source.url=http://mirror.math.princeton.edu/pub/centos-altarch/ -o source.skip_verification=true" + fi + + if [ "${release}" = "7" ]; then + EXTRA_ARGS="${EXTRA_ARGS} -o packages.manager=yum" + fi + + if [ "${RELEASE}" = "8-Stream" ] || [ "${RELEASE}" = "9-Stream" ]; then + EXTRA_ARGS="${EXTRA_ARGS} -o source.variant=boot" + fi + + if [ "${RELEASE}" = "9-Stream" ]; then + EXTRA_ARGS="${EXTRA_ARGS} -o source.url=https://mirror1.hs-esslingen.de/pub/Mirrors/centos-stream" + fi + + ./bin/build-distro "${YAML}" "${ARCH}" "${TYPE}" "${TIMEOUT}" "${{ env.target }}" \ + -o image.architecture="${IMAGE_ARCH}" \ + -o image.release=${{ matrix.release }} \ + -o image.variant=${{ matrix.variant }} \ + ${EXTRA_ARGS} + + - name: Print build artifacts + run: ls -lah "${{ env.target }}" + + - name: Test container image + uses: ./.github/actions/image-test + if: contains(env.type, 'container') + with: + type: container + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + + - name: Test VM image + uses: ./.github/actions/image-test + if: contains(env.type, 'vm') + with: + type: vm + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + + - name: Upload image + uses: ./.github/actions/image-upload + if: inputs.publish == true + with: + name: "${{ env.distro }}-${{ matrix.release }}-${{ matrix.architecture }}-${{ matrix.variant }}" + target: ${{ env.target }} + # types: ${{ env.type }} diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 38c664f1..9aa692fd 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -17,6 +17,8 @@ jobs: uses: ./.github/workflows/image-alpine.yml with: publish: false + centos: + uses: ./.github/workflows/image-centos.yml debian: uses: ./.github/workflows/image-debian.yml fedora: From 76b9002901e5c0d2448a433419623253e0d5e2e6 Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 15:53:25 +0100 Subject: [PATCH 15/16] .github/workflows: Add busybox image build Signed-off-by: Din Music --- .github/workflows/image-busybox.yml | 78 +++++++++++++++++++++++++++++ .github/workflows/images.yml | 2 + 2 files changed, 80 insertions(+) create mode 100644 .github/workflows/image-busybox.yml diff --git a/.github/workflows/image-busybox.yml b/.github/workflows/image-busybox.yml new file mode 100644 index 00000000..f01ee784 --- /dev/null +++ b/.github/workflows/image-busybox.yml @@ -0,0 +1,78 @@ +name: Build BusyBox Images + +on: + workflow_dispatch: + workflow_call: + inputs: + publish: + type: boolean + default: false + description: Publish built image + +jobs: + busybox: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + release: + - 1.36.1 + architecture: + - amd64 + # - arm64 + variant: + - default + env: + type: "container" + distro: "${{ github.job }}" + target: "${HOME}/build" + + steps: + - uses: actions/checkout@v4 + + - name: Setup environment + uses: ./.github/actions/image-setup + + - name: Build image + run: | + TIMEOUT=1800 + YAML="${{ github.workspace }}/lxd-ci/images/${{ env.distro }}.yaml" + ARCH="${{ matrix.architecture }}" + TYPE="${{ env.type }}" + + ./bin/build-distro "${YAML}" "${ARCH}" "${TYPE}" "${TIMEOUT}" "${{ env.target }}" \ + -o image.architecture="${IMAGE_ARCH}" \ + -o image.release=${{ matrix.release }} \ + -o image.variant=${{ matrix.variant }} \ + ${EXTRA_ARGS} + + - name: Print build artifacts + run: ls -lah "${{ env.target }}" + + - name: Test container image + uses: ./.github/actions/image-test + if: contains(env.type, 'container') + with: + type: container + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + + - name: Test VM image + uses: ./.github/actions/image-test + if: contains(env.type, 'vm') + with: + type: vm + target: ${{ env.target }} + distro: ${{ env.distro }} + release: ${{ matrix.release }} + variant: ${{ matrix.variant }} + + - name: Upload image + uses: ./.github/actions/image-upload + if: inputs.publish == true + with: + name: "${{ env.distro }}-${{ matrix.release }}-${{ matrix.architecture }}-${{ matrix.variant }}" + target: ${{ env.target }} + # types: ${{ env.type }} diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 9aa692fd..1b06c20e 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -17,6 +17,8 @@ jobs: uses: ./.github/workflows/image-alpine.yml with: publish: false + busybox: + uses: ./.github/workflows/image-busybox.yml centos: uses: ./.github/workflows/image-centos.yml debian: From 1aaaecfb082ce45192c14a366ed472ea0cbcb7a8 Mon Sep 17 00:00:00 2001 From: Din Music Date: Fri, 16 Feb 2024 15:54:48 +0100 Subject: [PATCH 16/16] tmp: Disable working images Signed-off-by: Din Music --- .github/workflows/images.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/images.yml b/.github/workflows/images.yml index 1b06c20e..fdad7ced 100644 --- a/.github/workflows/images.yml +++ b/.github/workflows/images.yml @@ -13,17 +13,17 @@ concurrency: cancel-in-progress: true jobs: - alpine: - uses: ./.github/workflows/image-alpine.yml - with: - publish: false + # alpine: + # uses: ./.github/workflows/image-alpine.yml + # with: + # publish: false busybox: uses: ./.github/workflows/image-busybox.yml centos: uses: ./.github/workflows/image-centos.yml - debian: - uses: ./.github/workflows/image-debian.yml + # debian: + # uses: ./.github/workflows/image-debian.yml fedora: uses: ./.github/workflows/image-fedora.yml - ubuntu: - uses: ./.github/workflows/image-ubuntu.yml + # ubuntu: + # uses: ./.github/workflows/image-ubuntu.yml