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

Substitute ${compiled_target_dir} in env vars for input_type: external #863

Merged

Conversation

simu
Copy link
Contributor

@simu simu commented Oct 11, 2022

Summary

Kapitan already substitutes ${compiled_target_dir} in the command line arguments for the command executed for compile objects with input_type: external.

This commit adds logic to also substitue ${compiled_target_dir} in the environment variables provided to the external command. This allows users to specify the compilation target directory in an environment variable, which can be useful for example to simplify wrapper scripts which do some work before calling the external tool.

See projectsyn/commodore#646 for an example PR which implements a wrapper script for kustomize. This wrapper script could benefit greatly from being able to pass the output directory as an environment variable as it would remove the hard requirement of the wrapper script that users provide the output path as the first entry in args.

Proposed Changes

  • Substitute ${compiled_target_dir} in all environment variables passed in compile objects with input_type: external.

…rnal`

Kapitan already substitutes `${compiled_target_dir}` in the command line
arguments for the command executed for compile objects with
`input_type: external`.

This commit adds logic to also substitue `${compiled_target_dir}` in the
environment variables provided to the external command. This allows
users to specify the compilation target directory in an environment
variable, which can be useful for example to simplify wrapper scripts
which do some work before calling the external tool.

See projectsyn/commodore#646 for an example PR
which implements a wrapper script for `kustomize`. This wrapper script
could benefit greatly from being able to pass the output directory as an
environment variable as it would remove the hard requirement of the
wrapper script that users provide the output path as the first entry in
`args`.
@ramaro
Copy link
Member

ramaro commented Oct 24, 2022

Looks good @simu . Thanks!

@ramaro ramaro merged commit 712ee94 into kapicorp:master Oct 24, 2022
@simu simu deleted the feat/input-type-external-compiled-dir branch October 25, 2022 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants