I want Bitbucket cloud merge button to trigger Bamboo cloud build - bamboo

So I have builds being triggered by bamboo when there's a push to a branch using the Remote Trigger. This works perfectly.
However, I want the same thing to happen when I click the "merge" button on Bitbucket Server. The code merges into master but the build does not get triggered.
Is there a way to fix this?

You can use Http Request Post Receive Hook for this . https://marketplace.atlassian.com/plugins/de.aeffle.stash.plugin.stash-http-get-post-receive-hook/server/overview
For Bitbucket cloud,
You can select Create New Plan Branches for New Branches under Branches->'Automatic branch management'. I just tested it on Bitbucket and Bamboo cloud and it works perfectly.

Related

How to publish an ASPNET Website automatically to a Linux VPS?

Hello I want to build a build pipeline for a website. Whenever someone pushs something to git I want to trigger an action which builds the website (got that working with teamcity) and automatically deploys it to a staging server (docker container on some linux vps)
I could upload the artifact per ftp and check the ftp folder on the server per cronjob or something similar. But there has to be a better solution. Can you help me with that? Thank you.
TLDR I want to build, deploy and restart a website on every push to git.
Everything is selfhosted. No AWS, Azure or similar

bitbucket webhook to jenkins with branch name

i have a bitbucket repo that sends webhook to trigger jenkins job.
http://:8080/buildByToken/buildWithParameters?job=webhook_me&token=t
i want to send with the webhook the bitbucket branch name,
so i search the web for the right way to use Environment variables on bit bucket and i've found this site:
so i've edited the url with an "&branch=$BITBUCKET_BRANCH" at the end, but it won't work.
any ideas what should i do in order to send the webhook with the branch name?
*******EDIT*******
i saw that there is something called Bitbucket event payload.
which is a json that contains all of the details about the webhook:
https://confluence.atlassian.com/bitbucket/event-payloads-740262817.html
but i can't figure a way how to use it and pull it's data from jenkins.
i think that, this is the way to solve this, but i don't know how to use it.
i've found a way to do it, it works for me.
you need to use the bitbucket plugin: Bitbucket Plugin
then inside the job you need to specify the branch that will trigger the job after a push and check the marked checkbox:
then on the bitbucket create a webhook with the following URL:
http://:/bitbucket-hook/ Like so:
then push something to this repository and that branch, and there you go!
if you try to push to a different branch, the job won't be triiggered
The $BITBUCKET_BRANCH is only available in the Jenkins job. You are just literally passing the text "$BITBUCKET_BRANCH as the "branch" parameter. You can't pass in an environment variable like that.
$BITBUCKET_BRANCH may simply be available in the job, depending on the version of Jenkins and type of job you are using. In a pipeline job, this would be easy to access (if you have the right version of things). You don't need to pass it in unless you are trying to give it some other branch. In that case, you will need to see if you can get the branch on the bitbucket side to pass in to Jenkins.
Have you tried using jenkins-like variable ${BITBUCKET_BRANCH} instead of $BITBUCKET_BRANCH which is more shell-like variable?

How do I create GitLab CI jobs using the API?

I am looking for a way to trigger some GitLab CI jobs, on-demand from another service. Is this possible and if so, how?
Details: imagine that I need to trigger a complex build from an external process.
One workaround that comes into my mind if to have a job-scheduler.git repository that only contains .gitlabci.yml file that is rewritten each time I need to trigger a build. I put the code to be run there and that's it. Other ideas?
That seems to be the purpose of… triggers: https://gitlab.com/help/ci/triggers/README.md
you then have an api endpoint where you specify the project's id, the trigger token and the git ref.

why drone ci doesn't automatically build my repo after pushing commit?

I was trying self hosted drone CI and i have sample repository setup for this project.
I followed all the step to setup and it is able to show and pull the list of all my repo in github, but when i tried to make changes to drone repo nothing happen and it still show empty page with this message.
This will be your commit stream
Add a .drone.yml file and make a commit to trigger a build
I am running drone ci on virtualbox that comes with the Vagrantfile on the drone repo
If you configured everything properly, it may be a formatting problem with your .drone.yml. Drone does not give feedback on these errors and you have to check your webhook logs to discover the problem.
I'm assuming you have properly configured the webhook in your Github repo.
Use your browser to navigate to your Github repo, and select Settings tab.
Under settings, select Webhooks. You should find the webhook you configured to your self hosted Drone
Click on the specific webhook and at the bottom you can find the Recent deliveries section. This is a log of all events your repo has tried to communicate to Drone.
Check the response the Drone server sent you.

Rails and Git push, Git pull: logs return same commit, changes aren't made

I've got a local branch (master), a GitHub repo (origin), and another remote repo (server). I've set up my remote so locally I can type git push server master and push the changes to server/master.
When I type git log -1 locally and on the server they return the same commit, but none of the changes I made locally are visible on the server.
I deployed my app with Capistrano so redeploying it makes the changes visible immediately, but I don't want to have to redeploy every time I make a change.
Any idea what's going on here? I'm rather new to Git. Hopefully it's something easy to fix.
It sounds to me that you maybe looking at a different directory than your web server is pointed to.
When I setup capistrano:
cap deploy:setup
#then
cap deploy
it creates a directory structure similar to:
/releases (each deploy gets its own randome number directory)
/current (a sym-link to the latest release)
/shared
None of these folder are tied to git. Which makes me think your webserver may not be pointed to the same directory that you're using with git.
--
You may find cap deploy is preferable as you'll be able to see the output if there are any issues.
I'm not a huge expert but the above is how I've setup rails with Capistrano.
Normally origin is the name used for the GitHub remote and not master. You can check what remotes you have by doing git remote show. If you want even more detail on the remote use git remote show origin (or whatever your remote is called, if it is not origin). This will give you a list. I suspect that what you have is actually two local branches (master and server). Try doing a git push server origin. This will take your server branch and put it on GitHub.
Alternatively
If you are trying to combine the changes in your server branch with your master branch then use checkout master and then git merge server. This will merge your changes from the server branch into your master branch and you can then upload to GitHub via git push master origin.