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

List available templates and possible overwrites #46

Open
Crevil opened this issue Oct 25, 2019 · 5 comments
Open

List available templates and possible overwrites #46

Crevil opened this issue Oct 25, 2019 · 5 comments

Comments

@Crevil
Copy link
Member

Crevil commented Oct 25, 2019

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
@Crevil
Copy link
Member Author

Crevil commented Oct 25, 2019

@nkobber would this command have helped you the other day when trying to understand why your build was failing due to a local overwrite?

@emilingerslev
Copy link
Contributor

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
Copy link

nkobber commented Oct 25, 2019

@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

@emilingerslev
Copy link
Contributor

@nkobber Did you look at the build logs locally or in Jenkins?

@Crevil
Copy link
Member Author

Crevil commented Oct 25, 2019

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.

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

No branches or pull requests

3 participants