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

GitLab CI: No such variable CI_BUILD_ID #2290

Closed
ytyukhnin opened this issue Apr 12, 2019 · 3 comments
Closed

GitLab CI: No such variable CI_BUILD_ID #2290

ytyukhnin opened this issue Apr 12, 2019 · 3 comments

Comments

@ytyukhnin
Copy link

Description

According to the official documentation there is no such variable CI_BUILD_ID on the list of the GitLab CI variables: https://docs.gitlab.com/ee/ci/variables/

But Fake is providing a following function

namespace Fake.Core
...
module BuildServer =
...
let gitlabCIBuildNumber = if isGitlabCI then Environment.environVar "CI_BUILD_ID" else ""

Which as the result is always returning an empty string while running on a GitLab CI.

Repro steps

Call a BuildServer.gitlabCIBuildNumber function while running at a GitLab CI runner.

Expected behavior

The function should be instead looking for a variable CI_PIPELINE_ID which defines a pipeline id.

Known workarounds

Use Environment.environVar "CI_PIPELINE_ID" directly.

@ytyukhnin ytyukhnin changed the title GitLab CO: No such variable CI_BUILD_ID GitLab CI: No such variable CI_BUILD_ID Apr 12, 2019
@matthid
Copy link
Member

matthid commented Apr 12, 2019

Hm, I always thought I just copied from the docs. Did this stuff change? Do we need to check the old one for backwards compat or old on-premise instances?

@ytyukhnin
Copy link
Author

Well, we started to use GitLab only few months ago, but I did some search on the Internet, and it seems they renamed CI_BUILD_ID into CI_PIPELINE_ID about a year ago. So I think it's better to keep it backwards compatible.

@ryanjaeb
Copy link

This issue ranks pretty high in Google when searching for GitLab CI_BUILD_ID. I ended up skimming the archived docs and CI_BUILD_ID was actually renamed to CI_JOB_ID. Here's what the docs used to show:

gitlab-ci-renamed-variables

boxofcrates added a commit to boxofcrates/sorry-cypress that referenced this issue May 9, 2021
CI_BUILD_ID is no longer set by Gitlab CI, per fsprojects/FAKE#2290
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

No branches or pull requests

3 participants