mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 22:37:41 -02:30
Refactor image_build and image_push roles
Primary changes are: - Generalized variable names (remove "docker") - Add explicit "push" variable rather than checking if the "registry" variable is defined. - Allow for passing in version as build arg
This commit is contained in:
@@ -1,2 +1,5 @@
|
||||
---
|
||||
awx_image: quay.io/ansible/awx
|
||||
awx_image: ansible/awx
|
||||
awx_image_tag: "{{ awx_version }}"
|
||||
dockerfile_name: 'Dockerfile'
|
||||
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
---
|
||||
- name: Set global version if not provided
|
||||
set_fact:
|
||||
awx_version: "{{ lookup('file', playbook_dir + '/../../VERSION') }}"
|
||||
when: awx_version is not defined
|
||||
|
||||
- name: Verify awx-logos directory exists for official install
|
||||
stat:
|
||||
path: "../../../awx-logos"
|
||||
@@ -17,11 +12,19 @@
|
||||
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
|
||||
command: docker build -t {{ awx_image }}:{{ awx_version }} -f ../../{{ dockerfile_name }} ../..
|
||||
|
||||
- name: Tag awx images as latest
|
||||
command: "docker tag {{ item }}:{{ awx_version }} {{ item }}:latest"
|
||||
with_items:
|
||||
- "{{ awx_image }}"
|
||||
shell: "{{ command_to_run }}"
|
||||
environment:
|
||||
DOCKER_BUILDKIT: 1
|
||||
args:
|
||||
chdir: "{{ playbook_dir }}/../../"
|
||||
|
||||
Reference in New Issue
Block a user