Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve environment variable handling #17

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

chmeliik
Copy link
Member

I found the environment variable handling confusing and hard to work with. This is an attempt to improve it.

See the individual commits for more details

@chmeliik
Copy link
Member Author

@jduimovich PTAL

They drifted. Minimize the differences to the expected ones:

- the lines with placeholder variables
- the REKOR_HOST and TUF_MIRROR variables which allow overrides in
  env.sh but not in env.template.sh

Update the related sed command in *-pipeline.sh accordingly.

Signed-off-by: Adam Cmiel <[email protected]>
* Previously, it was impossible to set the variables to an empty string.
  Use ${var-default} instead of ${var:-default} to allow it.
    * Replace 'none' in the documentation with ''.

* Drop the MY_ prefix from the override variables, simply respect the
  Actual variables if they're set.
    * Align this between env.sh and env.template.sh.
    * Drop the sed command that is no longer needed in *-pipeline.sh

* Allow to override IGNORE_REKOR as well.

Signed-off-by: Adam Cmiel <[email protected]>
This effectively changes the purpose of env.sh: instead of overwriting
every relevant environment variable, it only sets default values for
those that are unset.

Previously, it was impossible to set environment variables any other way
than by editing env.sh. Now, it will be possible to set environment
variables the standard way.

Signed-off-by: Adam Cmiel <[email protected]>
Previously, it considered variables that were set to an empty string as
undefined. This made it impossible to skip optional features (those that
can be skipped by setting the relevant variables to empty strings).

Signed-off-by: Adam Cmiel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant