8
8
# the command line. I.e. we can set things without having to tweak values files
9
9
EXTRA_HELM_OPTS ?=
10
10
11
+ # This variable can be set in order to pass additional ansible-playbook arguments from the
12
+ # the command line. I.e. we can set -vvv for more verbose logging
13
+ EXTRA_PLAYBOOK_OPTS ?=
14
+
11
15
# INDEX_IMAGES=registry-proxy.engineering.redhat.com/rh-osbs/iib:394248
12
16
# or
13
17
# INDEX_IMAGES=registry-proxy.engineering.redhat.com/rh-osbs/iib:394248,registry-proxy.engineering.redhat.com/rh-osbs/iib:394249
@@ -18,7 +22,7 @@ TARGET_ORIGIN ?= origin
18
22
# This is because we expect to use tokens for repo authentication as opposed to SSH keys
19
23
TARGET_REPO =$(shell git ls-remote --get-url --symref $(TARGET_ORIGIN ) | sed -e 's/.* URL:[[:space:]]* //' -e 's% ^git@%% ' -e 's% ^https://%% ' -e 's% :% /% ' -e 's% ^% https://% ')
20
24
# git branch --show-current is also available as of git 2.22, but we will use this for compatibility
21
- TARGET_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
25
+ TARGET_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
22
26
23
27
UUID_FILE ?= ~/.config/validated-patterns/pattern-uuid
24
28
UUID_HELM_OPTS ?=
@@ -68,11 +72,7 @@ preview-%:
68
72
69
73
.PHONY : operator-deploy
70
74
operator-deploy operator-upgrade : validate-prereq validate-origin validate-cluster # # runs helm install
71
- @set -e -o pipefail
72
- # Retry five times because the CRD might not be fully installed yet
73
- for i in {1..5}; do \
74
- helm template --include-crds --name-template $(NAME ) $(PATTERN_INSTALL_CHART ) $(HELM_OPTS ) | oc apply -f- && break || sleep 10; \
75
- done
75
+ @common/scripts/deploy-pattern.sh $(NAME ) $(PATTERN_INSTALL_CHART ) $(HELM_OPTS )
76
76
77
77
.PHONY : uninstall
78
78
uninstall : # # runs helm uninstall
@@ -115,7 +115,7 @@ secrets-backend-none: ## Edits values files to remove secrets manager + ESO
115
115
.PHONY : load-iib
116
116
load-iib : # # CI target to install Index Image Bundles
117
117
@set -e; if [ x$( INDEX_IMAGES) != x ]; then \
118
- ansible-playbook rhvp.cluster_utils.iib_ci; \
118
+ ansible-playbook $( EXTRA_PLAYBOOK_OPTS ) rhvp.cluster_utils.iib_ci; \
119
119
else \
120
120
echo " No INDEX_IMAGES defined. Bailing out" ; \
121
121
exit 1; \
@@ -129,12 +129,22 @@ token-kubeconfig: ## Create a local ~/.kube/config with password (not usually ne
129
129
130
130
# We only check the remote ssh git branch's existance if we're not running inside a container
131
131
# as getting ssh auth working inside a container seems a bit brittle
132
+ # If the main repoUpstreamURL field is set, then we need to check against
133
+ # that and not target_repo
132
134
.PHONY : validate-origin
133
135
validate-origin : # # verify the git origin is available
134
136
@echo " Checking repository:"
135
- @echo -n " $( TARGET_REPO) - branch '$( TARGET_BRANCH) ': "
136
- @git ls-remote --exit-code --heads $(TARGET_REPO ) $(TARGET_BRANCH ) > /dev/null && \
137
- echo " OK" || (echo " NOT FOUND" ; exit 1)
137
+ $(eval UPSTREAMURL := $(shell yq -r '.main.git.repoUpstreamURL // (.main.git.repoUpstreamURL = "") ' values-global.yaml) )
138
+ @if [ -z " $( UPSTREAMURL) " ]; then\
139
+ echo -n " $( TARGET_REPO) - branch '$( TARGET_BRANCH) ': " ; \
140
+ git ls-remote --exit-code --heads $(TARGET_REPO ) $(TARGET_BRANCH ) > /dev/null && \
141
+ echo " OK" || (echo " NOT FOUND" ; exit 1); \
142
+ else\
143
+ echo " Upstream URL set to: $( UPSTREAMURL) " ; \
144
+ echo -n " $( UPSTREAMURL) - branch '$( TARGET_BRANCH) ': " ; \
145
+ git ls-remote --exit-code --heads $(UPSTREAMURL ) $(TARGET_BRANCH ) > /dev/null && \
146
+ echo " OK" || (echo " NOT FOUND" ; exit 1); \
147
+ fi
138
148
139
149
.PHONY : validate-cluster
140
150
validate-cluster : # # Do some cluster validations before installing
@@ -153,15 +163,20 @@ validate-cluster: ## Do some cluster validations before installing
153
163
validate-schema : # # validates values files against schema in common/clustergroup
154
164
$(eval VAL_PARAMS := $(shell for i in ./values-* .yaml; do echo -n "$${i} "; done) )
155
165
@echo -n " Validating clustergroup schema of: "
156
- @set -e; for i in $( VAL_PARAMS) ; do echo -n " $$ i" ; helm template common /clustergroup $( HELM_OPTS) -f " $$ {i}" > /dev/null; done
166
+ @set -e; for i in $( VAL_PARAMS) ; do echo -n " $$ i" ; helm template oci://quay.io/hybridcloudpatterns /clustergroup $( HELM_OPTS) -f " $$ {i}" > /dev/null; done
157
167
@echo
158
168
159
169
.PHONY : validate-prereq
160
170
validate-prereq : # # verify pre-requisites
171
+ $(eval GLOBAL_PATTERN := $(shell yq -r .global.pattern values-global.yaml) )
172
+ @if [ $( NAME) != $( GLOBAL_PATTERN) ]; then\
173
+ echo " " ; \
174
+ echo " WARNING: folder directory is \" $( NAME) \" and global.pattern is set to \" $( GLOBAL_PATTERN) \" " ; \
175
+ echo " this can create problems. Please make sure they are the same!" ; \
176
+ echo " " ; \
177
+ fi
161
178
@if [ ! -f /run/.containerenv ]; then\
162
179
echo " Checking prerequisites:" ; \
163
- for t in $( EXECUTABLES) ; do if ! which $$ t > /dev/null 2>&1 ; then echo " No $$ t in PATH" ; exit 1; fi ; done ; \
164
- echo " Check for '$( EXECUTABLES) ': OK" ; \
165
180
echo -n " Check for python-kubernetes: " ; \
166
181
if ! ansible -m ansible.builtin.command -a " {{ ansible_python_interpreter }} -c 'import kubernetes'" localhost > /dev/null 2>&1 ; then echo " Not found" ; exit 1; fi ; \
167
182
echo " OK" ; \
@@ -182,16 +197,16 @@ validate-prereq: ## verify pre-requisites
182
197
.PHONY : argo-healthcheck
183
198
argo-healthcheck : # # Checks if all argo applications are synced
184
199
@echo " Checking argo applications"
185
- $(eval APPS := $(shell oc get applications -A -o jsonpath='{range .items[* ]}{@.metadata.namespace}{","}{@.metadata.name}{"\n"}{end}') )
200
+ $(eval APPS := $(shell oc get applications.argoproj.io -A -o jsonpath='{range .items[* ]}{@.metadata.namespace}{","}{@.metadata.name}{"\n"}{end}') )
186
201
@NOTOK=0; \
187
202
for i in $( APPS) ; do\
188
203
n=` echo " $$ {i}" | cut -f1 -d,` ; \
189
204
a=` echo " $$ {i}" | cut -f2 -d,` ; \
190
- STATUS=` oc get -n " $$ {n}" application /" $$ {a}" -o jsonpath=' {.status.sync.status}' ` ; \
205
+ STATUS=` oc get -n " $$ {n}" applications.argoproj.io /" $$ {a}" -o jsonpath=' {.status.sync.status}' ` ; \
191
206
if [[ $$ STATUS != " Synced" ]]; then\
192
207
NOTOK=$$(( $${NOTOK} + 1 ) ); \
193
208
fi ; \
194
- HEALTH=` oc get -n " $$ {n}" application /" $$ {a}" -o jsonpath=' {.status.health.status}' ` ; \
209
+ HEALTH=` oc get -n " $$ {n}" applications.argoproj.io /" $$ {a}" -o jsonpath=' {.status.health.status}' ` ; \
195
210
if [[ $$ HEALTH != " Healthy" ]]; then\
196
211
NOTOK=$$(( $${NOTOK} + 1 ) ); \
197
212
fi ; \
@@ -208,7 +223,7 @@ argo-healthcheck: ## Checks if all argo applications are synced
208
223
.PHONY : qe-tests
209
224
qe-tests : # # Runs the tests that QE runs
210
225
@set -e; if [ -f ./tests/interop/run_tests.sh ]; then \
211
- ./tests/interop/run_tests.sh; \
226
+ pushd ./tests/interop; . /run_tests.sh; popd ; \
212
227
else \
213
228
echo " No ./tests/interop/run_tests.sh found skipping" ; \
214
229
fi
0 commit comments