GUIDE

The road ahead will be long and our climb will be steep

Capistrano Deploy to Multiple Servers

| Comments

The key snippet is below:

1
2
3
4
5
6
7
8
9
role :app, %w{xx.xx.xx.xx xx.xx.xx.xx}, user: 'ubuntu', primary: true

set :pty, true

set :ssh_options, {
  forward_agent: true,
  auth_methods: ["publickey"],
  keys: %w(~/.ssh/id_rsa_jenkins_deploy)
}

The introduce of pty, and some expression of forward_agent.

Different Between Include and Extend in Ruby

| Comments

Example
 1module AAA
 2  def aaa
 3    puts "aaa"
 4  end
 5
 6  def self.bbb
 7    puts "bbb"
 8  end
 9end
10
11class C1
12  include AAA
13end
14
15# C1.bbb  # undefined method `bbb' for C1:Class
16# C1.aaa  # undefined method `aaa' for C1:Class
17C1.new.aaa  # aaa
18# C1.new.bbb  # undefined method `bbb' for #<C1:0x007ff1f414af08>
19
20class C2
21  extend AAA
22end
23
24# C2.bbb  # undefined method `bbb' for C2:Class
25C2.aaa  # aaa
26# C2.new.aaa  # undefined method `aaa' for #<C2:0x007f86ea943298>
27# C2.new.bbb  # undefined method `bbb' for #<C2:0x007fc463117270>

Jenkins Email Notificaiton

| Comments

Email notification with Email-ext plug-in:

  • pre-send scripts

We use Jenkins as our ci server, and we run integration test on firefox on xvfb. Sometime, we receive the email about test failure, caused by xvfb starting failed.

So we want to ignore sending email by this case. As we know, the email-ext plugin can help us. we should write pre-send scripts, but we don’t know how to write them.

How do I write a script to cancel sending email when failure output message contains a specified error message?