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

fix: Go default template doesn't work for tagging #8881

Merged

Conversation

ericzzzzzzz
Copy link
Contributor

@ericzzzzzzz ericzzzzzzz commented Jun 14, 2023

Fixes: #8872

Description

  • This pr changes how we handle missing key when evaluating Go template for generating tags
  • The original one errors out too early before we can use other Go template method to handle missing key with customization
  • Changing this option to missingkey=invalid allow us to use other Go template method to handle missing key, for example default go template method , the evaluation for '{{default "bar" .FOO}}' should be "bar" when using envTemplateTagger when .FOO is missing
  • The original business logic won't change -- fallback to latest tagger if missing keys were not handled with other go templates method, as missingkey=invalid strategy will put <no value> in templating result if the key not handled by other methods, we return error by checking if output contains <no value>, so this behave the same as the current one.

@ericzzzzzzz ericzzzzzzz marked this pull request as ready for review June 14, 2023 14:40
@ericzzzzzzz ericzzzzzzz requested review from a team, cloud-deploy-bot, renzodavid9 and plumpy and removed request for a team and cloud-deploy-bot June 14, 2023 15:50
@ericzzzzzzz ericzzzzzzz merged commit 8aeb72d into GoogleContainerTools:main Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

templating envTemplate with default does not work as documented
2 participants