feat: add new ansible build matrix #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build legacy image | |
on: | |
push: | |
branches-ignore: [main, future] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: π· ${{ matrix.folder }} image on ${{ matrix.arch }} | |
strategy: | |
fail-fast: false | |
max-parallel: 2 # ECR has pretty aggressive rate limiting πͺ | |
matrix: | |
folder: [base, aws, gcp] | |
arch: [amd64, arm64] | |
env: | |
IMAGE_NAME: ansible-test-${{ matrix.folder }}-${{ matrix.arch }}:${{ github.sha }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@main | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
if: matrix.arch == 'arm64' | |
with: | |
platforms: linux/arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build the ${{ matrix.folder }} image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ matrix.folder }} | |
build-args: | | |
REPOSITORY_BASE_PATH=${{ secrets.PUBLIC_RUNNER_ANSIBLE_ECR_REPOSITORY_URL }} | |
push: false | |
load: true | |
platforms: linux/${{ matrix.arch }} | |
tags: ${{ env.IMAGE_NAME }} | |
- name: Test if ansible and Python binary works | |
run: | | |
docker run --rm ${{ env.IMAGE_NAME }} ansible --version | |
docker run --rm ${{ env.IMAGE_NAME }} ansible-playbook --help | |
docker run --rm ${{ env.IMAGE_NAME }} ansible-galaxy --version | |
docker run --rm ${{ env.IMAGE_NAME }} ansible-runner --version | |
if [ "${{ matrix.folder }}" == "aws" ]; then | |
docker run --rm ${{ env.IMAGE_NAME }} sh -c "python3 -c \"import boto3; print(boto3.__version__)\"" | |
fi | |
if [ "${{ matrix.folder }}" == "gcp" ]; then | |
docker run --rm ${{ env.IMAGE_NAME }} sh -c "python3 -c \"import google.auth; print(google.auth.__version__)\"" | |
fi |