Skip to content

Only activate env: "KEY=" for empty environment variable value, clearly document pattern behavior#2839

Merged
dgageot merged 1 commit intoGoogleContainerTools:masterfrom
AndiDog:empty-env-profile-activation
Sep 9, 2019
Merged

Only activate env: "KEY=" for empty environment variable value, clearly document pattern behavior#2839
dgageot merged 1 commit intoGoogleContainerTools:masterfrom
AndiDog:empty-env-profile-activation

Conversation

@AndiDog
Copy link
Copy Markdown
Contributor

@AndiDog AndiDog commented Sep 9, 2019

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$" or envRegex: KEY=REGEX, and fix the implementation of env: 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 for env: "KEY=".

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 9, 2019

Codecov Report

Merging #2839 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted Files Coverage Δ
pkg/skaffold/schema/latest/config.go 100% <ø> (ø) ⬆️
pkg/skaffold/schema/profiles.go 88.38% <100%> (+0.22%) ⬆️

@balopat balopat added the kokoro:run runs the kokoro jobs on a PR label Sep 9, 2019
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Sep 9, 2019
Copy link
Copy Markdown
Contributor

@balopat balopat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I really appreciate the test coverage and documentation!!

Copy link
Copy Markdown
Contributor

@dgageot dgageot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@balopat I'd like to make sure the doc is properly rendered with such a large comment.

@dgageot dgageot added meta/docs-preview docs-modifications runs the docs preview service on the given PR and removed meta/docs-preview labels Sep 9, 2019
@container-tools-bot
Copy link
Copy Markdown

Please visit http://34.94.233.95:1313 to view changes to the docs.

@container-tools-bot container-tools-bot removed the docs-modifications runs the docs preview service on the given PR label Sep 9, 2019
@dgageot dgageot merged commit 21ab5f4 into GoogleContainerTools:master Sep 9, 2019
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.

6 participants