Skip to content

tidy code, make ruby 2.5 compatible #44

tidy code, make ruby 2.5 compatible

tidy code, make ruby 2.5 compatible #44

Workflow file for this run

name: Build all images
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
defaults:
run:
shell: bash
jobs:
define-matrix:
runs-on: ubuntu-latest
outputs:
distros: ${{ steps.distros.outputs.distros }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Define Distros
id: distros
run: echo "distros=[$(awk -F= '/DEFAULT_DISTROS/{print $2}' ./internal/lib/distro_info.sh | sed -e 's/ /", "/g')]" >> "$GITHUB_OUTPUT"
build-buildbox:
strategy:
fail-fast: false
matrix:
arch:
- name: amd64
runner: ubuntu-24.04
- name: arm64
runner: ubuntu-24.04-arm
name: build buildbox-${{ matrix.arch.name }}
runs-on: ${{ matrix.arch.runner }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Prepare
run: |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
echo "BUILDBOX_IMAGE_VERSION=$(./internal/lib/docker_image_info.sh buildbox_version)" >> $GITHUB_ENV
echo "BUILDBOX_IMAGE_NAME=$(./internal/lib/docker_image_info.sh buildbox_name)" >> $GITHUB_ENV
env:
platform: linux/${{ matrix.arch.name }}
- name: Docker meta
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf
with:
images: |
${{ env.BUILDBOX_IMAGE_NAME }}
tags: |
type=raw,value=${{ env.BUILDBOX_IMAGE_VERSION }}-${{ matrix.arch.name }}
type=edge,enable=true,priority=700,prefix=,suffix=${{ matrix.arch.name }},branch=$repo.default_branch
- name: Login to GHCR
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
- name: Build and push by tag
id: build
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f
with:
context: ./docker-images/buildbox
file: ./docker-images/buildbox/Dockerfile
platforms: linux/${{ matrix.arch.name }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
outputs: "type=image,name=${{ env.BUILDBOX_IMAGE_NAME }},push-by-digest=false,name-canonical=true,push=${{ github.event_name == 'pull_request' && 'false' || 'true' }}"
- name: Export digest
if: github.event_name != 'pull_request'
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: github.event_name != 'pull_request'
with:
name: digests-buildbox-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
build-testboxes:
needs: define-matrix
strategy:
fail-fast: false
matrix:
distro: ${{ fromJSON(needs.define-matrix.outputs.distros) }}
arch:
- name: amd64
runner: ubuntu-24.04
- name: arm64
runner: ubuntu-24.04-arm
name: build testbox ${{ matrix.distro }}-${{ matrix.arch.name }}
runs-on: ${{ matrix.arch.runner }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Prepare
run: |
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
echo "TESTBOX_IMAGE_VERSION=$(./internal/lib/docker_image_info.sh testbox_version)" >> $GITHUB_ENV
echo "TESTBOX_IMAGE_NAME=$(./internal/lib/docker_image_info.sh testbox_base_name)_rocky_${distro##el}" >> $GITHUB_ENV
echo "DISTRO_NUM=${distro##el}" >> $GITHUB_ENV
env:
platform: linux/${{ matrix.arch.name }}
distro: ${{ matrix.distro }}
- name: Docker meta
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf
with:
images: |
${{ env.TESTBOX_IMAGE_NAME }}
tags: |
type=raw,value=${{ env.TESTBOX_IMAGE_VERSION }}-${{ matrix.arch.name }}
type=edge,enable=true,priority=700,prefix=,suffix=${{ matrix.arch.name }},branch=$repo.default_branch
- name: Login to GHCR
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121
if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
- name: Build and push by tag
id: build
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f
with:
context: ./docker-images/testbox-rocky-${{ env.DISTRO_NUM }}
file: ./docker-images/testbox-rocky-${{ env.DISTRO_NUM }}/Dockerfile
platforms: linux/${{ matrix.arch.name }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
outputs: "type=image,name=${{ env.TESTBOX_IMAGE_NAME }},push-by-digest=false,name-canonical=true,push=${{ github.event_name == 'pull_request' && 'false' || 'true' }}"
- name: Export digest
if: github.event_name != 'pull_request'
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
if: github.event_name != 'pull_request'
with:
name: digests-${{ matrix.distro }}-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
merge-buildbox:
runs-on: ubuntu-latest
needs:
- build-buildbox
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Prepare env
run: |
echo "BUILDBOX_IMAGE_VERSION=$(./internal/lib/docker_image_info.sh buildbox_version)" >> $GITHUB_ENV
echo "BUILDBOX_IMAGE_NAME=$(./internal/lib/docker_image_info.sh buildbox_name)" >> $GITHUB_ENV
- name: Login to GHCR
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
- name: Download digests
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
path: /tmp/digests
pattern: digests-buildbox-*
merge-multiple: true
- name: Docker meta
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf
with:
images: |
${{ env.BUILDBOX_IMAGE_NAME }}
tags: |
type=raw,value=${{ env.BUILDBOX_IMAGE_VERSION }}
type=raw,value=latest
type=edge,enable=true,priority=700,prefix=,suffix=,branch=$repo.default_branch
- name: Create manifest list and push
working-directory: /tmp/digests
run: docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") $(printf '${{ env.BUILDBOX_IMAGE_NAME }}@sha256:%s ' *)
- name: Inspect image
run: docker buildx imagetools inspect ${{ env.BUILDBOX_IMAGE_NAME }}:${{ steps.meta.outputs.version }}
merge-testboxes:
name: Merge ${{ matrix.distro }} Testbox images
runs-on: ubuntu-latest
needs:
- define-matrix
- build-testboxes
strategy:
fail-fast: false
matrix:
distro: ${{ fromJSON(needs.define-matrix.outputs.distros) }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: Prepare env
run: |
echo "TESTBOX_IMAGE_VERSION=$(./internal/lib/docker_image_info.sh testbox_version)" >> $GITHUB_ENV
echo "TESTBOX_IMAGE_NAME=$(./internal/lib/docker_image_info.sh testbox_base_name)_rocky_${distro##el}" >> $GITHUB_ENV
echo "DISTRO_NUM=${distro##el}" >> $GITHUB_ENV
env:
distro: ${{ matrix.distro }}
- name: Login to GHCR
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd
- name: Download digests
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
path: /tmp/digests
pattern: digests-${{ matrix.distro }}-*
merge-multiple: true
- name: Docker meta
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf
with:
images: |
${{ env.TESTBOX_IMAGE_NAME }}
tags: |
type=raw,value=${{ env.TESTBOX_IMAGE_VERSION }}
type=raw,value=latest
type=edge,enable=true,priority=700,prefix=,suffix=,branch=$repo.default_branch
- name: Create manifest list and push
working-directory: /tmp/digests
run: docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") $(printf '${{ env.TESTBOX_IMAGE_NAME }}@sha256:%s ' *)
- name: Inspect image
run: docker buildx imagetools inspect ${{ env.TESTBOX_IMAGE_NAME }}:${{ steps.meta.outputs.version }}