Skip to content

Commit

Permalink
matrix build
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRealHaoLiu committed Feb 19, 2024
1 parent 0c1b6d3 commit 0a44289
Showing 1 changed file with 55 additions and 12 deletions.
67 changes: 55 additions & 12 deletions .github/workflows/devel_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,27 @@
name: Build/Push Development Images
env:
LC_ALL: "C.UTF-8" # prevent ERROR: Ansible could not initialize the preferred locale: unsupported locale setting
PLATFORMS: linux/amd64,linux/arm64
on:
push:
branches:
- devel
- release_*
- feature_*
jobs:
push:
if: endsWith(github.repository, '/awx') || startsWith(github.ref, 'refs/heads/release_')
push-development-images:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
packages: write
contents: read
strategy:
matrix:
platforms: [linux/amd64, linux/arm64]
build-targets:
- image-name: awx_devel
make-target: docker-compose-buildx
- image-name: awx_kube_devel
make-target: awx-kube-dev-buildx
steps:
- uses: actions/checkout@v3

Expand All @@ -25,7 +31,8 @@ jobs:

- name: Set lower case owner name
run: |
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV}
echo "DEV_DOCKER_TAG_BASE=ghcr.io/${OWNER,,}" >> $GITHUB_ENV
echo "COMPOSE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
env:
OWNER: '${{ github.repository_owner }}'

Expand All @@ -40,16 +47,52 @@ jobs:
- name: Pre-pull image to warm build cache
run: |
docker pull ghcr.io/${OWNER_LC}/awx_devel:${GITHUB_REF##*/} || :
docker pull ghcr.io/${OWNER_LC}/awx_kube_devel:${GITHUB_REF##*/} || :
docker pull ghcr.io/${OWNER_LC}/awx:${GITHUB_REF##*/} || :
docker pull --platform ${{ matrix.platforms }} ${DEV_DOCKER_TAG_BASE}/${{ matrix.build-targets.image-name }}:${COMPOSE_TAG} || :
- name: Build and push AWX development environment images
run: |
DEV_DOCKER_TAG_BASE=ghcr.io/${OWNER_LC} COMPOSE_TAG=${GITHUB_REF##*/} make docker-compose-buildx
DEV_DOCKER_TAG_BASE=ghcr.io/${OWNER_LC} COMPOSE_TAG=${GITHUB_REF##*/} make awx-kube-dev-buildx
make ${{ matrix.build-targets.make-target }}
env:
PLATFORMS: ${{ matrix.platforms }}

push-awx-image:
if: endsWith(github.repository, '/awx')
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
packages: write
contents: read
strategy:
matrix:
platforms: [linux/amd64, linux/arm64]
steps:
- uses: actions/checkout@v3

- name: Get python version from Makefile
run: echo py_version=`make PYTHON_VERSION` >> $GITHUB_ENV

- name: Build and push images AWX images
- name: Set lower case owner name
run: |
DEV_DOCKER_TAG_BASE=ghcr.io/${OWNER_LC} COMPOSE_TAG=${GITHUB_REF##*/} make awx-kube-buildx
if: endsWith(github.repository, '/awx')
echo "DEV_DOCKER_TAG_BASE=ghcr.io/${OWNER,,}" >> $GITHUB_ENV
echo "COMPOSE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
env:
OWNER: '${{ github.repository_owner }}'

- name: Install python ${{ env.py_version }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.py_version }}

- name: Log in to registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Pre-pull image to warm build cache
run: |
docker pull --platform ${{ matrix.platforms }} ${DEV_DOCKER_TAG_BASE}/awx:${COMPOSE_TAG} || :
- name: Build and push AWX images
run: |
make awx-kube-buildx
env:
PLATFORMS: ${{ matrix.platforms }}

0 comments on commit 0a44289

Please sign in to comment.