Skip to content

Build CentOS Images #11

Build CentOS Images

Build CentOS Images #11

Workflow file for this run

name: Build CentOS Images
on:
schedule:
# Run at 00:00 UTC daily.
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
publish:
type: boolean
default: false
description: Publish built image
jobs:
centos:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
release:
- 7 # CentOS 7 tests require cgroups v1. They will pass on ubuntu-20.04 runner.
- 8-Stream
- 9-Stream
variant:
- default
- cloud
architecture:
- amd64
# - arm64
env:
type: "container"
distro: "${{ github.job }}"
target: "${HOME}/build"
steps:
- uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/image-setup
with:
ssh-key: ${{ secrets.LXD_IMAGEBUILDER_KEY }}
- 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 }}/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: github.event_name == 'schedule' || inputs.publish == true
with:
target: ${{ env.target }}
image_dir: "${{ env.distro }}/${{ matrix.release }}/${{ matrix.architecture }}/${{ matrix.variant }}"
ssh_private_key: "${{ secrets.LXD_INFRA_IMAGES_KEY }}"