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

Do not set empty environment variables #4193

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

Conversation

zc-devs
Copy link
Contributor

@zc-devs zc-devs commented Oct 5, 2024

Related #1911, #1913.

While #1913 fixes manual trigger and numbers/booleans for automatic triggers, it pollutes Pod's environment with empty strings:

        - name: CI_STEP_NAME
        - name: CI_WORKFLOW_NUMBER
          value: '1'
        - name: CI_COMMIT_TARGET_BRANCH
        - name: CI_COMMIT_REFSPEC
        - name: CI_STEP_NUMBER
          value: '0'
        - name: CI_COMMIT_PULL_REQUEST

and refactor
@qwerty287
Copy link
Contributor

Not sure, but I think there's a difference between "end var is empty" and "an env var is not set".

@zc-devs
Copy link
Contributor Author

zc-devs commented Oct 6, 2024

Before #1913, default values (empty string, zero, false) are filtered. It caused confusing, when I run pipeline manually. So, I removed it entirely. Now, there are a lot of empty string vars.
I think filtering zeros and falses is a mistake, because it is valid value. If nothing/not set needs to be expressed, null pointer should be used in the model.
However, it is a little bit different for strings, IMO. What's the meaning of empty string? The same as null, if we are talking about the model. Therefore this PR.

This PR should not break manual trigger, because manual envs is a different map, and this PR filters only empty strings in transition from model to envs.
Besides, looking at #1913 tests, there's no test with empty value. They are filtered in UI, as I remember correctly. So, the same logic, as in this PR.

@6543 6543 added the breaking will break existing installations if no manual action happens label Oct 6, 2024
@qwerty287 qwerty287 added this to the 3.0.0 milestone Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking will break existing installations if no manual action happens
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants