From ec7e6f3fc9bf821a22444205d633c24f3971b867 Mon Sep 17 00:00:00 2001 From: Sean Eagan Date: Fri, 2 Apr 2021 12:48:33 -0500 Subject: [PATCH] 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 Change-Id: I36747a7cd858eef612f654f50a5c65f596e4a59d --- Makefile | 2 +- ipa-downloader-image/Makefile | 6 ++++- playbooks/airship-images-build.yaml | 32 +++++++++++++-------------- playbooks/airship-images-publish.yaml | 32 +++++++++++++-------------- 4 files changed, 38 insertions(+), 34 deletions(-) diff --git a/Makefile b/Makefile index 1ab423f..cc48cf9 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -TOPTGTS := images lint all docs run_images tests +TOPTGTS := images lint all docs run_images tests clean IMAGES := $(wildcard */Makefile) $(TOPTGTS): $(IMAGES) diff --git a/ipa-downloader-image/Makefile b/ipa-downloader-image/Makefile index 8e2adcc..245d2cd 100644 --- a/ipa-downloader-image/Makefile +++ b/ipa-downloader-image/Makefile @@ -90,4 +90,8 @@ images: build_ipa tests: 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 diff --git a/playbooks/airship-images-build.yaml b/playbooks/airship-images-build.yaml index d6a058a..0963973 100644 --- a/playbooks/airship-images-build.yaml +++ b/playbooks/airship-images-build.yaml @@ -38,21 +38,21 @@ when: pre_build_role is defined - name: Publish images block: - - make: + - command: make images clean + args: chdir: "{{ makefile_chdir }}" - target: "images" - params: - AZ_SDK: "{{ az_sdk }}" - COMMIT: "{{ zuul.newrev | default('') }}" - DOCKER_REGISTRY: "{{ docker_registry }}" - GCP_SDK: "{{ gcp_sdk }}" - IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" - IMAGE_TAG: "{{ image_tag | default('latest') }}" - LABEL: "{{ image_label | default('org.airshipit.build=community') }}" - NO_PROXY: "{{ proxy.noproxy }}" - PUSH_IMAGE: "false" - PROXY: "{{ proxy.http }}" - QCOW_CONF_DIRS: "{{ qcow_conf_dirs | default('') }}" - USE_PROXY: "{{ proxy.enabled | lower }}" - WORKDIR: "{{ image_config_dir | default('config') }}" + environment: + AZ_SDK: "{{ az_sdk }}" + COMMIT: "{{ zuul.newrev | default('') }}" + DOCKER_REGISTRY: "{{ docker_registry }}" + GCP_SDK: "{{ gcp_sdk }}" + IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" + IMAGE_TAG: "{{ image_tag | default('latest') }}" + LABEL: "{{ image_label | default('org.airshipit.build=community') }}" + NO_PROXY: "{{ proxy.noproxy }}" + PUSH_IMAGE: "false" + PROXY: "{{ proxy.http }}" + QCOW_CONF_DIRS: "{{ qcow_conf_dirs | default('') }}" + USE_PROXY: "{{ proxy.enabled | lower }}" + WORKDIR: "{{ image_config_dir | default('config') }}" become: True diff --git a/playbooks/airship-images-publish.yaml b/playbooks/airship-images-publish.yaml index f71146b..b706560 100644 --- a/playbooks/airship-images-publish.yaml +++ b/playbooks/airship-images-publish.yaml @@ -44,23 +44,23 @@ password: "{{ airship_images_quay_creds.password }}" registry_url: "{{ docker_registry }}" - name: Push Images with Latest and Commit Tags - make: + command: make images clean + args: chdir: "{{ makefile_chdir }}" - target: "images" - params: - AZ_SDK: "{{ az_sdk }}" - COMMIT: "{{ zuul.newrev | default('') }}" - DOCKER_REGISTRY: "{{ docker_registry }}" - GCP_SDK: "{{ gcp_sdk }}" - IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" - IMAGE_TAG: "{{ item }}" - LABEL: "{{ image_label | default('org.airshipit.build=community') }}" - NO_PROXY: "{{ proxy.noproxy }}" - PUSH_IMAGE: "true" - PROXY: "{{ proxy.http }}" - QCOW_CONF_DIRS: "{{ qcow_conf_dirs | default('') }}" - USE_PROXY: "{{ proxy.enabled | lower }}" - WORKDIR: "{{ image_config_dir | default('config') }}" + environment: + AZ_SDK: "{{ az_sdk }}" + COMMIT: "{{ zuul.newrev | default('') }}" + DOCKER_REGISTRY: "{{ docker_registry }}" + GCP_SDK: "{{ gcp_sdk }}" + IMAGE_PREFIX: "{{ image_prefix | default('airshipit') }}" + IMAGE_TAG: "{{ item }}" + LABEL: "{{ image_label | default('org.airshipit.build=community') }}" + NO_PROXY: "{{ proxy.noproxy }}" + PUSH_IMAGE: "true" + PROXY: "{{ proxy.http }}" + QCOW_CONF_DIRS: "{{ qcow_conf_dirs | default('') }}" + USE_PROXY: "{{ proxy.enabled | lower }}" + WORKDIR: "{{ image_config_dir | default('config') }}" with_items: - "{{ image_tag | default('latest') }}" - "{{ zuul.newrev }}"