Having some major issues with Bamboo.
I run a rails project, that runs on Engine Yard.
My build strategy is as follows
Checkout from Source Code
bundle install
rspec (run tests)
Tag my build
(code to create tag causes new commit, tag used in deploy)
git remote remove origin
git remote add origin <my repo>
git tag Bamboo-${bamboo.buildNumber}
git push origin Bamboo-${bamboo.buildNumber}
In my deploy the way engine yard works is you deploy based on branches or tags ( there is no build artifacts)
So in my Deploy it's a single script that uses a gem https://github.com/engineyard/engineyard
and runs
ey deploy --environment <staging> --tag=Bamboo- ${bamboo.buildNumber} --app <my app>
Engine yard does all the rails 'stuff' to prep the build and deploy it. Really just need Bamboo to run test and if it works tag build.
PROBLEM
I am using bitbucket source control and have configured a hook to trigger a bamboo build on any commit to master.
The issue step 4) is pushing a tag which causes bitbucket to execute another build
Resulting in infinitely building bamboo.
Looking into how to solve this. Figured I could use Bamboo 'Exclude Changesets' and filter out a particular commit message
https://confluence.atlassian.com/display/BAMBOO/Bitbucket?focusedCommentId=610435557&#comment-610435557
so my 4) would now look like
git remote remove origin
git remote add origin <my repo>
#create tag
git tag -a Bamboo-${bamboo.buildNumber} - m 'bamboo build'
#push tag
git push origin Bamboo-${bamboo.buildNumber}
However as per the comments on that confluence page. Exclude Changsets isn't a visible option anymore?
I don't understand how I can stop this infinite building loop.
We use Bamboo and a tag doesn't kick off the build for us.
Our tag process is:
git tag -a v1.4.2 -m 'Production Release: [date]
git push origin --tags
Try using the --tags option when pushing.
Related
Well I'm working on rails project. Well I want o upload updated version of whole application on github branch name "dev_Bee". So can you tell me the step wise procedure how to upload my application on a specific branch. Well I'm working on ubuntu so please try to give commands for ubuntu.
Since you are using rails I'll assume your project has already git initiated.
First, you need to stage all the changes and commit
git add .
git commit -m 'Your Commit Message Here'
Then checkout to a new branch of your desired name
git checkout -b dev_Bee
Set your remote repository
git remote set-url origin https://github.com/<gitusernamehere>/<git-repo-name-here>.git
And finally push the changes to remote
git push -u origin dev_Bee
I help to maintain an open source project, Hyrax, which is a rails engine. In order to do QA on new development, we maintain an application that is specifically for QA, Nurax, which should always be updated with the latest master of the rails engine. I have specified the master branch of Hyrax in the Gemfile for Nurax, and if I run bundle update hyrax it will indeed get the latest master version and update the Gemfile.lock accordingly. I can also get Nurax to deploy automatically via Travis. However, that auto-deploy does not automatically update to the latest master of Hyrax before deploying, which is what I really want to happen.
What is the best way to set this up? Should I have travis run a bundle update hyrax and commit that change to Nurax master as part of its build? I've found a few topics about committing from a travis build (e.g., this one). Would it be better to make a new Nurax branch for each PR and deploy that branch? Is there an established pattern for this that I could be following?
Any advice greatly appreciated.
I ended up solving this with a cron job. I checked out a local copy of the code on the server in question, in the home directory of my ubuntu user. I then added the ubuntu user's ssh key to my own github account, and to the account used for capistrano deploy. Then, I set this up to run daily:
#!/usr/local/bin/ruby
# Get the latest nurax master
# Make a branch with today's date and update hyrax
# Push and deploy that branch
today = Time.now.strftime('%Y-%m-%e-%H-%M')
`cd /home/ubuntu/nurax; git checkout master; git pull; git checkout -b "#{today}"`
`cd /home/ubuntu/nurax; bundle update hyrax`
`cd /home/ubuntu/nurax; git commit -a -m 'Daily update for "#{today}"'; git push --set-upstream origin #{today}`
`cd /home/ubuntu/nurax; BRANCH_NAME="#{today}" cap nurax-dev deploy`
`cd /home/ubuntu/nurax; git checkout master; git branch -d "#{today}"; git push origin --delete "#{today}"`
I am completely new to Gitlab because previously I upload project to server using Filezilla. But now I have finished my Laravel projects in my local computer, and I would like to upload it to my could hosting. Currently my project is stored in c:\\xampp\htdocs\myproject.
Please tell me command line step-by-step to achieve this? I am using Putty on window. I can't understand it by reading existing tutorial.
I use DigitalOcean.com's server and yes I registered on gitlab.com to store/upload my project.
As a first approach, you can push directly to DigitalOcean, as describe in this tutorial:
clone your GitLab repo as a bare repo on your DigitalOcean instance (VPS: Virtual Private Server or Droplet)
cd
git clone --bare https://gitlab.com/<yourUsername>/<yourRepo.git>
add a post-receive hook similar to this auto-deploy article
That is:
cat > /home/rails/rails_project.git/hooks/post-receive
(Copy-paste the following lines)
#!/bin/sh
echo "-----------------------------------"
echo "Post receive hook: Updating website"
export GIT_WORK_TREE=/path/to/yourProject
export GIT_DIR=/home/yourUser/yourRepo.git
cd $GIT_WORK_TREE
git pull
git checkout master -f
(type Ctrl+D to exit)
Depending on your deployment path, you might have to execute the git commands as root, but it is best if you can keep your deployment as your username and not root.
But if you don't want to push to DigitalOcean, only to GitLab, you can use instead Git-Auto-Deploy.
Then you can push to GitLab, and that will trigger a deployment to your VPS.
When commits are pushed to your Git repository, the Git server will notify Git-Auto-Deploy by sending a HTTP POST request with a JSON body to a pre configured URL (your-host:8001).
The JSON body contains detailed information about the repository and what event that triggered the request.
Git-Auto-Deploy parses and validates the request, and if all goes well it issues a git pull.
Additionally, Git-Auto-Deploy can be configured to execute a shell command upon each successful git pull, which can be used to trigger custom build actions or test scripts.
So I have deployed my rails app on a VPS with Ubuntu Server and Apache,
following this tutorial . Everything is working perfectly except that I'm not sure on how to continue to develop my app, bitbucket is configured and working but I don't want to commit and push every time since I make a lot of try and errors. So I'm looking for an easy way to continue to develop and test.
I will appreciate any answers and recommendations , thank you.
You can keep building your into local machine.
Create a branch git checkout -b branch_name
You can make changes and test this branch.
git add -A
git commit -m "Suitable message"
git checkout master
git pull origin master
git merge branch_name
git push origin master
P.S : You can continue your development in master branch too.
I have forked rails git://github.com/rails/rails.git at github. My forked repository is at git://github.com/waseem/rails.git. I want to test out some patches submitted by other users to rails mainline. Lets say I want to test out code in migration_status branch at git://github.com/joelmoss/rails.git.
Lets say I
master $ git remote add joelmoss git://github.com/joelmoss/rails.git. and
master $ git remote add mainline git://github.com/rails/rails.git.
I have been pulling from rails mainline into my master.
master $ git pull mainline master
According to http://guides.rubyonrails.org/contributing_to_ruby_on_rails.html#testing-patches I should create a local topic branch and pull in changes from joelmoss/migration_status. So I,
master $ git checkout -b migration_status Create a local topic branch.
And when I do:
migration_status $ git pull joelmoss migration_status
I get a large number of conflicts. I also tried migration_status $ git pull --rebase joelmoss migration_status but I still get conflicts.
In the case of pull --rebase, I think (correct if wrong), git is trying to apply my local changes on top of changes fetched from joelmoss/migration_status. Ideally it should do the opposite. To consider this option, I did following.
master $ git fetch joelmoss
master $ git checkout -b joel_migration_status joelmoss/migration_status and
joel_migration_status $ git rebase master it still gave me lots of conflicts.
How do I pull in patches submitted to one of my local topic branches w/o getting conflicts? I can not resolve those conflicts as I do not know much about what code to keep what not to.
In this case, it looks like joelmoss/migration_status is based off of 3.1.0, which split from mainline/master back in May. So if you merge you're trying to reconcile 4 months worth of development by everyone, in branches that appear to never have been intended to merge.
What you want to do is base your local changes on 3.1 as well. That doesn't guarantee to remove all conflicts, but at least it should be ones you are aware of because it's code you changed directly.
git checkout -b master-3-1 master
git rebase --onto joelmoss/migration_status mainline/master master-3-1