Jenkins hook not working - jenkins bitbucket

Hi, I use jenkins and bitbucket, I want to run the jenkins build when I ever do something in the bitbucket repository.

in jenkins

  • I created a project called test_1
  • in the Build Triggers configuration section the part I marked Trigger builds remotely
  • I added the TEST_TOKEN token

when i type this in the browser url and run jenkins build

 http://test.com:8080/job/test_1//build?token=TEST_TOKEN 

In the beat bag

i added a jenkins hook

then I executed some code for the bitpack via git, the jenkins build does not work, it seems that the trigger is not running.: / How to solve this problem. please, help. thanks in advance:)

+6
source share
2 answers

I had the same problem. @fmitchell is correct with its suggestions for these fields. But that did not work for me.

Instead, I use a regular POST Hook, where I provide the entire URL:

 http://USER_NAME: USER_TOKEN@YOUR.JENKINS.URL.COM :YOUR_PORT/job/YOUR_PROJECT_NAME/build?token=some_token_from_jenkins eg: http:// bob.miller@jenkins.example.com :8080/job/test_1/build?token=TEST_TOKEN 

It seems that Bitbuckt is missing the last "build" parameter in its generated URL, but I can’t say for sure.

------ Update ------

I found the best solution in which you not only run your build, but also can create different branches for various Jenkins projects:

  • Install the Bitbucket Plugin on Your Jenkins
  • Add a regular mailbox to your Bitbucket repository (Settings β†’ Hooks) and use the following URL:

https: //YOUR.JENKINS.SERVER: PORT / Bitbucket hook

  • Set up your Jenkins project as follows:
    • in build trigger enable Build when the change is transferred to BitBucket
    • in Source Control, select GIT ; enter your credentials and define the Branches to create (e.g. ** feature / *)

Thus, I have three build projects, one for all functions, one for development, and one for the release branch.

And best of all, you don't need to add new hooks for new Jenkins projects.

+5
source

It should be:

End point: http://test.com:8080/
Module name:
Project Name: test_1
Token: TEST_TOKEN

0
source

Source: https://habr.com/ru/post/975287/


All Articles