Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Use empty string as fallback value for undefined environment variables #2261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

k0walik
Copy link

@k0walik k0walik commented Jul 14, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

The current implementation of dockerfile_build rule looks up for environment variables value and uses None as fallback value for undefined one. This causes to resolve into --build-arg <ENV_VAR>=None build argument, which is interpreted as valid, defined value.

What is the new behavior?

Instead, we should fallback to empty string for undefined environment variables, which resolves to --build-arg <ENV_VAR>='' and is interpreted as empty value. This would match the same output as produced in shell:

$ echo "NON_EXISTING_VARIABLE='${NON_EXISTING_VARIABLE}'"
NON_EXISTING_VARIABLE=''

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

  The current implementation of dockerfile_build rule looks up for
  environment variables value and uses `None` as fallback value. This
  causes to resolve into `--build-arg <ENV_VAR>=None` build argument,
  which is seen as valid string.

  Instead, we should fallback to empty string for undefined environment
  variables, which resolves to `--build-arg <ENV_VAR>=''` and is
  interpreted as empty value.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant