Open aubertaa opened 1 year ago
I investigated a bit more, indeed the getAction method returns 'one' of the repositories, i don't know what the criterion is. Here is the return from an admin console script in jenkins, showing the returns for the job where statuses are not applied on the right repository:
All actions from getActions()
are:
[org.jenkinsci.plugins.workflow.cps.replay.ReplayFlowFactoryAction@4513008f, hudson.model.CauseAction@22b63a2d,
hudson.model.ParametersAction@4545e099, jenkins.scm.api.SCMRevisionAction@5de53613,
jenkins.scm.api.SCMRevisionAction@184da4d0, jenkins.scm.api.SCMRevisionAction@2d51f625,
jenkins.scm.api.SCMRevisionAction@34e51065, jenkins.scm.api.SCMRevisionAction@6fde564b,
jenkins.scm.api.SCMRevisionAction@4fab7fa6, jenkins.scm.api.SCMRevisionAction@1c4c0c5b,
jenkins.scm.api.SCMRevisionAction@342a4428, jenkins.scm.api.SCMRevisionAction@3649e75e,
jenkins.metrics.impl.TimeInQueueAction@6b26e8e5, jenkins.scm.api.SCMRevisionAction@25d56d87,
org.jenkinsci.plugins.workflow.cps.EnvActionImpl@2deb49fc, org.jenkinsci.plugins.workflow.libs.LibrariesAction@5f37edcc,
com.cloudbees.plugins.credentials.builds.CredentialsParameterBinder@32006f22,
hudson.plugins.git.util.BuildData@34f20be2[scmName=
Single action from getAction(hudson.plugins.git.util.BuildData.class)
is:
hudson.plugins.git.util.BuildData@34f20be2[scmName=
We can see indeed that only one of the two hudson.plugins.git.util.BuildData si returned and no luck, it's not the one i expected (last checked out repository). Jenkins javadoc indeed states that it returns "first instance to be found" (cf https://javadoc.jenkins-ci.org/hudson/model/Actionable.html#getAction(java.lang.Class) )
All present items should be considered or a way to specify the repository should be added to all methods present on this page (to allow each one to choose what he wants): https://www.jenkins.io/doc/pipeline/steps/gitlab-plugin/
Jenkins and plugins versions report
Environment
```text Jenkins: 2.387.3 gitlab-plugin:1.7.14 ```What Operating System are you using (both controller, and any agents involved in the problem)?
Linux Ubuntu 20.04
Reproduction steps
In a multibranch pipeline:
library
methodgit
methodgitlabBuilds
and/orgitlabCommitStatus
Expected Results
All commit statuses should be successfully set on previously checked out repository : "my_gitlab_repository"
Actual Results
this is my library repository that receives all commit statuses
Anything else?
I suspect that it could be related to this code, not considering the right SCM information: https://github.com/jenkinsci/gitlab-plugin/blob/6f6f22adecb232eead1a50fcac3fb6babae0c0e2/src/main/java/com/dabsquared/gitlabjenkins/util/CommitStatusUpdater.java#L208
As stated in https://github.com/jenkinsci/gitlab-plugin/issues/899#issuecomment-588522480, a workaround is available to enforce
gitlabCommitStatus
to the right repository but this workaround is unfortunately not possible ongitlabBuilds
method.(It would also be acceptable to be able to set specific target repository when calling 'gitlabBuilds' as a workaround)
Thanks for your help on this.