Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do I orchestrate a Jenkins build across 2 different Bitbucket endpoints

I've got a rather simple build with some minor complications that I'm stumped on how to orchestrate.

My Jenkins/Bitbucket are located on an isolated network. Part of my build needs access to the internet. To facilitate this I have a Jenkins remote agent running on a different network with a firewall rule allowing it to connect to the Jenkins master.

Similarly I have a Bitbucket mirror located on the same network as the remote agent.

So Jenkins primary can talk to Bitbucket primary. Jenkins agent can talk to Bitbucket mirror. 

My build is correctly run using declarative pipeline script and has been working well. Most of my stages are bound to the agent and the git checkouts happen from the mirror. The final image is stash/unstashed back to the primary and build wraps up.

Now I want to leverage some of the new functionality with Bitbucket 7.6 and the Jenkins plugin, application link, builds dashboard, etc. So far as I can determine from experimenting and the documentation this requires a seemingly minor change to using a Jenkinsfile.

I added my script to the repo as Jenkinsfile, configured by build pipeline as file/SCM, setup all the proper values and it fails... Now all of the git checkouts are happening against the primary, and my remote agent can't talk to the primary, only the mirror.

My Jenkinsfile calls for the checkout to be done on the remote in it's own stage and specifies the mirror directly, but it's trying to checkout the repo from the primary and failing the build.

If I configure the SCM to use the mirror I suspect the build won't even start because then it will attempt to checkout the Jenkinsfile from the mirror and that's not reachable from the network the Jenkins primary is on (only the primary bitbucket server can reach the mirror).

It feels like I'm close, I just don't know how to split up the git checkouts correctly.


0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,810 views 10 16
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you