Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: split arm and x86 build to build on special voxpupuli runner #43

Merged
merged 19 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 50 additions & 3 deletions .github/workflows/build_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- id: set-matrix
run: echo "matrix=$(jq -c . build_versions.json)" >> $GITHUB_OUTPUT

build-and-push-container:
runs-on: ubuntu-latest
build-X86-container:
runs-on: macarne
permissions:
contents: read
packages: write
Expand All @@ -49,7 +49,48 @@ jobs:
APK_YAMLLINT=${{ matrix.apk_yamllint }}
APK_GIT=${{ matrix.apk_git }}
APK_CURL=${{ matrix.apk_curl }}
build_arch: linux/amd64,linux/arm64
build_arch: linux/amd64
docker_username: voxpupulibot
docker_password: ${{ secrets.DOCKERHUB_BOT_PASSWORD }}
tags: |
ghcr.io/voxpupuli/voxbox:${{ matrix.rubygem_puppet }}-${{ github.ref_name }}
ghcr.io/voxpupuli/voxbox:${{ matrix.puppet_release }}-${{ github.ref_name }}
ghcr.io/voxpupuli/voxbox:${{ matrix.puppet_release }}
ghcr.io/voxpupuli/voxbox:latest
docker.io/voxpupuli/voxbox:${{ matrix.rubygem_puppet }}-${{ github.ref_name }}
docker.io/voxpupuli/voxbox:${{ matrix.puppet_release }}-${{ github.ref_name }}
docker.io/voxpupuli/voxbox:${{ matrix.puppet_release }}
docker.io/voxpupuli/voxbox:latest

build-ARM-container:
runs-on: hetzner-arm
permissions:
contents: read
packages: write
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
steps:
- name: Build Vox Pupuli Test Box r${{ matrix.puppet_release }}
uses: voxpupuli/gha-build-and-publish-a-container@v2
with:
registry_password: ${{ secrets.GITHUB_TOKEN }}
build_args: |
BASE_IMAGE=${{ matrix.base_image }}
RUBYGEM_PUPPET=${{ matrix.rubygem_puppet }}
RUBYGEM_FACTER=${{ matrix.facter_version }}
RUBYGEM_VOXPUPULI_TEST=${{ matrix.rubygem_voxpupuli_test }}
RUBYGEM_VOXPUPULI_ACCEPTANCE=${{ matrix.rubygem_voxpupuli_acceptance }}
RUBYGEM_VOXPUPULI_RELEASE=${{ matrix.rubygem_voxpupuli_release }}
RUBYGEM_PUPPET_METADATA=${{ matrix.rubygem_puppet_metadata }}
RUBYGEM_MODULESYNC=${{ matrix.rubygem_modulesync }}
RUBYGEM_RUBOCOP_PERFORMANCE=${{ matrix.rubygem_rubocop_performance }}
RUBYGEM_BUNDLER=${{ matrix.rubygem_bundler }}
APK_JQ=${{ matrix.apk_jq }}
APK_YAMLLINT=${{ matrix.apk_yamllint }}
APK_GIT=${{ matrix.apk_git }}
APK_CURL=${{ matrix.apk_curl }}
build_arch: linux/arm64
docker_username: voxpupulibot
docker_password: ${{ secrets.DOCKERHUB_BOT_PASSWORD }}
tags: |
Expand All @@ -62,6 +103,12 @@ jobs:
docker.io/voxpupuli/voxbox:${{ matrix.puppet_release }}
docker.io/voxpupuli/voxbox:latest

update-dockerhub-description:
runs-on: ubuntu-latest
needs:
- build-X86-container
- build-ARM-container
steps:
- name: Update Docker Hub Description
uses: peter-evans/dockerhub-description@v4
with:
Expand Down
85 changes: 72 additions & 13 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
- id: set-matrix
run: echo "matrix=$(jq -c . build_versions.json)" >> $GITHUB_OUTPUT

build_test_container:
name: 'Build test container'
runs-on: ubuntu-latest
build-x86-container:
name: 'Build x86 CI container'
runs-on: macarne
permissions:
actions: read
contents: read
Expand Down Expand Up @@ -62,19 +62,78 @@ jobs:

- name: Test container
run: |
docker run --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile -T
docker run --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile lint
docker run --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile metadata_lint
docker run --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile strings:validate:reference
docker run --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile rubocop
docker run --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile syntax
docker run --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile spec
docker run --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:syntax
docker run --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:dependencies
# get ids from runner user
RUNNER_UID=$(id -u)
RUNNER_GID=$(id -g)
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile -T
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile lint
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile metadata_lint
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile strings:validate:reference
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile rubocop
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile syntax
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile spec
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:syntax
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:dependencies

build-ARM-container:
name: 'Build ARM CI container'
runs-on: hetzner-arm
permissions:
actions: read
contents: read
needs: setup-matrix
strategy:
matrix: ${{ fromJson(needs.setup-matrix.outputs.matrix) }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build image
uses: docker/build-push-action@v6
with:
tags: 'ci/voxbox:${{ matrix.rubygem_puppet }}'
push: false
platforms: linux/arm64
build-args: |
BASE_IMAGE=${{ matrix.base_image }}
RUBYGEM_PUPPET=${{ matrix.rubygem_puppet }}
RUBYGEM_FACTER=${{ matrix.facter_version }}
RUBYGEM_VOXPUPULI_TEST=${{ matrix.rubygem_voxpupuli_test }}
RUBYGEM_VOXPUPULI_ACCEPTANCE=${{ matrix.rubygem_voxpupuli_acceptance }}
RUBYGEM_VOXPUPULI_RELEASE=${{ matrix.rubygem_voxpupuli_release }}
RUBYGEM_PUPPET_METADATA=${{ matrix.rubygem_puppet_metadata }}
RUBYGEM_OVERCOMMIT=${{ matrix.rubygem_overcommit }}
RUBYGEM_MODULESYNC=${{ matrix.rubygem_modulesync }}
RUBYGEM_BUNDLER=${{ matrix.rubygem_bundler }}
APK_JQ=${{ matrix.apk_jq }}
APK_YAMLLINT=${{ matrix.apk_yamllint }}
APK_GIT=${{ matrix.apk_git }}
APK_CURL=${{ matrix.apk_curl }}

- name: Clone voxpupuli/puppet-example repository
uses: actions/checkout@v4
with:
repository: voxpupuli/puppet-example

- name: Test container
run: |
# get ids from runner user
RUNNER_UID=$(id -u)
RUNNER_GID=$(id -g)
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile -T
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile lint
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile metadata_lint
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile strings:validate:reference
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile rubocop
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile syntax
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile spec
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:syntax
docker run --user ${RUNNER_UID}:${RUNNER_GID} --rm -v $(pwd):/repo ci/voxbox:${{ matrix.rubygem_puppet }} -f /Rakefile r10k:dependencies

tests:
needs:
- build_test_container
- build-x86-container
- build-ARM-container
runs-on: ubuntu-latest
name: Test suite
steps:
Expand Down
Loading