jenkinsci / jenkinsci/gitlab-branch-source-plugin
[JENKINS-62343] Jenkinsfile on change request is not consistent with console log
- Dominant language
- Java
- Stars
- 134
- Forks
- 113
- PR merge metrics
- No merged PRs in 30d
Description
At the top of the console log for a build running on a Gitlab merge request, I see output similar to the following:
16:12:10 Querying the current revision of merge request #1...
16:12:10 Current revision of merge request #1 is 30c945266d014280630074dafbe6ba31991adc90*
16:12:11* Obtained Jenkinsfile from 56e3895c10f6163a93e025647e8e0dfcfa88ca9d+30c945266d014280630074dafbe6ba31991adc90
i.e. it should be the Jenkinsfile as if the two commits identified are merged together.
However, that does not seem to be the case - it seems that the Jenkinsfile it uses is that from the source branch head only (and this is how it looks if I examine the Jenkinsfile in Replay)
I have replicated this using a simple test repository as follows:
1) Create a new repo
2) Commit the following Jenkinsfile to master:
echo "one"
3) Branch off master
4) Add the following to Jenkinsfile on the branch:
echo "two"
5) Add the following to Jenkinsfile on master:
echo "three"
6) Raise a merge request
When the build runs, it will echo one and two, but not three.
I have conducted the same test against a Bitbucket branch source, and that seems to work correctly, which suggests the issue is with the plugin rather than Jenkins core.
---
Originally reported by mosaic_nick, imported from: Jenkinsfile on change request is not consistent with console log
baymac
Raw content of original issue
At the top of the console log for a build running on a Gitlab merge request, I see output similar to the following:
16:12:10 Querying the current revision of merge request #1...16:12:10 Current revision of merge request #1 is 30c945266d014280630074dafbe6ba31991adc90*
16:12:11* Obtained Jenkinsfile from 56e3895c10f6163a93e025647e8e0dfcfa88ca9d+30c945266d014280630074dafbe6ba31991adc90
i.e. it should be the Jenkinsfile as if the two commits identified are merged together.
However, that does not seem to be the case - it seems that the Jenkinsfile it uses is that from the source branch head only (and this is how it looks if I examine the Jenkinsfile in Replay)
I have replicated this using a simple test repository as follows:
1) Create a new repo
2) Commit the following Jenkinsfile to master:echo "one"3) Branch off master
4) Add the following to Jenkinsfile on the branch:echo "two"5) Add the following to Jenkinsfile on master:
echo "three"6) Raise a merge request
When the build runs, it will echo one and two, but not three.
I have conducted the same test against a Bitbucket branch source, and that seems to work correctly, which suggests the issue is with the plugin rather than Jenkins core.
environment
```
Jenkins 2.222.3
Gitlab Branch Source Plugin 1.5.1
```
Contributor guide
Assessment
This issue has not been assessed yet.