jenkinsci / gitlab-plugin

A Jenkins plugin for interfacing with GitLab
https://plugins.jenkins.io/gitlab-plugin/
GNU General Public License v2.0
1.44k stars 619 forks source link

GitLab connection : property not set in a simple pipeline job (not multibranch) #566

Closed squalou closed 7 years ago

squalou commented 7 years ago

Issue

'GitLab connectio' property doesn't sem to be set in a simple piepline job, making gitlabCommitStatus fail

Context

Logs & Traces

Nothing more than the sentence 'GitLab connection not set' in jenkins logs

Problem description

I have a pipeline kind of job described in a 'Jenkinsfile'. The job itself has some minor properties set : discard old jobs, triggers from gitlab, etc. In particular I can see the dropown 'GitLab connection' with the correct name I filled in Jenkins.

In the jenkinsfile I call the 'gitlabCommitStatus' step.

Nothing happens : jenkins complanis that 'GitLab connection is not set'

As a workaround I can ue the 'properties step', as described for multibranch issues, but then : all the properties already set on job disapear ! (including the trigger from gitlab)

So as a workaround I may end up redefining all the job's properties inside the jenkinsfile, (which is painful and verbose... and should not be there), and my jobs get 'reset' at each run.

squalou commented 7 years ago

Also, believe it or not but : setting this in the first line of the Jenkinsfile make thing work :+1:

properties(currentBuild.getRawBuild().getParent().getAllProperties())

it doesn' really make sense, does it ?

This prevent the removal of prepoerties, and makes GitLabConnection visible.

Withtou it , the clear message is :

"No GitLab connection configured"

which is clear enough and is easy to find in the sources of the plugin, in CommitStautsUpdater

Still, ugly warnings issued in the job' s console at runtime.

squalou commented 7 years ago

Erf, doesn't work at first run on a ne branch :/ Will probably have to add forcibly the Gitlab Connection on top of existing ones.

squalou commented 7 years ago

Afterthought : I'm facing th issue with a job that is 'inside a Folder' (using Jenkins Folder plugin to tidy up jobs)

Could it be a reason I face the same issue as 'multibranch' ?

[Edit] : just tested, no, it's not due to Folders. Tried without : same issue.

Gitlab pushes a job on jenkins, I get 'No GitLab connection configured' instantly

Still no idea how to 'add properties' instead of replacing all. No idea how any of you managed to have a working job.

omehegan commented 7 years ago

This is a known bug. https://github.com/jenkinsci/gitlab-plugin/issues/475

I'm not really sure how we can resolve it at present. Feel free to follow that one for any updates.