diff --git a/helm-chart-collator/Dockerfile b/helm-chart-collator/Dockerfile index 0ac04ac..4d070e4 100644 --- a/helm-chart-collator/Dockerfile +++ b/helm-chart-collator/Dockerfile @@ -14,15 +14,20 @@ RUN apt-get update && \ openssh-client \ jq \ git && \ - pip3 install --upgrade wheel && \ - pip3 install --upgrade ansible && \ - pip3 install --upgrade jmespath && \ - pip3 install --upgrade yq && \ + pip3 install --upgrade wheel --trusted-host pypi.org \ + --trusted-host files.pythonhosted.org && \ + pip3 install --upgrade ansible --trusted-host pypi.org \ + --trusted-host files.pythonhosted.org && \ + pip3 install --upgrade jmespath --trusted-host pypi.org \ + --trusted-host files.pythonhosted.org && \ + pip3 install --upgrade yq --trusted-host pypi.org \ + --trusted-host files.pythonhosted.org && \ rm -rf /var/lib/apt/lists/* COPY playbooks /opt/playbooks +COPY config /opt/config -ARG CHARTS="" +ARG CHARTS="/opt/config/charts.yaml" RUN ansible-playbook -v /opt/playbooks/create_repository.yaml \ -i /opt/playbooks/inventory.yaml \ --extra-vars "CHARTS=$CHARTS" diff --git a/helm-chart-collator/Makefile b/helm-chart-collator/Makefile index b6626d8..7858c21 100644 --- a/helm-chart-collator/Makefile +++ b/helm-chart-collator/Makefile @@ -18,12 +18,13 @@ PUSH_IMAGE ?= false IMAGE_ID ?= none COMMIT ?= $(shell git rev-parse HEAD) LABEL ?= org.airshipit.build=community -IMAGE_NAME ?= collator +IMAGE_NAME ?= helm-chart-collator DOCKER_REGISTRY ?= quay.io IMAGE_PREFIX ?= airshipit IMAGE_TAG ?= latest DISTRO ?= debian_stable -IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO} +CHARTS ?= \"$(cat "config/charts.yaml")\" +IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} SH_TO_CHECK := $(wildcard files/*.sh ) PROXY ?= http://proxy.foo.com:8000 NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local @@ -74,31 +75,23 @@ build_collator: mkdir -p $(BUILD_DIR) ifeq ($(IMAGE_ID), none) ifeq ($(USE_PROXY), true) - docker build . \ - --iidfile $(BUILD_DIR)/image_id \ - --tag $(IMAGE) \ - --label $(LABEL) \ - --label "org.opencontainers.image.revision=$(COMMIT)" \ - --label "org.opencontainers.image.created=\ - $(shell date --rfc-3339=seconds --utc)" \ - --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ - --build-arg http_proxy=$(PROXY) \ - --build-arg https_proxy=$(PROXY) \ - --build-arg HTTP_PROXY=$(PROXY) \ - --build-arg HTTPS_PROXY=$(PROXY) \ - --build-arg no_proxy=$(NO_PROXY) \ - --build-arg NO_PROXY=$(NO_PROXY) \ - --build-arg GIT_COMMIT=$(COMMIT) + ./build-image-make.sh \ + config/charts.yaml \ + $(IMAGE_NAME) \ + $(IMAGE) \ + $(LABEL) \ + $(BUILD_DIR) \ + $(USE_PROXY) \ + $(PROXY) \ + $(NO_PROXY) else - docker build . \ - --iidfile $(BUILD_DIR)/image_id \ - --tag $(IMAGE) \ - --label $(LABEL) \ - --label "org.opencontainers.image.revision=$(COMMIT)" \ - --label "org.opencontainers.image.created=\ - $(shell date --rfc-3339=seconds --utc)" \ - --label "org.opencontainers.image.title=$(IMAGE_NAME)" \ - --build-arg GIT_COMMIT=$(COMMIT) + ./build-image-make.sh \ + config/charts.yaml \ + $(IMAGE_NAME) \ + $(IMAGE) \ + $(LABEL) \ + $(BUILD_DIR) \ + $(USE_PROXY) endif else echo $(IMAGE_ID) > $(BUILD_DIR)/image_id diff --git a/helm-chart-collator/build-image-make.sh b/helm-chart-collator/build-image-make.sh new file mode 100755 index 0000000..7c8c108 --- /dev/null +++ b/helm-chart-collator/build-image-make.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# set -xe + +if [[ $# < 5 ]]; then + echo "usage:" + echo " $0 \\\n" + echo " \\\n" + echo " \\\n" + echo " \\\n" + echo "