declarative pipeline and gitlab

100 views
Skip to first unread message

Pa Y

unread,
Oct 15, 2019, 4:47:12 AM10/15/19
to Jenkins Users
Hello,
has somebody managed successfully to use declarative pipeline and gitlab?

I followed the instructions listed here: https://docs.gitlab.com/ee/integration/jenkins.html and this works for freestyle jobs. we use this already without problems.

Now, I try to move to pipelines to have more options in general.

So far, we get gitlab hook sent succcessfully but for this we need to disable in Jenkins : Prevent Cross Site Request Forgery exploits , what I don't really want...

And anyway after hook was sent, Jenkins job can't be triggered

can maybe somebody share a running example?

Thanks for any help in advance!

Pablo


Gabriele Bonetti

unread,
Oct 21, 2019, 7:48:03 AM10/21/19
to Jenkins Users
Hi,

Maybe it's a "mister obvious" answer but have you set up the build trigger on the receiving pipeline? In the pipeline configuration you should have an option "Build when a change is pushed to gitlab" that you can enable and select the set of the events that would trigger the pipeline.
Also from here you can confirm that the webhook you are using is correct.

Pa Y

unread,
Oct 21, 2019, 6:02:51 PM10/21/19
to Jenkins Users
Hi Gabriele,
yes, you are right,thanks. The issue was the URL used (I need to RTFM carefully)...  as it seems you have experience with this: by using pipeline so far I get in Jenkins only a note like "Started ​by ​GitLab ​push ​by.." without any link to gitlab merg request.. by using freestyle job, the links are overall there. did you manage to get this?

Best Regards,
Pablo

Reinhold Füreder

unread,
Oct 22, 2019, 2:41:56 AM10/22/19
to jenkins...@googlegroups.com

Hi Pablo,

 

which Links? I am seeing Links to GitLab “Commits” in “Changes” section (scripted pipeline; only “Push Events” is enabled for GitLab Triggers; Git checkout has configured “gitlab” as repository browser; this requires Git plugin in beta version IIRC; in addition the pipeline finally calls “updateGitlabCommitStatus” step, but this is another story)

 

HTH Reinhold

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/708e7ee8-1651-40fb-b0c8-6f7a6368bef5%40googlegroups.com.

Pa Y

unread,
Oct 22, 2019, 4:36:08 AM10/22/19
to Jenkins Users
Hallo Reinhold,

I mean that using freestyle jobs in Jenkins we get for each Build a message like:

"Triggered by  GitLab Merge Request #1: ​Tests/feature/1234567 ​=> ​master" (and this is a link to gitlab)

and in Gitlab merge request you get a message like:
"Jenkins Robot @jenkins commented 2 mins ago
 Jenkins Build SUCCESS
Results available at: Jenkins [xxxx mergeRequests #26] " (and this a link to Jenkins build)

but based on your hint, I got all jenkins plugins up to date now and I set trigger for mergerequest events only (not push) and it works fine with pipelines :)

Regards,

Pablo

To unsubscribe from this group and stop receiving emails from it, send an email to jenkins...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages