Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ajout option envsubst #140

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cdpcli/clidriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
[--with-carto] [--carto-repo=<repo:branch>]
[--conftest-repo=<repo:dir:branch>] [--no-conftest] [--conftest-namespaces=<namespaces>]
[--docker-image-kubectl=<image_name_kubectl>] [--docker-image-helm=<image_name_helm>] [--docker-image-aws=<image_name_aws>] [--docker-image-conftest=<image_name_conftest>]
[--volume-from=<host_type>]
[--volume-from=<host_type>] [--envsubst]
cdp conftest [(-v | --verbose | -q | --quiet)] (--deploy-spec-dir=<dir>)
[--conftest-repo=<gitlab repo>] [--no-conftest] [--volume-from=<host_type>] [--conftest-namespaces=<namespaces>] [--docker-image-conftest=<image_name_conftest>]
cdp validator-server [(-v | --verbose | -q | --quiet)] [(-d | --dry-run)] [--sleep=<seconds>]
Expand Down Expand Up @@ -86,6 +86,7 @@
--deploy=<type> 'release' or 'snapshot' - Maven command to deploy artifact.
--docker-image-maven=<image_name_maven> Docker image which execute mvn command [default: maven:3.5.3-jdk-8].
--docker-build-target=<target_name> Specify target in multi stage build
--envsubst Substitute env vars in resources templates. BE CAREFUL : Command line is size limited
--goals=<goals-opts> Goals and args to pass maven command.
--helm-version=<version> Major version of Helm. [default: 3]
--helm-migration=<true|false> Do helm 2 to Helm 3 migration
Expand Down Expand Up @@ -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)
6 changes: 3 additions & 3 deletions scripts/uninstall_pending_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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