Skip to content

bbw-build-container #40

bbw-build-container

bbw-build-container #40

---
name: bbw-build-container
on:
push:
paths:
- .github/workflows/bbw_build_container.yml
- "ci_build_images/**"
pull_request:
paths:
- .github/workflows/bbw_build_container.yml
- "ci_build_images/**"
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.runner || 'ubuntu-22.04' }}
services:
registry:
image: registry:2
ports:
- 5000:5000
name: ${{ matrix.image }} (${{ matrix.tag }} ${{ matrix.platforms }})
strategy:
fail-fast: false
matrix:
include:
# - dockerfile: centos.Dockerfile
# image: almalinux:8
# platforms: linux/amd64, linux/arm64/v8
# - dockerfile: centos.Dockerfile pip.Dockerfile
# image: almalinux:9
# platforms: linux/amd64, linux/arm64/v8
# - dockerfile: debian.Dockerfile
# image: debian:11
# branch: 10.11
# platforms: linux/amd64, linux/arm64/v8, linux/ppc64le
# - dockerfile: debian.Dockerfile
# image: debian:12
# tag: debian12
# branch: 10.11
# platforms: linux/amd64, linux/arm64/v8, linux/ppc64le
# - dockerfile: debian.Dockerfile
# image: debian:12
# tag: debian12-386
# branch: 10.11
# platforms: linux/386
# - dockerfile: debian.Dockerfile aocc.Dockerfile
# image: debian:11
# tag: debian11-aocc
# branch: 10.11
# platforms: linux/amd64
# - dockerfile: debian.Dockerfile msan.Dockerfile
# image: debian:11
# branch: 10.11
# tag: debian11-msan
# clang_version: 15
# platforms: linux/amd64
# - dockerfile: debian.Dockerfile msan.Dockerfile
# image: debian:11
# branch: 10.11
# tag: debian11-msan-clang-16
# clang_version: 16
# platforms: linux/amd64
# - dockerfile: debian.Dockerfile
# image: debian:sid
# branch: 10.11
# platforms: linux/amd64, linux/arm64/v8, linux/ppc64le
# - dockerfile: debian.Dockerfile
# image: debian:sid
# tag: debiansid-386
# branch: 10.11
# platforms: linux/386
# - dockerfile: debian.Dockerfile
# image: ubuntu:20.04
# branch: 10.11
# platforms: linux/amd64, linux/arm64/v8, linux/ppc64le, linux/s390x
# - dockerfile: debian.Dockerfile
# image: ubuntu:22.04
# branch: 10.11
# platforms: linux/amd64, linux/arm64/v8, linux/ppc64le, linux/s390x
# - dockerfile: debian.Dockerfile
# image: ubuntu:23.10
# branch: 10.11
# platforms: linux/amd64, linux/arm64/v8
# - dockerfile: debian.Dockerfile
# image: ubuntu:24.04
# branch: 10.11
# platforms: linux/amd64, linux/arm64/v8, linux/ppc64le, linux/s390x
# - dockerfile: fedora.Dockerfile
# image: fedora:38
# platforms: linux/amd64, linux/arm64/v8
# - dockerfile: fedora.Dockerfile
# image: fedora:39
# platforms: linux/amd64, linux/arm64/v8
# - dockerfile: fedora.Dockerfile
# image: fedora:40
# platforms: linux/amd64, linux/arm64/v8
# - dockerfile: fedora.Dockerfile
# image: fedora:40
# tag: fedora40-valgrind
# platforms: linux/amd64
# install_valigrind: "true"
# - dockerfile: centos7.Dockerfile pip.Dockerfile
# image: centos:7
# platforms: linux/amd64
# - dockerfile: centos.Dockerfile pip.Dockerfile
# image: quay.io/centos/centos:stream9
# tag: centosstream9
# runner: ubuntu-24.04
# platforms: linux/amd64, linux/arm64/v8, linux/ppc64le
# //TEMP chicken/egg problem - could add s390x
# but that would need a galera-4 build from on this image
- dockerfile: opensuse.Dockerfile pip.Dockerfile
image: opensuse/leap:15.6
tag: opensuse15
platforms: linux/amd64
- dockerfile: sles.Dockerfile pip.Dockerfile
image: registry.suse.com/bci/bci-base:15.6
tag: sles15
platforms: linux/amd64, linux/s390x
# - dockerfile: centos.Dockerfile
# image: rockylinux:8
# platforms: linux/amd64, linux/arm64/v8
# - dockerfile: centos.Dockerfile pip.Dockerfile
# image: rockylinux:9
# platforms: linux/amd64, linux/arm64/v8
# - dockerfile: debian.Dockerfile jepsen-mariadb.Dockerfile
# image: ubuntu:22.04
# branch: 10.11
# platforms: linux/amd64
# tag: ubuntu22.04-jepsen-mariadb
env:
BUILD_RHEL: false
DEPLOY_IMAGES: false
WORKDIR: ci_build_images
steps:
- uses: actions/checkout@v4
- name: Set up env vars
run: |
set -vx
[[ -n "${{ matrix.image }}" ]] || {
echo "Missing base image (FROM)"
exit 1
}
if [[ -n "${{ matrix.tag }}" ]]; then
echo "IMG=${{ matrix.tag }}" >>$GITHUB_ENV
else
TAG_TMP=${{ matrix.image }}
echo "IMG=${TAG_TMP/:/}" >>$GITHUB_ENV
fi
echo "REPO=bb-worker" >>$GITHUB_ENV
- name: Generate Dockerfile and necessary files
run: |
cd ${{ env.WORKDIR }}
cat ${{ matrix.dockerfile }} qpress.Dockerfile buildbot-worker.Dockerfile >$GITHUB_WORKSPACE/Dockerfile
cp -r qpress $GITHUB_WORKSPACE
- name: opensuse extra
if: contains(matrix.tag, 'opensuse') || contains(matrix.tag, 'sles')
run: |
cp ${{ env.WORKDIR }}/mariadb_zypper_expect $GITHUB_WORKSPACE
- name: No wsrep on 32 bit platforms
if: >
(contains(matrix.platforms, 'linux/386'))
run: |
sed -i -e '/WSREP_PROVIDER/d' $GITHUB_WORKSPACE/Dockerfile
- name: Check Dockerfile with hadolint
run: |
docker run -i -v $(pwd):/mnt -w /mnt ghcr.io/hadolint/hadolint:latest hadolint /mnt/Dockerfile
- name: Install qemu-user-static
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build image
run: |
podman manifest create ${{ env.REPO }}:${{ env.IMG }}
for arch in $(echo ${{ matrix.platforms }} | sed 's/,/ /g'); do
msg="Build $arch:"
line="${msg//?/=}"
printf "\n${line}\n${msg}\n${line}\n"
podman buildx build --tag ${{ env.REPO }}:${{ env.IMG }}-${arch//\//-} \
--platform $arch \
--manifest ${{ env.REPO }}:${{ env.IMG }} \
-f $GITHUB_WORKSPACE/Dockerfile \
--build-arg BASE_IMAGE=${{ matrix.image }} \
--build-arg CLANG_VERSION=${{ matrix.clang_version }} \
--build-arg MARIADB_BRANCH=${{ matrix.branch }} \
--build-arg INSTALL_VALGRIND="${{ matrix.install_valigrind }}"
done
podman images
- name: Push images to local registry
run: |
podman manifest push --tls-verify=0 \
--all ${{ env.REPO }}:${{ env.IMG }} \
docker://localhost:5000/${{ env.REPO }}:${{ env.IMG }}
- name: Check multi-arch container
run: |
# make some space on the runner
if [[ -d $HOME/.local/share/containers ]]; then
sudo rm -rf $HOME/.local/share/containers
fi
for p in ${{ matrix.platforms }}; do
platform="${p/,/}"
image="localhost:5000/bb-worker:${{ env.IMG }}"
msg="Testing docker image $image on platform $platform"
line="${msg//?/=}"
printf "\n${line}\n${msg}\n${line}\n"
docker pull -q --platform "$platform" "$image"
docker run -i "$image" buildbot-worker --version
docker run -i "$image" dumb-init twistd --pidfile= -y /home/buildbot/buildbot.tac
docker run -u root -i "$image" bash -c "touch /tmp/foo && qpress -r /tmp /root/qpress.qp"
done
- name: Check for registry credentials
run: |
missing=()
[[ -n "${{ secrets.QUAY_USER }}" ]] || missing+=(QUAY_USER)
[[ -n "${{ secrets.QUAY_TOKEN }}" ]] || missing+=(QUAY_TOKEN)
for i in "${missing[@]}"; do
echo "Missing github secret: $i"
done
if (( ${#missing[@]} == 0 )); then
echo "DEPLOY_IMAGES=true" >> $GITHUB_ENV
else
echo "Not pushing images to registry"
fi
- name: Login to ghcr.io
if: ${{ env.DEPLOY_IMAGES == 'true' }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push images to ghcr.io
if: ${{ env.DEPLOY_IMAGES == 'true' }}
run: |
msg="Push docker image to ghcr.io (${{ env.IMG }})"
line="${msg//?/=}"
printf "\n${line}\n${msg}\n${line}\n"
skopeo copy --all --src-tls-verify=0 \
docker://localhost:5000/${{ env.REPO }}:${{ env.IMG }} \
docker://ghcr.io/${GITHUB_REPOSITORY,,}/${{ env.REPO }}:${{ env.IMG }}
- name: Login to registry
if: ${{ env.DEPLOY_IMAGES == 'true' }}
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Push images to quay.io
if: ${{ env.DEPLOY_IMAGES == 'true' }}
run: |
msg="Push docker image to quay.io (${{ env.IMG }})"
line="${msg//?/=}"
printf "\n${line}\n${msg}\n${line}\n"
skopeo copy --all --src-tls-verify=0 \
docker://localhost:5000/${{ env.REPO }}:${{ env.IMG }} \
docker://quay.io/mariadb-foundation/${{ env.REPO }}:${{ env.IMG }}