From 376a791052eb14bfc20160e3e65d098d6fc3326b Mon Sep 17 00:00:00 2001 From: Hao Liu <44379968+TheRealHaoLiu@users.noreply.github.com> Date: Mon, 17 Feb 2025 16:26:19 -0500 Subject: [PATCH] [CI][release_4.6] backport push development image base on repo name (#6837) * Publish image base on git repo name instead of hard coded to AWX (#15828) * Fix git credential for devel_image build (#15834) * Continue if pre-warm cache fail in container build (#15835) * Use correct devel image for docker-compose (#15836) --- .github/actions/awx_devel_image/action.yml | 6 +++++- .github/workflows/devel_images.yml | 2 +- Makefile | 9 +++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/actions/awx_devel_image/action.yml b/.github/actions/awx_devel_image/action.yml index e0d061620a..96cda9288a 100644 --- a/.github/actions/awx_devel_image/action.yml +++ b/.github/actions/awx_devel_image/action.yml @@ -33,7 +33,11 @@ runs: - name: Pre-pull latest devel image to warm cache shell: bash - run: docker pull -q ghcr.io/${OWNER_LC}/awx_devel:${{ github.base_ref }} + run: | + DEV_DOCKER_TAG_BASE=ghcr.io/${OWNER_LC} \ + COMPOSE_TAG=${{ github.base_ref || github.ref_name }} \ + docker pull -q `make print-DEVEL_IMAGE_NAME` + continue-on-error: true - name: Build image for current source checkout shell: bash diff --git a/.github/workflows/devel_images.yml b/.github/workflows/devel_images.yml index 07050a52f7..17e2752687 100644 --- a/.github/workflows/devel_images.yml +++ b/.github/workflows/devel_images.yml @@ -88,7 +88,7 @@ jobs: - name: Add private GitHub token to requirements_git.credentials.txt shell: bash - run: echo "https://x-access-token:${{ secrets.PRIVATE_GITHUB_TOKEN }}@github.com"" >> requirements/requirements_git.credentials.txt + run: echo "https://x-access-token:${{ secrets.PRIVATE_GITHUB_TOKEN }}@github.com" >> requirements/requirements_git.credentials.txt if: ${{ env.CI_PRIVATE_GITHUB_TOKEN != '' }} - name: Build and push AWX devel images diff --git a/Makefile b/Makefile index 91f11a1aeb..bab5d27c95 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ NODE ?= node NPM_BIN ?= npm KIND_BIN ?= $(shell which kind) CHROMIUM_BIN=/tmp/chrome-linux/chrome +GIT_REPO_NAME ?= $(shell basename `git rev-parse --show-toplevel`) GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) MANAGEMENT_COMMAND ?= awx-manage VERSION ?= $(shell $(PYTHON) tools/scripts/scm_version.py 2> /dev/null) @@ -62,9 +63,9 @@ DEV_DOCKER_OWNER ?= ansible # Docker will only accept lowercase, so github names like Paul need to be paul DEV_DOCKER_OWNER_LOWER = $(shell echo $(DEV_DOCKER_OWNER) | tr A-Z a-z) DEV_DOCKER_TAG_BASE ?= ghcr.io/$(DEV_DOCKER_OWNER_LOWER) -DEVEL_IMAGE_NAME ?= $(DEV_DOCKER_TAG_BASE)/awx_devel:$(COMPOSE_TAG) -IMAGE_KUBE_DEV=$(DEV_DOCKER_TAG_BASE)/awx_kube_devel:$(COMPOSE_TAG) -IMAGE_KUBE=$(DEV_DOCKER_TAG_BASE)/awx:$(COMPOSE_TAG) +DEVEL_IMAGE_NAME ?= $(DEV_DOCKER_TAG_BASE)/$(GIT_REPO_NAME)_devel:$(COMPOSE_TAG) +IMAGE_KUBE_DEV=$(DEV_DOCKER_TAG_BASE)/$(GIT_REPO_NAME)_kube_devel:$(COMPOSE_TAG) +IMAGE_KUBE=$(DEV_DOCKER_TAG_BASE)/$(GIT_REPO_NAME):$(COMPOSE_TAG) # Common command to use for running ansible-playbook ANSIBLE_PLAYBOOK ?= ansible-playbook -e ansible_python_interpreter=$(PYTHON) @@ -543,7 +544,7 @@ docker-compose-sources: .git/hooks/pre-commit fi; $(ANSIBLE_PLAYBOOK) -i tools/docker-compose/inventory tools/docker-compose/ansible/sources.yml \ - -e awx_image=$(DEV_DOCKER_TAG_BASE)/awx_devel \ + -e awx_image=$(DEV_DOCKER_TAG_BASE)/$(GIT_REPO_NAME)_devel \ -e awx_image_tag=$(COMPOSE_TAG) \ -e receptor_image=$(RECEPTOR_IMAGE) \ -e control_plane_node_count=$(CONTROL_PLANE_NODE_COUNT) \