[FOLIO-3217] Investigate configure Jenkins jobs via environment variable Created: 24/Jun/21 Updated: 01/Jul/21 Resolved: 01/Jul/21 |
|
| Status: | Closed |
| Project: | FOLIO |
| Components: | None |
| Affects versions: | None |
| Fix versions: | None |
| Type: | Task | Priority: | TBD |
| Reporter: | David Crossley | Assignee: | David Crossley |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original estimate: | Not Specified | ||
| Issue links: |
|
||||||||
| Sprint: | DevOps Sprint 117 | ||||||||
| Development Team: | FOLIO DevOps | ||||||||
| Description |
|
Each Jenkins job has a configuration setting via the UI (e.g. the "Configure : Pipeline" tab at folio-snapshot-test) to declare the "Branches to build : Branch specifier". The default is "*/master" and when DevOps people need to test another branch of folio-infrastructure (doc) then we set it specifically to be "refs/heads/my-test-infra-branch". The Jenkins docs (i.e. select the help via that Configure section) indicate that an environment variable can be utilised. Investigate. |
| Comments |
| Comment by David Crossley [ 30/Jun/21 ] |
|
There is now a Jenkins global environment variable TRUNK_BRANCH_NAME. That is currently configured to be "master". With pull/310 this has been utilised in CI/jenkins/Jenkinsfile.folio-testing-test-build and CI/jenkins/Jenkinsfile.folio-snapshot-test-build and enabled to be configurable for a testing feature branch. Subsequent test builds (folio-testing-test and folio-snapshot-test) were successful. |
| Comment by David Crossley [ 30/Jun/21 ] |
|
The Jenkins docs (see link to help via this ticket Description) seem to indicate that this global environment variable can also be utilised to configure the UI. Testing revealed that this cannot be done. See build folio-testing-test/147
hudson.plugins.git.GitException: Command "git fetch --tags --progress --prune -- origin +refs/heads/${TRUNK_BRANCH_NAME}:refs/remotes/origin/${TRUNK_BRANCH_NAME}" returned status code 128:
stdout:
stderr: fatal: Couldn't find remote ref refs/heads/${TRUNK_BRANCH_NAME}
So it seems that the environment variable is not evaluated via the UI, but is okay via the pipeline script source code. |
| Comment by David Crossley [ 01/Jul/21 ] |
|
Verified that other repos (e.g. jenkins-pipeline-libs) have this environment variable available. |