-
-
Notifications
You must be signed in to change notification settings - Fork 371
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
base: main
Are you sure you want to change the base?
Conversation
and refactor
Not sure, but I think there's a difference between "end var is empty" and "an env var is not set". |
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. 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can see arguments for both sides. I am not against a merge if this change gets properly documented, so that users can adjust their potential checks against empty/non-empty vars to now check for the existence.
While writing this, I realized that removing vars entirely makes checking a bit more cumbersome as one first needs to check for existence and then chain a check for a possible matching value.
@zc-devs We're currently curating issues for 3.0. If you want to get this into 3.0, please rebase and address the review in the next days.
@@ -68,11 +68,11 @@ This is the reference list of all environment variables available to your pipeli | |||
| `CI_COMMIT_REF` | commit ref | `refs/heads/main` | | |||
| `CI_COMMIT_REFSPEC` | commit ref spec | `issue-branch:main` | | |||
| `CI_COMMIT_BRANCH` | commit branch (equals target branch for pull requests) | `main` | | |||
| `CI_COMMIT_SOURCE_BRANCH` | commit source branch (empty if event is not `pull_request` or `pull_request_closed`) | `issue-branch` | | |||
| `CI_COMMIT_TARGET_BRANCH` | commit target branch (empty if event is not `pull_request` or `pull_request_closed`) | `main` | | |||
| `CI_COMMIT_SOURCE_BRANCH` | commit source branch (sets only for `pull_request` and `pull_request_closed` events) | `issue-branch` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `CI_COMMIT_SOURCE_BRANCH` | commit source branch (sets only for `pull_request` and `pull_request_closed` events) | `issue-branch` | | |
| `CI_COMMIT_SOURCE_BRANCH` | commit source branch (set only for `pull_request` and `pull_request_closed` events) | `issue-branch` | |
| `CI_COMMIT_SOURCE_BRANCH` | commit source branch (empty if event is not `pull_request` or `pull_request_closed`) | `issue-branch` | | ||
| `CI_COMMIT_TARGET_BRANCH` | commit target branch (empty if event is not `pull_request` or `pull_request_closed`) | `main` | | ||
| `CI_COMMIT_SOURCE_BRANCH` | commit source branch (sets only for `pull_request` and `pull_request_closed` events) | `issue-branch` | | ||
| `CI_COMMIT_TARGET_BRANCH` | commit target branch (sets only for `pull_request` and `pull_request_closed` events) | `main` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `CI_COMMIT_TARGET_BRANCH` | commit target branch (sets only for `pull_request` and `pull_request_closed` events) | `main` | | |
| `CI_COMMIT_TARGET_BRANCH` | commit target branch (set only for `pull_request` and `pull_request_closed` events) | `main` | |
| `CI_COMMIT_TAG` | commit tag name (empty if event is not `tag`) | `v1.10.3` | | ||
| `CI_COMMIT_PULL_REQUEST` | commit pull request number (empty if event is not `pull_request` or `pull_request_closed`) | `1` | | ||
| `CI_COMMIT_PULL_REQUEST_LABELS` | labels assigned to pull request (empty if event is not `pull_request` or `pull_request_closed`) | `server` | | ||
| `CI_COMMIT_PULL_REQUEST` | commit pull request number (sets only for `pull_request` and `pull_request_closed` events) | `1` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `CI_COMMIT_PULL_REQUEST` | commit pull request number (sets only for `pull_request` and `pull_request_closed` events) | `1` | | |
| `CI_COMMIT_PULL_REQUEST` | commit pull request number (set only for `pull_request` and `pull_request_closed` events) | `1` | |
| `CI_COMMIT_PULL_REQUEST` | commit pull request number (empty if event is not `pull_request` or `pull_request_closed`) | `1` | | ||
| `CI_COMMIT_PULL_REQUEST_LABELS` | labels assigned to pull request (empty if event is not `pull_request` or `pull_request_closed`) | `server` | | ||
| `CI_COMMIT_PULL_REQUEST` | commit pull request number (sets only for `pull_request` and `pull_request_closed` events) | `1` | | ||
| `CI_COMMIT_PULL_REQUEST_LABELS` | labels assigned to pull request (sets only for `pull_request` and `pull_request_closed` events) | `server` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `CI_COMMIT_PULL_REQUEST_LABELS` | labels assigned to pull request (sets only for `pull_request` and `pull_request_closed` events) | `server` | | |
| `CI_COMMIT_PULL_REQUEST_LABELS` | labels assigned to pull request (set only for `pull_request` and `pull_request_closed` events) | `server` | |
@@ -101,8 +101,8 @@ This is the reference list of all environment variables available to your pipeli | |||
| `CI_PREV_COMMIT_REF` | previous commit ref | `refs/heads/main` | | |||
| `CI_PREV_COMMIT_REFSPEC` | previous commit ref spec | `issue-branch:main` | | |||
| `CI_PREV_COMMIT_BRANCH` | previous commit branch | `main` | | |||
| `CI_PREV_COMMIT_SOURCE_BRANCH` | previous commit source branch | `issue-branch` | | |||
| `CI_PREV_COMMIT_TARGET_BRANCH` | previous commit target branch | `main` | | |||
| `CI_PREV_COMMIT_SOURCE_BRANCH` | previous commit source branch (sets only for `pull_request` and `pull_request_closed` events) | `issue-branch` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `CI_PREV_COMMIT_SOURCE_BRANCH` | previous commit source branch (sets only for `pull_request` and `pull_request_closed` events) | `issue-branch` | | |
| `CI_PREV_COMMIT_SOURCE_BRANCH` | previous commit source branch (set only for `pull_request` and `pull_request_closed` events) | `issue-branch` | |
| `CI_PREV_COMMIT_SOURCE_BRANCH` | previous commit source branch | `issue-branch` | | ||
| `CI_PREV_COMMIT_TARGET_BRANCH` | previous commit target branch | `main` | | ||
| `CI_PREV_COMMIT_SOURCE_BRANCH` | previous commit source branch (sets only for `pull_request` and `pull_request_closed` events) | `issue-branch` | | ||
| `CI_PREV_COMMIT_TARGET_BRANCH` | previous commit target branch (sets only for `pull_request` and `pull_request_closed` events) | `main` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `CI_PREV_COMMIT_TARGET_BRANCH` | previous commit target branch (sets only for `pull_request` and `pull_request_closed` events) | `main` | | |
| `CI_PREV_COMMIT_TARGET_BRANCH` | previous commit target branch (set only for `pull_request` and `pull_request_closed` events) | `main` | |
I don't care, TBH. |
Related #1911, #1913.
While #1913 fixes manual trigger and numbers/booleans for automatic triggers, it pollutes Pod's environment with empty strings: