Explicit env vars for constructing paths in scripts and spruce templates
gberche-orange opened this issue · 0 comments
gberche-orange commented
Is your feature request related to a problem? Please describe.
As a template authors, in order to have scripts and spruce expressions to fetch files (in config repo ot template repos), that avoid hardcoded path (such as root deploment, subdeployment), I need to rely on variables.
This enables:
- ease refactorings such as deployment renaming, or moving across root deployments
- sharing/factorizing scripts and spruce expressions among multiple root deployments (potentialy contributes to https://github.com/orange-cloudfoundry/paas-templates/issues/376 )
Describe the solution you'd like
Export new env variables such as:
SECRET_HOME=
TEMPLATE_HOME=
ROOT_DEPLOYMENT=hello-world-root-depls
DEPLOYMENT=generic-app
that would be used using spruce env var interpolation https://github.com/geofffranks/spruce/blob/master/doc/environment-variables-and-defaults.md#can-i-use-the-values-of-environment-variables-in-an-operation
path_to_my_file: ((concat $TEMPLATE_HOME "/" $ROOT_DEPLOYMENT "/cf-apps-deployments/" $DEPLOYMENT "/template" ))
and in shell script in
${TEMPLATE_HOME}/{ROOT_DEPLOYMENT}/cf-apps-deployments/${DEPLOYMENT}/template
${SECRET_HOME}/{ROOT_DEPLOYMENT}/cf-apps-deployments/${DEPLOYMENT}/myfile.txt
Describe alternatives you've considered
- documenting internal
CUSTOM_SCRIPT_DIR
variable as as the following initially suggested in #258 (comment)
secrets: # this key is pruned by spruce
timeout_from_file: ((concat "../../../../" $CUSTOM_SCRIPT_DIR "/spruce-file-sample-from-templates.txt" ))
Additional context
This is a followup of #255 and #258 (comment)