RamblingCookieMonster / BuildHelpers

Helper functions for PowerShell CI/CD scenarios
MIT License
214 stars 47 forks source link

BuildHelpers grabs the wrong variable GitLab CI #122

Open raandree opened 4 years ago

raandree commented 4 years ago

When building on GitLab CI BuildHelpers uses the wrong variable to get the build number. The variable 'CI_JOB_ID' is not the build number but is different between each job (worker) in the same build. This should be replaced by 'CI_PIPELINE_ID'.

BHBranchName DscTaggingTest 
BHBuildNumber 3327 
BHBuildOutput G:\GIT\GitLab_Live\ServerDsc6\Repo\sTjDq1w6\0\DesiredStateConfig...
BHBuildSystem GitLab CI 
BHProjectName ServerManagement 
BHProjectPath G:\GIT\GitLab_Live\ServerDsc6\Repo\sTjDq1w6\0\DesiredStateConfig...
CI true 
CI_BUILD_ID 3327 
CI_BUILD_NAME build_batch1 
CI_COMMIT_BRANCH DscTaggingTest 
CI_COMMIT_REF_NAME DscTaggingTest 
CI_CONCURRENT_ID 0 
CI_CONCURRENT_PROJECT_ID 0 
CI_DEFAULT_BRANCH master 
CI_JOB_ID 3327 
CI_JOB_NAME build_batch1 
CI_JOB_STAGE build 
CI_JOB_TOKEN [MASKED] 
CI_PIPELINE_ID 1575 
CI_PIPELINE_IID 1122 
CI_PIPELINE_SOURCE push 

And please close #43.

RamblingCookieMonster commented 4 years ago

gotcha - It might be worth looking for CI_PIPELINE_IID, and falling back to CI_PIPELINE_ID for compatibility (IID is per project, ID increments globally for all projects, so could be painful for those of us with busy gitlabs - at least, afaict from reading a few issues and their definitions).