diff --git a/.github/workflows/bbw_build_container_release.yml b/.github/workflows/bbw_build_container_release.yml deleted file mode 100644 index 7ffe1e51..00000000 --- a/.github/workflows/bbw_build_container_release.yml +++ /dev/null @@ -1,150 +0,0 @@ ---- -name: bbw-build-container-release - -on: - push: - paths: - - .github/workflows/bbw_build_container_release.yml - - "ci_build_images/**" - pull_request: - paths: - - .github/workflows/bbw_build_container_release.yml - - "ci_build_images/**" - -jobs: - build: - runs-on: 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: debian-release.Dockerfile - image: debian:12-slim - tag: debian12-release - platforms: linux/amd64 - 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 }} buildbot-worker.Dockerfile >$GITHUB_WORKSPACE/Dockerfile - cp -r qpress $GITHUB_WORKSPACE - - 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: Make sure that time is in sync - run: | - # RHEL subscription needs that time and date - # is correct and is syncing with an NTP-server - # https://access.redhat.com/discussions/672313#comment-2360508 - sudo chronyc -a makestep - - 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 mariadb_branch=${{ matrix.branch }} - 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 - 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 }} diff --git a/.github/workflows/build-container-release.yml b/.github/workflows/build-container-release.yml new file mode 100644 index 00000000..f305c678 --- /dev/null +++ b/.github/workflows/build-container-release.yml @@ -0,0 +1,35 @@ +name: Build container release + +on: + push: + paths: + - 'ci_build_images/debian-release.Dockerfile' + - 'ci_build_images/qpress.Dockerfile' + - 'ci_build_images/buildbot-worker.Dockerfile' + - .github/workflows/build-container-release.yml + - .github/workflows/bbw_build_container_template.yml + pull_request: + paths: + - 'ci_build_images/debian-release.Dockerfile' + - 'ci_build_images/qpress.Dockerfile' + - 'ci_build_images/buildbot-worker.Dockerfile' + - .github/workflows/build-container-release.yml + - .github/workflows/bbw_build_container_template.yml + workflow_call: + +jobs: + build-images: + strategy: + fail-fast: false + matrix: + include: + - image: debian:12-slim + platforms: linux/amd64 + tag: debian12-release + uses: ./.github/workflows/bbw_build_container_template.yml + with: + dockerfile: debian-release.Dockerfile + image: ${{ matrix.image }} + platforms: ${{ matrix.platforms }} + tag: ${{ matrix.tag }} + secrets: inherit diff --git a/.github/workflows/build-workflow-dispatcher.yml b/.github/workflows/build-workflow-dispatcher.yml index 6d1ba3a3..29d83f6f 100644 --- a/.github/workflows/build-workflow-dispatcher.yml +++ b/.github/workflows/build-workflow-dispatcher.yml @@ -53,6 +53,11 @@ on: required: true default: false type: boolean + build-release-container: + description: 'Build release container' + required: true + default: false + type: boolean jobs: build-centos-based: @@ -95,3 +100,7 @@ jobs: if: ${{ inputs.build-slespip-based }} uses: ./.github/workflows/build-sles.pip-based.yml secrets: inherit + build-release-container: + if: ${{ inputs.build-release-container }} + uses: ./.github/workflows/build-container-release.yml + secrets: inherit diff --git a/ci_build_images/debian-release.Dockerfile b/ci_build_images/debian-release.Dockerfile index 06fb7d43..8cb202da 100644 --- a/ci_build_images/debian-release.Dockerfile +++ b/ci_build_images/debian-release.Dockerfile @@ -3,8 +3,8 @@ # Provides a base Debian image with latest buildbot worker installed for prep # release works. -ARG base_image -FROM "$base_image" +ARG BASE_IMAGE +FROM "$BASE_IMAGE" LABEL maintainer="MariaDB Buildbot maintainers" # This will make apt-get install without question