1

am new to Jenkins and is searching for one answer. Iam trying to configure Jenkins with Gitlab and is facing issues when I add Webhooks or Jenkins CI Integration in Gitlab. Gitlab is not able to connect to Jenkins. Also when I close Jenkins, the build is not running at the scheduled intervals by build trigger.

I tried adding the Jenkins CI Url and secret token obtained from Jenkins, but when I test the hook, it shows this error 404

Any help is appreciated.

VISHNU NAIR
  • 11
  • 1
  • 4
  • Jenkins Should be at running state if you need to trigger the build, when you shutdown it completely it won't initiate the build process/trigger process. For Webhooks how you configure with the jenkins can you show that step. – Chandra Sekhar Y Aug 02 '17 at 14:19
  • Thank you Chandra Sekhar for the information that Jenkins should be active for the build to trigger. I was having the same doubt. – VISHNU NAIR Aug 11 '17 at 06:10
  • @Chandra Sekhar - I have added the screenshot of the error in my question. Please check and let me know if any more details are required. thanks again. – VISHNU NAIR Aug 11 '17 at 06:38
  • I have some doubts..1)what url have you provided for Gitlab. 2)is your jenkins Authenticated. 3)if you were using Jenkins to gitlab didi you provide your IP address of jenkins for it to connect. 4)is your IP address has Public access to connect with GItlab. If you don't mind can you answer these questions – Chandra Sekhar Y Aug 11 '17 at 12:01
  • 1) I have provided the CI url that is available from Jenkins, 2) I have added the secret token obtained from Gitlab into credentials part of the Jenkins configuration and tested the same and it is success, – VISHNU NAIR Aug 18 '17 at 09:35
  • It seems that I have issue with only trigger running when a code is pushed to gitlab. I have found another way to this by putting triggers at certain intervals and jenkins fetches the code from gitlab when the trigger starts. Thanks for your help @ChandraSekhar – VISHNU NAIR Aug 18 '17 at 09:37

2 Answers2

0

First of all have a look o Jenkins logs in order to check if it receives the Hook. You should see something like this

INFO: WebHook called with url: /ci/project/content-fetch

In case you are accessing your Jenkins/Git with HTTP, add your webhook as provided by Jenkins on project settings

http://domain/ci/project/<project-name>

and uncheck

Enable SSL verification

In case you have HTTPS Use your Jenkins project URL but this time add https instead of http``

https://domain/ci/project/<project-name>

And check

Enable SSL verification

Also on Jenkins project configuration on Build Triggers/Build when a change is pushed to GitLab. by pressing the advanced button you will find Secret Token Generate a token and insert it on the GitLab Webhook settings.

That should work for you.

0

I don't see this option Also on Jenkins project configuration on Build Triggers/Build when a change is pushed to GitLab. by pressing the advanced button you will find Secret Token Generate a token and insert it on the GitLab Webhook settings.

That should work for you

Hanuma
  • 1