From 53776da2f8c0b90f34c5b307c1a4ea6628de267b Mon Sep 17 00:00:00 2001 From: Michel Morin Date: Mon, 4 Nov 2024 14:11:52 +0100 Subject: [PATCH] ajout option envsubst --- cdpcli/clidriver.py | 10 ++++++---- scripts/uninstall_pending_release.sh | 6 +++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cdpcli/clidriver.py b/cdpcli/clidriver.py index bdc9d95..b68a145 100644 --- a/cdpcli/clidriver.py +++ b/cdpcli/clidriver.py @@ -50,7 +50,7 @@ [--with-carto] [--carto-repo=] [--conftest-repo=] [--no-conftest] [--conftest-namespaces=] [--docker-image-kubectl=] [--docker-image-helm=] [--docker-image-aws=] [--docker-image-conftest=] - [--volume-from=] + [--volume-from=] [--envsubst] cdp conftest [(-v | --verbose | -q | --quiet)] (--deploy-spec-dir=) [--conftest-repo=] [--no-conftest] [--volume-from=] [--conftest-namespaces=] [--docker-image-conftest=] cdp validator-server [(-v | --verbose | -q | --quiet)] [(-d | --dry-run)] [--sleep=] @@ -86,6 +86,7 @@ --deploy= 'release' or 'snapshot' - Maven command to deploy artifact. --docker-image-maven= Docker image which execute mvn command [default: maven:3.5.3-jdk-8]. --docker-build-target= Specify target in multi stage build + --envsubst Substitute env vars in resources templates. BE CAREFUL : Command line is size limited --goals= Goals and args to pass maven command. --helm-version= Major version of Helm. [default: 3] --helm-migration= Do helm 2 to Helm 3 migration @@ -1211,7 +1212,8 @@ def add_env_vars(self, values_cdp): return values_cdp def envsubst_values(self, dir): - tmp_chart_dir = "/tmp" - valuesFile = "all_resources.yaml" - self._cmd.run('/usr/bin/envsubst "$(printf \'${%%s} \' $(env | cut -d\'=\' -f1))" < %s/%s > %s/%s.new && mv %s/%s.new %s/%s' % + if self._context.opt['--envsubst']: + tmp_chart_dir = "/tmp" + valuesFile = "all_resources.yaml" + self._cmd.run('/usr/bin/envsubst "$(printf \'${%%s} \' $(env | cut -d\'=\' -f1))" < %s/%s > %s/%s.new && mv %s/%s.new %s/%s' % (dir, valuesFile, tmp_chart_dir, valuesFile,tmp_chart_dir, valuesFile, dir, valuesFile), no_test = True) diff --git a/scripts/uninstall_pending_release.sh b/scripts/uninstall_pending_release.sh index 3102b37..da58e0e 100755 --- a/scripts/uninstall_pending_release.sh +++ b/scripts/uninstall_pending_release.sh @@ -20,9 +20,9 @@ if [ "$RELEASE" == "" -o "$NAMESPACE" == "" ]; then usage fi -RELEASEV3=$(helm3 list -n ${NAMESPACE} --pending -f "^${RELEASE}$" | grep "pending-install") +RELEASEV3=$(helm3 list -n ${NAMESPACE} --pending -f "^${RELEASE}$" | grep "pending-") if [ $? -eq 0 ]; then - echo "La release est en cours d'installation ..." - echo "Suppression de la release ..." + echo "La release ${RELEASE} est en cours d'installation ..." + echo "Suppression de la release ${RELEASE} ..." helm3 uninstall $RELEASE -n ${NAMESPACE} fi