Skip to content

Explicit env vars for constructing paths in scripts and spruce templates #259

@gberche-orange

Description

@gberche-orange

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:

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

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)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    P3

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions