-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Describe the bug
Environment variable RJPP_BRANCH is initialized with wrong value when setting multiple values in 'Branches to build' section (image attached)
To Reproduce
Steps to reproduce the behavior:
Consider the following git branch tree:
*-----*-----* (master)
\
*-----*-----*-----* (feature1)
- Create new Multibranch Pipeline
- Define the 'Mode' in 'Build Configuration' to
by Remote Jenkinsfile Provider Plugin - Configure script path - Pipeline should include a sh step to print env vars as follows
sh "printenv RJPP_BRANCH" - Set 'Jenkinsfile SCM settings' to
Git - Add multiple existing branches to 'Branches to build', master being the first
5.a. Note the order of configured branches matters - make sure the first configured branch'sHEADisn't committed last - Finish configuration according to your settings
- Submit & Scan Job
- Run the pipeline in any of the scanned branches
- The pipeline runs, reading (remotely) Jenkinsfile from the most-recently-committed branch
HEAD - View Console Output, see 1st occurrence of 'Checking out Revision': (related to JRPP)
10.a. Commit ID selected is the most recent commit, as expected - See
printenvstep output:
11.a. PrintedRJPP_BRANCHvalue matches the 1st element configured in 'Branches to build' (masteraccording to the git tree provided above), regardless if it was checked-out or not.
Expected behavior
RJPP_BRANCH value should match the actually checked-out Jenkinsfile branch.
Desktop (please complete the following information):
IMO irrelevant, running on cloud VM as Docker container, image pulled from DockerHub
Extra Info:
In the attached image, until I moved the REDACTED branch to the top of the list, '*/master' was printed as JRPP_BRANCH's value.
I'm trying to define some logic based on the branch used for reading the Jenkinsfile, so the current statue forces me to reorder the list for every development I need to make on the given pipeline, rather just adding a development branch to the list 'knowing' it'll be used and initialize JRPP_BRANCH, and remove it when done.
