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

Add property GitLabCIBuildInfo.Source (#4431) #4432

Merged
merged 1 commit into from
Jan 6, 2025

Conversation

ap0llo
Copy link
Contributor

@ap0llo ap0llo commented Jan 5, 2025

Add property Sourceto GitLabCIBuildInfo that exposes the value of the CI_PIPELINE_SOURCE variable that GitLab CI uses to indicate how a pipeline was triggered.

Since the variable has a finite amount of possible values, the property is modelled as an enum with constants for all values listed in the GitLab documentation (https://docs.gitlab.com/ee/ci/jobs/job_rules.html#ci_pipeline_source-predefined-variable).
To account for GitLab adding additional values in the future, GitLabCIBuildInfo.Source is a nullable enum that will return null in case the environment variable value cannot be converted to the enum.

This fixes #4431

The Source property returns the trigger for the current pipeline as an enum value.
@devlead devlead force-pushed the add-source-to-gitlabcibuildinfo branch from 94e9130 to 63adff3 Compare January 6, 2025 12:31
Copy link
Member

@devlead devlead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@devlead devlead enabled auto-merge January 6, 2025 12:34
@devlead devlead merged commit 44e9cd7 into cake-build:develop Jan 6, 2025
15 checks passed
@devlead
Copy link
Member

devlead commented Jan 6, 2025

@ap0llo your changes have been merged, thanks for your contribution 👍

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.

Add property for GitLab's "Pipeline Source" to GitLabCIBuildInfo
2 participants