Install on ubuntu server 12.04.3
sudo /usr/sbin/useradd --create-home --home-dir /usr/local/bamboo --shell /bin/bash bamboo sudo passwd bamboo ps a apt-get install ntp unzip unrar curl sudo apt-get install openjdk-7-jdk java -version
java home?
export JAVA_HOME "/usr/lib/jvm/java-7-openjdk-amd64" sudo cat "/usr/lib/jvm/java-7-openjdk-amd64" >> /home/bamboo/.bashrc sudo cat "/usr/lib/jvm/java-7-openjdk-amd64" >> /etc/profile # global
apt-get install tomcat7 libtcnative-1 apt-get install git-core
wget http://www.atlassian.com/software/bamboo/downloads/binary/atlassian-bamboo-5.1.1.tar.gz
(https://www.atlassian.com/software/bamboo/download)
tar -xf atlassian-bamboo-5.1.1.tar.gz
sudo mv atlassian-bamboo-5.1.1 /usr/local/bamboo sudo chown bamboo:bamboo /usr/local/bamboo/atlassian-bamboo-5.1.1
sudo echo "bamboo.home=/usr/local/bamboo" >> /opt/atlassian-bamboo-5.1.1/atlassian-bamboo/WEB-INF/classes/bamboo-init.properties
apt-get install mysql-server-5.5
create an empty database and a bamboo user
CREATE DATABASE bamboo CHARACTER SET utf8 COLLATE utf8_bin; GRANT ALL PRIVILEGES ON bamboo.* TO 'bamboouser'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES; QUIT
download and install the mysql java connector from http://dev.mysql.com/downloads/connector/j/
tar -xf mysql-connector-java-5.1.26.tar.gz sudo cp mysql-connector-java-5.1.26/mysql-connector-java-5.1.26-bin.jar /opt/atlassian-bamboo-5.1.1/lib
cd /usr/local/bamboo/atlassian-bamboo-5.1.1 bin/start-bamboo.sh bin/stop-bamboo.sh bin/start-bamboo.sh
tail -f logs/catalina.out # ignore the spurious stack trace errors
Sep 27, 2013 10:40:36 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 16876 ms
http://ip-address-or-domain:8085/ # or http://localhost:8085/
Read the Server id, then get a license from: https://my.atlassian.com...
Continue configuring (customized in order to choose MySQL) When configuring the mysql jdbc driver ensure to enter the correct user (bamboouser) and password
If it gets stuck just reload from the root url http://ip-address-or-domain:8085/ (so you can reach http://myserver.com:8085/setup/setupAdminUser.action )
PLAN [STAGES [JOBS [TASKS]]]
STAGES run sequentially (e.g. deploy a VM using fancy scripts with Script Tasks and injecting ssh keys)
JOBS run in parallel
Create a plan Choose a repo (git -> git repo shortcut -> private ssh key)
Create a Job
Create a Task (i.e. SSH Task) enter the user and key or password enter in whatever ssh command (use a ; for multiple commands)
The default job (which you can remove later) is to checkout source code from a source code repository (e.g. provide a git private ssh key and bitbucket repo url)
(the first run will therefore be slow as git clone is definitely slower than git pull)
Force Clean checkbox will remove the temporary build artifacts each time (slower but it's recommended best practice)
best practice is also to use a working sub directory for your source code, e.g. /source
IF you ssh into the bamboo server you can find where each job's working directory is, e.g. /usr/local/bamboo/xml-data/build-dir/HIP-PROD-JOB1
Add a Script task to the default job /bin/date >> date.log
save it and run the plan
viewing the full bamboo build log
http://example.com:8085/download/HIP-PROD-JOB1/build_logs/HIP-PROD-JOB1-2.log
or from your SSH session you can verify: cat /usr/local/bamboo/xml-data/build-dir/HIP-PROD-JOB1/build.log
as an advanced exercise modify your SSH Script Task to use /bin/date +%Y-%m-%d--%H-%M-%S
If you use Java it's easy to get tests creating junit .xml format files, python junit-xml can be used to convert arbitrary results to something the Junit Parser can understand
as long as your junit-xml.py Script Task (with working sub directory /source/tests) outputs an xml
e.g. python integration_test.py example.com >> integration_test.py.xml Add Task -> Junit Parser -> /tests/.xml/ # this will search all directories for the pattern /tests/.xml
An Artifact can be created by a Job (either for long term storage of logs or between job binary passing)
Artifacts -> Create definition -> name, the most important thing is the Copy pattern: */tests/.xml/
http://bamboo0.hipchat.atlassian.com:8085/admin/administer.action On the left (BUILD RESOURCES) there's Executables These are commands (e.g. ls) that you can provide for all agents to use (lists which Plans/Jobs depend on them)
create an executable: ls (/bin/ls)
current local working directory can be referenced with ./ (in script task) date > ./datenow.txt ./xml-data/build-dir/HIP-IT-LOGS/datenow.txt
Configure Plan -> Plan configuration (left before stages) Variables (tab)
VariableName = VariableValue
later referenced as ${bamboo.variableName}
http://example.com:8085/admin/systemInfo.action Gear Symbol (top right corner) -> Bamboo Admin System (bottom left) -> System Information ... lists Server, JAVA, Memory, Paths, REST, plugins, etc.
GET XML FROM REMOTE SERVER INTO BAMBOO
setup a private/public key pair (ssh-keygen)
on the remote server setup a user with authorized_keys useradd -m bamboo mkdir /home/bamboo/.ssh cat id_rsa.pub > /home/bamboo/.ssh/authorized_keys # if necessary manually ssh first to update known_hosts
SSH Task # execute some commands, e.g. make Script Task (get remote xml to this directory, e.g. /usr/local/bamboo/xml-data/build-dir/JOB-NAME) scp -i /usr/local/bamboo/bamboo_id_rsa bamboo@example.com:/home/bamboo/XML/*.xml .
JUnit Parser Task (in the same job in order to access the .xml files) */.xml
Bamboo (Admin) -> Executables -> /bin/bash Add Job -> Task -> Command (bash) (argument: ./myrepo/vmdeploy.sh)
vmdeploy.sh
!/bin/bash
if [ -z "$bamboo_ssh_opts" ]; then echo ERROR: bamboo_ssh_opts is not set; exit 1; fi if [ -z "$bamboo_vmbuilderhost" ]; then echo ERROR: bamboo_vmbuilderhost is not set; exit 1; fi if [ -z "$bamboo_shenvfile" ]; then echo ERROR: bamboo_shenvfile is not set; exit 1; fi
TODO: not make vmdeploy require a hipchat token, maybe use a fake in the meantime
if [ -z "$bamboo_hipchat_token" ]; then echo ERROR: bamboo_hipchat_token is not set; exit 1; fi if [ -z "$bamboo_vmname" ]; then echo ERROR: bamboo_vmname is not set; exit 1; fi
ssh $bamboo_ssh_opts $bamboo_vmbuilderhost "cd btf; git pull" echo "#/bin/bash" > "$bamboo_shenvfile" echo "export HCTOK=$bamboo_hipchat_token" >> "$bamboo_shenvfile" scp $bamboo_ssh_opts ./"$bamboo_shenvfile" $bamboo_vmbuilderhost:/home/bamboo || exit 1
echo "Override Version? $bamboo_buildversion" echo "Override Release? $bamboo_buildrelease"
if [ "$bamboo_buildversion" ] && [ "$bamboo_buildrelease" ]; then ssh $bamboo_ssh_opts $bamboo_vmbuilderhost "source /home/bamboo/$bamboo_shenvfile; \ cd btf; \ make ESX=172.24.32.5 DATASTORE=datastore1 VM=$bamboo_vmname REL=$bamboo_buildrelease VER=$bamboo_buildversion vmdeploy" else ssh $bamboo_ssh_opts $bamboo_vmbuilderhost "source /home/bamboo/$bamboo_shenvfile; \ cd btf; \ make ESX=172.24.32.5 DATASTORE=datastore1 VM=$bamboo_vmname vmdeploy" fi
if [ -z "$bamboo_ssh_key_inject_disable" ]; then echo "injecting bamboo ssh key to new VM, otherwise use admin@ip-address with password hipchat" ssh $bamboo_ssh_opts $bamboo_vmbuilderhost "cd btf; VM=$bamboo_vmname ESX=172.24.32.5 DATASTORE=datastore1 make vminject" fi
Download an Add on Login as an Admin user, Top right -> Configure (gear) -> Add ons Upload an Add on
i.e. https://marketplace.atlassian.com/plugins/com.atlassian.mike.bamboo-hipchat i.e. https://bitbucket.org/atlassian/bamboo-hipchat-plugin/overview
Choose a Build Plan -> Configure Plan -> Notifications (tab) Actions
https://confluence.atlassian.com/display/BAMBOO/Supported+platforms