Only activate env: "KEY=" for empty environment variable value, clearly document pattern behavior#2839
Merged
dgageot merged 1 commit intoGoogleContainerTools:masterfrom Sep 9, 2019
Conversation
…arly document pattern behavior
Codecov Report
|
balopat
approved these changes
Sep 9, 2019
Contributor
balopat
left a comment
There was a problem hiding this comment.
LGTM, I really appreciate the test coverage and documentation!!
|
Please visit http://34.94.233.95:1313 to view changes to the docs. |
dgageot
approved these changes
Sep 9, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This tests and documents expected behavior, and fixes what I believe is a very surprising special case:
env: "KEY="should only match an empty/undefined environment variable value. Previously, it would match any value since an empty regex search matches anything.Use case where this is important: monorepo with 50 images where environment variable
ONLY_MODULE=...specifies which image(s) to build. An empty value should build everything.Overall, I'd rather change syntax or key to e.g.
env: "KEY~=^my-regex$"orenvRegex: KEY=REGEX, and fix the implementation ofenv:to compare the value exactly. But that would it backwards-incompatible and would still require the special!handling implemented for both string and regex comparison. Hence I went for a patch that only fixes the expectation forenv: "KEY=".