Skip to content

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

Merged
ericzzzzzzz merged 2 commits into
GoogleContainerTools:mainfrom
ericzzzzzzz:fix-default-template-method
Jun 15, 2023
Merged

fix: Go default template doesn't work for tagging#8881
ericzzzzzzz merged 2 commits into
GoogleContainerTools:mainfrom
ericzzzzzzz:fix-default-template-method

Conversation

@ericzzzzzzz

@ericzzzzzzz ericzzzzzzz commented Jun 14, 2023

Copy link
Copy Markdown
Contributor

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, plumpy and renzodavid9 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

2 participants