Optimize image build/publish jobs

Zuul jobs are running out of space and failing. This attempts to
resolve by cleaning up between the build/publish of each image.

Switched to the ansible command module, since the make module doesn't
support multiple make targets.

Added a clean target to any image which didn't already have one, which
was just the ipa-downloader-image.

Signed-off-by: Sean Eagan <seaneagan1@gmail.com>
Change-Id: I36747a7cd858eef612f654f50a5c65f596e4a59d
This commit is contained in:
Sean Eagan 2021-04-02 12:48:33 -05:00
parent 2453c913a3
commit ec7e6f3fc9
4 changed files with 38 additions and 34 deletions

View File

@ -1,4 +1,4 @@
TOPTGTS := images lint all docs run_images tests TOPTGTS := images lint all docs run_images tests clean
IMAGES := $(wildcard */Makefile) IMAGES := $(wildcard */Makefile)
$(TOPTGTS): $(IMAGES) $(TOPTGTS): $(IMAGES)

View File

@ -90,4 +90,8 @@ images: build_ipa
tests: tests:
echo TODO echo TODO
.PHONY: images build_ipa tests clean:
docker image rm $(IMAGE)
# TODO: Clean up ipa builder container/image/artifacts
.PHONY: images build_ipa tests clean

View File

@ -38,21 +38,21 @@
when: pre_build_role is defined when: pre_build_role is defined
- name: Publish images - name: Publish images
block: block:
- make: - command: make images clean
args:
chdir: "{{ makefile_chdir }}" chdir: "{{ makefile_chdir }}"
target: "images" environment:
params: AZ_SDK: "{{ az_sdk }}"
AZ_SDK: "{{ az_sdk }}" COMMIT: "{{ zuul.newrev | default('') }}"
COMMIT: "{{ zuul.newrev | default('') }}" DOCKER_REGISTRY: "{{ docker_registry }}"
DOCKER_REGISTRY: "{{ docker_registry }}" GCP_SDK: "{{ gcp_sdk }}"
GCP_SDK: "{{ gcp_sdk }}" IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}"
IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" IMAGE_TAG: "{{ image_tag | default('latest') }}"
IMAGE_TAG: "{{ image_tag | default('latest') }}" LABEL: "{{ image_label | default('org.airshipit.build=community') }}"
LABEL: "{{ image_label | default('org.airshipit.build=community') }}" NO_PROXY: "{{ proxy.noproxy }}"
NO_PROXY: "{{ proxy.noproxy }}" PUSH_IMAGE: "false"
PUSH_IMAGE: "false" PROXY: "{{ proxy.http }}"
PROXY: "{{ proxy.http }}" QCOW_CONF_DIRS: "{{ qcow_conf_dirs | default('') }}"
QCOW_CONF_DIRS: "{{ qcow_conf_dirs | default('') }}" USE_PROXY: "{{ proxy.enabled | lower }}"
USE_PROXY: "{{ proxy.enabled | lower }}" WORKDIR: "{{ image_config_dir | default('config') }}"
WORKDIR: "{{ image_config_dir | default('config') }}"
become: True become: True

View File

@ -44,23 +44,23 @@
password: "{{ airship_images_quay_creds.password }}" password: "{{ airship_images_quay_creds.password }}"
registry_url: "{{ docker_registry }}" registry_url: "{{ docker_registry }}"
- name: Push Images with Latest and Commit Tags - name: Push Images with Latest and Commit Tags
make: command: make images clean
args:
chdir: "{{ makefile_chdir }}" chdir: "{{ makefile_chdir }}"
target: "images" environment:
params: AZ_SDK: "{{ az_sdk }}"
AZ_SDK: "{{ az_sdk }}" COMMIT: "{{ zuul.newrev | default('') }}"
COMMIT: "{{ zuul.newrev | default('') }}" DOCKER_REGISTRY: "{{ docker_registry }}"
DOCKER_REGISTRY: "{{ docker_registry }}" GCP_SDK: "{{ gcp_sdk }}"
GCP_SDK: "{{ gcp_sdk }}" IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}"
IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" IMAGE_TAG: "{{ item }}"
IMAGE_TAG: "{{ item }}" LABEL: "{{ image_label | default('org.airshipit.build=community') }}"
LABEL: "{{ image_label | default('org.airshipit.build=community') }}" NO_PROXY: "{{ proxy.noproxy }}"
NO_PROXY: "{{ proxy.noproxy }}" PUSH_IMAGE: "true"
PUSH_IMAGE: "true" PROXY: "{{ proxy.http }}"
PROXY: "{{ proxy.http }}" QCOW_CONF_DIRS: "{{ qcow_conf_dirs | default('') }}"
QCOW_CONF_DIRS: "{{ qcow_conf_dirs | default('') }}" USE_PROXY: "{{ proxy.enabled | lower }}"
USE_PROXY: "{{ proxy.enabled | lower }}" WORKDIR: "{{ image_config_dir | default('config') }}"
WORKDIR: "{{ image_config_dir | default('config') }}"
with_items: with_items:
- "{{ image_tag | default('latest') }}" - "{{ image_tag | default('latest') }}"
- "{{ zuul.newrev }}" - "{{ zuul.newrev }}"