Atlassian

Atlassian has great apps that are built for Enterprise: Bamboo, Jira, Confluence, Stash, Hipchat …

Bamboo

Benefits:

  • Builds and integration tests are triggered automatically
  • Optimise build performance through parallelism.
  • Leverage elastic resources.
  • Deploy continuously, for example to user acceptance testing (UAT).

Bamboo concepts hierarchy:

  1. Project:   1 or more plans
  2. Plan:       1 (default) or more stages. Executed stages sequentially.
  3. Stage:     1 (default) or more jobs. Can process jobs in parallel, on multiple agents (if available).
  4. Job:        1 or more tasks, executes tasks sequentially on the same agent. (Ordered,
  5. Task:      small unit of work, run sequentially (in a job) on a Bamboo directory.

BambooPlanAnatomy

Stash

Stash is Git repo software. It provides enterprise-level support for:

  1. User Authentication
  2. Repository Security
  3. Bamboo integration
  4. Jira & Confluence integration

Rake (ruby make)

Similar to make, rake is a build tool. It allows users to specify tasks, group tasks in a namespace, and describe dependencies.

Rake is written in Ruby, rakefiles (makefiles equivalent) use Ruby syntax. Rake is part of Ruby standard library (since Ruby version 1.9).

History: Historically command-line is just for single-line tasks, when we need to compile and then link many files, we need build scripts. Later, developers need to add pre & post actions around compiling, like: check-out code, copy build to test location… -> build-automation.

Dependencies:  (=>) this is the dependency symbol.

directory "tmp"
 
  file "tmp/hello.tmp" => "tmp" do
    sh "echo 'Hello' >> 'tmp/hello.tmp'"
  end

Explain: The file depends on the tmp, so before creating the file ‘hello.tmp’, it will create the directory tmp first, then the file, then write Hello into that file.

task :morning_ready => [:off_alarm, :groom, :shower, :breakfast] do
    puts "Morning Ready!"
  end

This defined the task (morning_ready) to depend on 4 other tasks (off_alarm, groom, shower, breakfast).

Function calling: rake morning_ready

 So running rake morning_ready will call 4 other tasks by the same order, then morning_ready task!

Variables: use ENV[“VAR_NAME”] to get the variable from environment.

task :make_coffee do
    cups = ENV["COFFEE_CUPS"] || 2
    puts "Made #{cups} cups of coffee. Shakes are gone."
  end

then called

rake COFFEE_CUPS=2 make_coffee

Namespace: we can group tasks into namespace ! then use namespace:task to refer to the task.

Default task: just run rake alone will launch that task !

task :default => 'morning:turn_off_alarm'

Rule: 

rule '.o' => '.c' do |t|
  sh "cc #{t.source} -c -o #{t.name}"
end

This is a rule for all .o commands. If we run mycode.o -> this rule will apply.

=> means prerequisite: mycode.c needs to exist so the rule can fire.

Bamboo Configuration & Rakefile

In order to Setup Bamboo for my project, we need to

Errors:

2. Command failed with status (65): [set -o pipe fail && …

set -o pipefail && xcrun xcodebuild archive -archivePath /Users/netboot/bamboo-agent-home/xml-data/build-dir/MIF-EB-JOB1/build/FX.xcarchive -scheme 'FX Beta' -workspace FX.xcworkspace -destination generic/platform=iOS | tee build/archive-xcodebuild.log | bundle exec xcpretty -c 

Checking the log in build/archive-xcodebuild.log we found:

CodeSign .. User Interaction is not allowed.

Solution: http://stackoverflow.com/questions/6416121/keychain-wont-unlock-from-jenkins-script-unless-user-logged-in

The reason was that the process was command-line and does not allow UI Pop-up, therefore the “User Interaction is not allowed”. We just moved the Private Key to System, and then Rightclick-Access-add /usr/bin/codesign

Advertisements