55
66# INDEX_IMAGES=registry-proxy.engineering.redhat.com/rh-osbs/iib:394248
77INDEX_IMAGES ?=
8- INDEX_OPTIONS =$(shell echo $(INDEX_IMAGES ) | tr ',' '\n' | awk -F: 'match($$1,"/") {print "--set main.extraParameters."NR".name=clusterGroup.indexImages."NR".image --set main.extraParameters."NR".value="$$1":"$$2}')
98
109TARGET_ORIGIN ?= origin
1110# This is to ensure that whether we start with a git@ or https:// URL, we end up with an https:// URL
@@ -15,7 +14,7 @@ TARGET_REPO=$(shell git ls-remote --get-url --symref $(TARGET_ORIGIN) | sed -e '
1514TARGET_BRANCH =$(shell git rev-parse --abbrev-ref HEAD)
1615
1716# --set values always take precedence over the contents of -f
18- HELM_OPTS =-f values-global.yaml --set main.git.repoURL="$(TARGET_REPO ) " --set main.git.revision=$(TARGET_BRANCH ) $(TARGET_SITE_OPT ) $( INDEX_OPTIONS )
17+ HELM_OPTS =-f values-global.yaml --set main.git.repoURL="$(TARGET_REPO ) " --set main.git.revision=$(TARGET_BRANCH ) $(TARGET_SITE_OPT )
1918
2019# #@ Pattern Common Tasks
2120
@@ -35,7 +34,7 @@ show: ## show the starting template without installing it
3534# warnings when the chart gets applied the first time, but the resources were
3635# created first via the VP operator's UI
3736.PHONY : operator-deploy
38- operator-deploy operator-upgrade : validate-prereq validate-origin # # runs helm install
37+ operator-deploy operator-upgrade : validate-prereq validate-origin load-iibs # # runs helm install
3938 @set -e; if ! oc get crds patterns.gitops.hybrid-cloud-patterns.io > /dev/null 2>&1 ; then \
4039 echo " Running helm:" ; \
4140 helm upgrade --install $(NAME ) common/operator-install/ $(HELM_OPTS ) ; \
@@ -55,6 +54,24 @@ uninstall: ## runs helm uninstall
5554load-secrets : # # loads the secrets into the vault
5655 common/scripts/vault-utils.sh push_secrets $(NAME )
5756
57+ b.PHONY : load-iibs
58+ load-iibs :
59+ set -e; if [ x$( INDEX_IMAGES) != x ]; then \
60+ oc patch image.config.openshift.io/cluster --patch ' {"spec":{"registrySources":{"insecureRegistries":["registry-proxy-stage.engineering.redhat.com", "registry-proxy.engineering.redhat.com"]}}}' --type=merge; \
61+ for iib in $( shell echo $( INDEX_IMAGES) | tr ' ,' ' \n' ) ; do \
62+ echo " Processing $$ iib" \
63+ export iibnum=$$(echo $$iib | sed 's/.*://' ) ; \
64+ export iibdir=$$(echo $$PWD/manifests-iib-* ) ; \
65+ rm -rf $$ iibdir; \
66+ oc adm catalog mirror --manifests-only $$ iib $$(dirname $$iib ) --insecure; \
67+ sed -i " s/name: iib/name: iib-$$ iibnum/" $$ PWD/manifests-iib-* /catalogSource.yaml ; \
68+ echo " Applying $$ iib manifests" \
69+ oc apply -f $$ iibdir/imageContentSourcePolicy.yaml ; \
70+ oc apply -f $$ iibdir/catalogSource.yaml ; \
71+ done ; \
72+ fi
73+
74+
5875# #@ Validation Tasks
5976
6077# We only check the remote ssh git branch's existance if we're not running inside a container
0 commit comments