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
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:
Load a library dynamically with library method
checkout git repository with jenkins git method
try to set badges on repository using gitlabBuilds and/or gitlabCommitStatus
//configure gitlab connection
properties([
gitLabConnection("mygitlab"),
])
//dynamic load of library ! (this is different from @Library)
library "mylibraryidentifier@master"
node() {
//checkout my product's repository => doing this should result in setting commit status badges on this repository/commit on further operations
git credentialsId: 'xxxxxxxxxxxxxxxxxxx', url: "https://my_gitlab_repository.git", branch: env.BRANCH_NAME
gitlabBuilds(builds: ["test1","test2","test3"]) { //should set 'pending' commit status badges in my_gitlab_repository
sleep 5
gitlabCommitStatus(name: 'test1') { //should update 'test1' commit status badge in my_gitlab_repository
echo 'this is pre-build stage'
sleep 5
}
gitlabCommitStatus(name: 'test2') { //should update 'test2' commit status badge in my_gitlab_repository
echo 'this is build stage'
sleep 5
}
}
}
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?
Disabling the library dynamic load instruction gets back to the expected behavior.
It seems that there is a wrong consideration of multiple repositories (library repository + my_gitlab_repository) in the plugin when defining the target of commit statuses
this is confirmed by plugin logs showing that considered url is not the expected one 'my_gitlab_repository':
Aug 31, 2023 11:29:14 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater retrieveGitlabProjectIds
Retrieving gitlab project ids
Aug 31, 2023 11:29:14 AM INFO com.dabsquared.gitlabjenkins.util.CommitStatusUpdater addGitLabBranchBuild
Retrieving the gitlab project id from remote url [my library repository url]
I suspect that it could be related to this code, not considering the right SCM information:
As stated in #899 (comment), a workaround is available to enforce gitlabCommitStatus to the right repository but this workaround is unfortunately not possible on gitlabBuilds 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.
The text was updated successfully, but these errors were encountered:
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 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
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:
gitlab-plugin/src/main/java/com/dabsquared/gitlabjenkins/util/CommitStatusUpdater.java
Line 208 in 6f6f22a
As stated in #899 (comment), 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.
The text was updated successfully, but these errors were encountered: