Skip to content

Commit 2414796

Browse files
committed
Move the common slim + multisource test into Makefile
This way yq is not required on the host. Tested as follows: * No value set (assumes default is false) ❯ cat values-global.yaml --- global: pattern: multicloud-gitops options: useCSV: false syncPolicy: Automatic installPlanApproval: Automatic main: clusterGroupName: hub # multiSourceConfig: # enabled: true ❯ ./pattern.sh make validate-prereq make -f common/Makefile validate-prereq make[1]: Entering directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops' You must set ".main.multiSourceConfig.enabled: true" in your 'values-global.yaml' file because your common subfolder is the slimmed down version with no helm charts in it make[1]: *** [common/Makefile:161: validate-prereq] Error 1 make[1]: Leaving directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops' make: *** [Makefile:12: validate-prereq] Error 2 * Value set to false ❯ cat values-global.yaml --- global: pattern: multicloud-gitops options: useCSV: false syncPolicy: Automatic installPlanApproval: Automatic main: clusterGroupName: hub multiSourceConfig: enabled: false ❯ ./pattern.sh make validate-prereq make -f common/Makefile validate-prereq make[1]: Entering directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops' You must set ".main.multiSourceConfig.enabled: true" in your 'values-global.yaml' file because your common subfolder is the slimmed down version with no helm charts in it make[1]: *** [common/Makefile:161: validate-prereq] Error 1 make[1]: Leaving directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops' make: *** [Makefile:12: validate-prereq] Error 2 * Value set to true ❯ cat values-global.yaml --- global: pattern: multicloud-gitops options: useCSV: false syncPolicy: Automatic installPlanApproval: Automatic main: clusterGroupName: hub multiSourceConfig: enabled: true ❯ ./pattern.sh make validate-prereq make -f common/Makefile validate-prereq make[1]: Entering directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops' make[1]: Leaving directory '/home/michele/Engineering/cloud-patterns/multicloud-gitops'
1 parent 66e791e commit 2414796

2 files changed

Lines changed: 8 additions & 17 deletions

File tree

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,14 @@ validate-prereq: ## verify pre-requisites
169169
if ! ansible-galaxy collection list | grep kubernetes.core > /dev/null 2>&1; then echo "Not found"; exit 1; fi;\
170170
echo "OK";\
171171
else\
172-
echo "Skipping prerequisites check as we're running inside a container";\
172+
if [ -f values-global.yaml ]; then\
173+
OUT=`yq -r '.main.multiSourceConfig.enabled // (.main.multiSourceConfig.enabled = "false")' values-global.yaml`;\
174+
if [ "$${OUT,,}" = "false" ]; then\
175+
echo "You must set \".main.multiSourceConfig.enabled: true\" in your 'values-global.yaml' file";\
176+
echo "because your common subfolder is the slimmed down version with no helm charts in it";\
177+
exit 1;\
178+
fi;\
179+
fi;\
173180
fi
174181

175182
.PHONY: argo-healthcheck

scripts/pattern-util.sh

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,6 @@ function version {
88
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'
99
}
1010

11-
function check_for_clustergroup_multisource {
12-
if [ -f values-global.yaml ]; then
13-
# Query .main.multiSourceConfig.enabled and assume it is false if not set
14-
OUT=$(yq -r '.main.multiSourceConfig.enabled // (.main.multiSourceConfig.enabled = "false")')
15-
if [ "${OUT,,}" = "false" ]; then
16-
echo "You must set `.main.multiSourceConfig.enabled: true` in your 'values-global.yaml' file"
17-
echo "because your common subfolder is the slimmed down version with no helm charts in it"
18-
exit 1
19-
fi
20-
fi
21-
}
22-
2311
if [ -z "$PATTERN_UTILITY_CONTAINER" ]; then
2412
PATTERN_UTILITY_CONTAINER="quay.io/hybridcloudpatterns/utility-container"
2513
fi
@@ -78,10 +66,6 @@ else
7866
PKI_HOST_MOUNT_ARGS=""
7967
fi
8068

81-
# In the slimmed down common branch we need to check that multisource is enabled for the clustergroup
82-
# chart
83-
check_for_clustergroup_multisource
84-
8569
# Copy Kubeconfig from current environment. The utilities will pick up ~/.kube/config if set so it's not mandatory
8670
# $HOME is mounted as itself for any files that are referenced with absolute paths
8771
# $HOME is mounted to /root because the UID in the container is 0 and that's where SSH looks for credentials

0 commit comments

Comments
 (0)