diff --git a/.github/workflows/chart.yaml b/.github/workflows/chart.yaml index 2e5cd7944..288e9673c 100644 --- a/.github/workflows/chart.yaml +++ b/.github/workflows/chart.yaml @@ -23,7 +23,7 @@ jobs: - name: Build chart for release if: startsWith(github.ref, 'refs/tags/') run: | - REPO=quay.io/costoolkit/elemental-operator REPO_SEEDIMAGE=quay.io/costoolkit/elemental-seedimage TAG=${GITHUB_REF##*/} make chart + REGISTRY_URL=quay.io/costoolkit REPO=elemental-operator REPO_SEEDIMAGE=elemental-seedimage TAG=${GITHUB_REF##*/} make chart - name: Publish chart to release uses: fnkr/github-action-ghr@v1 if: startsWith(github.ref, 'refs/tags/') @@ -49,7 +49,7 @@ jobs: TAG=$(helm show values ${{ steps.chart.outputs.chart_name }}|yq .image.tag) if [ "$REPO" != "quay.io/costoolkit/elemental-operator-ci" ];then echo "REPO on the built chart is not the expected value" - echo "Expected quay.io/costoolkit/elemental-operator but got $REPO" + echo "Expected quay.io/costoolkit/elemental-operator-ci but got $REPO" exit 1 fi - name: Test release chart values diff --git a/Makefile b/Makefile index 083529996..fe8e62490 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,17 @@ GIT_COMMIT?=$(shell git rev-parse HEAD) GIT_COMMIT_SHORT?=$(shell git rev-parse --short HEAD) GIT_TAG?=$(shell git describe --abbrev=0 --tags 2>/dev/null || echo "v0.0.0" ) TAG?=${GIT_TAG}-${GIT_COMMIT_SHORT} -REPO?=quay.io/costoolkit/elemental-operator-ci -REPO_REGISTER?=quay.io/costoolkit/elemental-register-ci -TAG_SEEDIMAGE?=${TAG} -REPO_SEEDIMAGE?=quay.io/costoolkit/seedimage-builder-ci +REPO?=elemental-operator-ci +REPO_REGISTER?=elemental-register-ci +REPO_SEEDIMAGE?=seedimage-builder-ci +REGISTRY_URL?=quay.io/coostoolkit +#REGISTRY_URL?=registry.opensuse.org/isv/rancher/elemental/dev/containers +ifneq ($(REGISTRY_URL),) + REGISTRY_HEADER := $(REGISTRY_URL)/ +else + REGISTRY_HEADER := "" +endif + export ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) CHART_VERSION?=$(subst v,,$(GIT_TAG)) CHART?=$(shell find $(ROOT_DIR) -type f -name "elemental-operator-$(CHART_VERSION).tgz" -print) @@ -91,7 +98,7 @@ build-docker-operator: --build-arg "TAG=${GIT_TAG}" \ --build-arg "COMMIT=${GIT_COMMIT}" \ --build-arg "COMMITDATE=${COMMITDATE}" \ - -t ${REPO}:${TAG} . + -t ${REGISTRY_HEADER}${REPO}:${TAG} . .PHONY: build-docker-register build-docker-register: @@ -101,25 +108,25 @@ build-docker-register: --build-arg "TAG=${GIT_TAG}" \ --build-arg "COMMIT=${GIT_COMMIT}" \ --build-arg "COMMITDATE=${COMMITDATE}" \ - -t ${REPO_REGISTER}:${TAG} . + -t ${REGISTRY_HEADER}${REPO_REGISTER}:${TAG} . .PHONY: build-docker-seedimage-builder build-docker-seedimage-builder: DOCKER_BUILDKIT=1 docker build \ -f Dockerfile.seedimage \ - -t ${REPO_SEEDIMAGE}:${TAG} . + -t ${REGISTRY_HEADER}${REPO_SEEDIMAGE}:${TAG} . .PHONY: build-docker-push-operator build-docker-push-operator: build-docker-operator - docker push ${REPO}:${TAG} + docker push ${REGISTRY_HEADER}${REPO}:${TAG} .PHONY: build-docker-push-register build-docker-push-register: build-docker-register - docker push ${REPO_REGISTER}:${TAG} + docker push ${REGISTRY_HEADER}${REPO_REGISTER}:${TAG} .PHONY: build-docker-push-seedimage-builder build-docker-push-seedimage-builder: build-docker-seedimage-builder - docker push ${REPO_SEEDIMAGE}:${TAG} + docker push ${REGISTRY_HEADER}${REPO_SEEDIMAGE}:${TAG} .PHONY: chart chart: @@ -130,8 +137,9 @@ chart: cp -rf $(ROOT_DIR)/charts/operator $(ROOT_DIR)/build/operator yq -i '.image.tag = "${TAG}"' $(ROOT_DIR)/build/operator/values.yaml yq -i '.image.repository = "${REPO}"' $(ROOT_DIR)/build/operator/values.yaml - yq -i '.seedImage.tag = "${TAG_SEEDIMAGE}"' $(ROOT_DIR)/build/operator/values.yaml + yq -i '.seedImage.tag = "${TAG}"' $(ROOT_DIR)/build/operator/values.yaml yq -i '.seedImage.repository = "${REPO_SEEDIMAGE}"' $(ROOT_DIR)/build/operator/values.yaml + yq -i '.registry_url = "${REGISTRY_URL}"' $(ROOT_DIR)/build/operator/values.yaml helm package --version ${CHART_VERSION} --app-version ${GIT_TAG} -d $(ROOT_DIR)/build/ $(ROOT_DIR)/build/operator rm -Rf $(ROOT_DIR)/build/operator @@ -170,20 +178,20 @@ setup-full-cluster: build-docker-operator build-docker-seedimage-builder chart s export BRIDGE_IP="172.18.0.1" && \ export CHART=$(CHART) && \ export CONFIG_PATH=$(E2E_CONF_FILE) && \ - kind load docker-image --name $(CLUSTER_NAME) ${REPO}:${TAG} && \ - kind load docker-image --name $(CLUSTER_NAME) ${REPO_SEEDIMAGE}:${TAG} && \ + kind load docker-image --name $(CLUSTER_NAME) ${REGISTRY_HEADER}${REPO}:${TAG} && \ + kind load docker-image --name $(CLUSTER_NAME) ${REGISTRY_HEADER}${REPO_SEEDIMAGE}:${TAG} && \ cd $(ROOT_DIR)/tests && $(GINKGO) -r -v --label-filter="do-nothing" ./e2e kind-e2e-tests: build-docker-operator chart setup-kind export CONFIG_PATH=$(E2E_CONF_FILE) && \ - kind load docker-image --name $(CLUSTER_NAME) ${REPO}:${TAG} + kind load docker-image --name $(CLUSTER_NAME) ${REGISTRY_HEADER}${REPO}:${TAG} $(MAKE) e2e-tests # This builds the docker image, generates the chart, loads the image into the kind cluster and upgrades the chart to latest # useful to test changes into the operator with a running system, without clearing the operator namespace # thus losing any registration/inventories/os CRDs already created reload-operator: build-docker-operator chart - kind load docker-image --name $(CLUSTER_NAME) ${REPO}:${TAG} + kind load docker-image --name $(CLUSTER_NAME) ${REGISTRY_HEADER}${REPO}:${TAG} helm upgrade -n cattle-elemental-system elemental-operator $(CHART) .PHONY: vendor