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

Change docker buildx to not push by default #15051

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/devel_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,5 @@ jobs:
- name: Build and push AWX devel images
run: |
make ${{ matrix.build-targets.make-target }}
env:
DOCKER_BUILDX_PUSH: true
2 changes: 2 additions & 0 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ jobs:
--build-arg OPERATOR_VERSION=${{ github.event.inputs.operator_version }}" \
IMG=ghcr.io/${{ github.repository_owner }}/awx-operator:${{ github.event.inputs.operator_version }} \
make docker-buildx
env:
DOCKER_BUILDX_PUSH: "true"

- name: Run test deployment with awx-operator
working-directory: awx-operator
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ SDIST_TAR_FILE ?= $(SDIST_TAR_NAME).tar.gz

I18N_FLAG_FILE = .i18n_built

## PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
PLATFORMS ?= linux/amd64,linux/arm64 # linux/ppc64le,linux/s390x

# Set DOCKER_BUILDX_PUSH to "true" to push the image, set to any other value to skip pushing
DOCKER_BUILDX_PUSH ?= false

.PHONY: awx-link clean clean-tmp clean-venv requirements requirements_dev \
develop refresh adduser migrate dbchange \
receiver test test_unit test_coverage coverage_html \
Expand Down Expand Up @@ -603,7 +606,7 @@ docker-compose-buildx: Dockerfile.dev
- docker buildx create --name docker-compose-buildx
docker buildx use docker-compose-buildx
- docker buildx build \
--push \
$(if $(filter true,$(DOCKER_BUILDX_PUSH)),--push,--load) \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from=$(DEV_DOCKER_TAG_BASE)/awx_devel:$(COMPOSE_TAG) \
--platform=$(PLATFORMS) \
Expand Down Expand Up @@ -675,7 +678,7 @@ awx-kube-buildx: Dockerfile
- docker buildx create --name awx-kube-buildx
docker buildx use awx-kube-buildx
- docker buildx build \
--push \
$(if $(filter true,$(DOCKER_BUILDX_PUSH)),--push,--load) \
--build-arg VERSION=$(VERSION) \
--build-arg SETUPTOOLS_SCM_PRETEND_VERSION=$(VERSION) \
--build-arg HEADLESS=$(HEADLESS) \
Expand Down Expand Up @@ -706,7 +709,7 @@ awx-kube-dev-buildx: Dockerfile.kube-dev
- docker buildx create --name awx-kube-dev-buildx
docker buildx use awx-kube-dev-buildx
- docker buildx build \
--push \
$(if $(filter true,$(DOCKER_BUILDX_PUSH)),--push,--load) \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from=$(DEV_DOCKER_TAG_BASE)/awx_kube_devel:$(COMPOSE_TAG) \
--platform=$(PLATFORMS) \
Expand Down
17 changes: 5 additions & 12 deletions tools/ansible/roles/image_build/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,12 @@
dest: "../../awx/ui/public/static/media/"
when: awx_official|default(false)|bool

- set_fact:
command_to_run: |
docker build -t {{ awx_image }}:{{ awx_image_tag }} \
-f {{ dockerfile_name }} \
--build-arg VERSION={{ awx_version }} \
--build-arg SETUPTOOLS_SCM_PRETEND_VERSION={{ awx_version }} \
--build-arg HEADLESS={{ headless }} \
.

# Calling Docker directly because docker-py doesnt support BuildKit
- name: Build AWX image
shell: "{{ command_to_run }}"
shell: "make awx-kube-build"
environment:
DOCKER_BUILDKIT: 1
VERSION: "{{ awx_version }}"
HEADLESS: "{{ headless }}"
COMPOSE_TAG: "{{ awx_image_tag }}"

args:
chdir: "{{ playbook_dir }}/../../"