gitlab-plugin
gitlab-plugin copied to clipboard
use BRANCH_NAME from environment as fallback for commit status ref
Using ff only merging strategy in gitlab results in having same commit on a feature branch and on the main branch (there it appears after the merging is done). This PR tries to fix the situation when jenkins multibranch pipeline job is used to build both the feature branch and main branch. The problem is that status update request does not contain the "ref" parameter needed to set the status for branch correctly.
Fixes https://github.com/jenkinsci/gitlab-plugin/issues/1010
Does this PR try to fix the situation, or do you know for sure that it fixes the situation?
It actually fixes the situation.
That is, are you running this PR in production and have you verified this PR fixes the problem?
The problem is not hard to reproduce so I just tested the fix in my local (docker) test environment (set up by following https://github.com/jenkinsci/gitlab-plugin/blob/master/src/docker/README.md). I do not run the code anywhere in production.
Any chance you could download the incremental build from https://repo.jenkins-ci.org/incrementals/org/jenkins-ci/plugins/gitlab-plugin/1.5.33-rc1406.50cf09d3a_6fd/ and do a functional test on a production server? For instructions on how to install a custom plugin build, see: https://www.jenkins.io/doc/book/managing/plugins/#advanced-installation
Sorry to leave you halfway through review, but I recently removed myself as the maintainer of this plugin in https://github.com/jenkins-infra/repository-permissions-updater/pull/2605, so I will not be able to merge this PR. You can consider adopting the plugin to merge and release the PR. The "Contributing to Open Source" workshop from DevOps World 2021 is a useful starting point for new maintainers. That document includes links to a five part video series that illustrates many of the steps. If the plugin is crucial to your work, you may want to ask your employer to support your work efforts by allowing you to adopt the plugin.
@martinnemec3 Thanks for the PR! The solution looks intuitive enough for me.
An ideal situation is if someone can test this out on a production server...
Thanks @martinnemec3!