Home > Software engineering >  Jenkins does not run the building process after a push
Jenkins does not run the building process after a push

Time:02-01

I have the following initial situation:

  • I have a Docker container running Jenkins 2.379
  • This Jenkins has the Bitbucket Server Integration and the Bitbucket Branch Sourch Plugin installed
  • The connection to the Bitbucket server seems to work enter image description here
  • I also set up a multibranch pipeline that listens to the repository in the connected Bitbucket server instance enter image description here
  • And I have set the Scan Multibranch Pipeline Trigger to All pushes. enter image description here
  • Finally, it seems that Jenkins has correctly implemented the webhook in the corresponding Bitbucket project. enter image description here
  • Changes to some configurations of the multibranch pipeline trigger the scan process, which works properly. If there are changes in the code of the corresponding branch during a push, the build is triggered.
  • Clicking the "Scan Multibranch Pipeline Now" button has the same result.
  • But if I just push some code changes into a branch, nothing happens. My pipeline does not start automatically and no build process is started with the changes made.

Goal: Every push a developer does in a branch of this project should trigger the scan for new branches in Jenkis and the build process for new branches or those where something has changed.

CodePudding user response:

I have found the problem/solution. As I said, my Jenkins runs in a Docker container and is hosted locally on my PC (localhost:8080).

Through the credentials, the path from Jenkins into Bitbucket worked and so did creating the webhook. However, for this webhook, the Bitbucket server plugin entered its address (localhost:8080). So now when a push into a Bitbucket repo happens, this webhook was triggered on Bitbucket's localhost:8080 (so presumably Bitbucket itself and not Jenkins).

The solution was now quite simple. I used a tool called ngrok to make my localhost:8080 (on which Jenkins runs) accessible via a URL from the internet. I then only had to store this URL in Jenkis in system configurations and adapt the webhook in my Bitbucket repository.

  • Related