shuttle
shuttle copied to clipboard
List available templates and possible overwrites
It would be great if there was a way to list all available templates for a given plan.
This could help users identify unexpected overwrites of plan templates and also help with discovering what templates are available shuttle template
.
Maybe something like below. The most important thing is the name of the template and if it's overwritten by another template.
$ shuttle template --list
Plan templates:
- deployment.tmpl
- Dockerfile.tmpl (overwriting plan)
- secret.tmpl
If run with the --verbose
(-v
) flag we could show the paths to each template. This could help in understanding where to look when updating or trying to understand them.
$ shuttle template --list -v
Plan templates:
- deployment.tmpl $plan/templates/deployment.tmpl
- Dockerfile.tmpl $project/templates/Dockerfile.tmpl (overwriting $plan/templates/Dockerfile.tmpl)
- secret.tmpl $project/templates/secret.tmpl
@nkobber would this command have helped you the other day when trying to understand why your build was failing due to a local overwrite?
There isn't really a requriement that templates should be called .tmpl
and location of templates I neither locked down, so I guess it would be hard to do this in the current form. Maybe if templates were a part of the shuttle language it would be possible.
Maybe the problem could be solved in another way. Extending the command output with a verbose setting when actually running the command. So you could see which templates it uses and even what variables.
@nkobber would this command have helped you the other day when trying to understand why your build was failing due to a local overwrite?
Not really. I had no idea. Unless it somehow tells me in the build output, and it is very visible
@nkobber Did you look at the build logs locally or in Jenkins?
The file names have no meaning, I know. It was just to provide a context for the discussion.
The overwriting behaviour of plan templates is locked down by shuttle, so does it not make sense in that context?
I know you can use shuttle template
on any Go template file, but the behaviour of the template lookup mechanism is what I'm trying to address.
We can add additional output to shuttle template
with using the -o
flag as Stdout is now available for logs.
It is not possible without -o
as we write the templated output to Stdout.