You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Environment variable RJPP_BRANCH is initialized with wrong value when setting multiple values in 'Branches to build' section (image attached)
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's HEAD isn'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 printenv step output:
11.a. Printed RJPP_BRANCH value matches the 1st element configured in 'Branches to build' (master according 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.
Screenshots
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.
The text was updated successfully, but these errors were encountered:
I have checked the implementation. You are right, JRPP_BRANCH is always showing the first value is set on the configuration. Unfortunately, this is not something that this plugin solve. Here are the details.
When Jenkins tries to reach to Jenkinsfile, this plugin interferes and says Jenkins to use the Git SCM definition which is defined under the "Remote Jenkins File Provider" Section. Then Jenkins, get this config and passes to the underlying Git plugin which handles all the checkout actions. Unfortunately, it is not possible to interfere that checkout action or get info about it.
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:
by Remote Jenkinsfile Provider Plugin
sh "printenv RJPP_BRANCH"
Git
5.a. Note the order of configured branches matters - make sure the first configured branch's
HEAD
isn't committed lastHEAD
10.a. Commit ID selected is the most recent commit, as expected
printenv
step output:11.a. Printed
RJPP_BRANCH
value matches the 1st element configured in 'Branches to build' (master
according 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.Screenshots
![Screenshot 2022-11-20 at 15 06 17](https://user-images.githubusercontent.com/84509513/202904161-ff3b4129-e40d-4b9e-a4d6-cd12c84ca652.png)
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.
The text was updated successfully, but these errors were encountered: