I am new to BitBucket Server and wonder about the relationship between BitBucket Server and my actual project. I have BitBucket Server installed on my web server (where my development project lives) and have successfully connected to BitBucket Server from SourceTree, committed and pushed, etc.
What I don't understand is what I do next. I'd like that when I commit to my BitBucket Server repository, that updates the project development environment on the web server. With Git, I would just have the remote repository live in the folder on the web server where my project resides. How do I tell BitBucket Server to 'live' there?
Do I need Bamboo to accomplish this? I see that there is a Source Code Checkout task there. Or am I simply misunderstanding the workings of BitBucket Server?
All guidance is appreciated.
As you've discovered, Bitbucket Server doesn't work like "naked" Git. It's meant to be the home for many collaborators and many repositories. As such, it does "own" where it stores Git repositories. A while back, I wrote a blog post about triggering deployment with Git commands that might address your needs.
Yes, you could add Bamboo to the mix, especially if you have some form of tests you would want to run before deploying to your web server.
One more option you might consider would be to skip running your own Bitbucket Server, and use Bitbucket Cloud. Then you could leverage Bitbucket Pipelines to push your web code to your web server.
Hope that helps!
Yes, Bitbucket Server is the right fit for enterprise networks. Say no more.
The Mirror Hook sounds like the perfect solution. Sorry I had missed that. You should also be able to find the Mirror Hook as an add-on listed on the Marketplace:
As for testing, I would be more worried about monitoring. It's trivial to verify the result of a mirror once. But I think it's more interesting to know if a mirror has failed due to a network disruption or something. I think the easy approach is to wire your remote Git server (the web server) with a Git post-receive hook to call back to Bitbucket on every mirrored commit. I think something like this should work:
(Sorry, it's untested code, but shoot me a pull request if you find a serious error.)
It could be my error. I assumed you're running in a Bash world, not Windows. More importantly, I just removed `/bitbucket` from the start of the API URL path (if your Bitbucket is configured on a subpath, then include it in the BITBUCKET_URL, and make sure not to use a trailing slash) and added the `--verbose` switch to help with debugging.
Before configuring the hook, try putting some static values in for LAST_COMMIT_SHA (it must be the 40 char hash, not an abbreviation as found in the Bitbucket UI) and LAST_COMMIT_MESSAGE. Then you should be able to just run the script. After the URL fix, it works for me. On the command line, the script (now with verbose setting) should return an HTTP 204 response.
Once you find it working "manually", then you can configure the hook according to standard Git instructions.
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.Read more
Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda ...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs