diff --git a/.github/workflows/devel_images.yml b/.github/workflows/devel_images.yml index bbb868200d87..18e564098e0f 100644 --- a/.github/workflows/devel_images.yml +++ b/.github/workflows/devel_images.yml @@ -2,7 +2,6 @@ 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: @@ -10,13 +9,20 @@ on: - 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 @@ -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 }}' @@ -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 }}