Skip to content

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.
@github-actions
Copy link

This Pull Request has been automatically marked as stale because it has not had any activity for 180 days. It will be closed if no further activity occurs in 30 days.
Collaborators can add an assignee to keep this open indefinitely. Thanks for your contributions to rules_docker!

@github-actions github-actions bot added the Can Close? Will close in 30 days unless there is a comment indicating why not label Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Can Close? Will close in 30 days unless there is a comment indicating why not

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant