Class: Jenkins2API::Command::Build

Inherits:
ThorCommand show all
Defined in:
lib/commands/build.rb

Overview

Contains all the commands under build namespace

Instance Method Summary collapse

Instance Method Details

#logs(name, build_id) ⇒ Object

Retrieve logs for a specific job and join them by newline



24
25
26
# File 'lib/commands/build.rb', line 24

def logs(name, build_id)
  puts client.build.logtext_lines(name, build_id).join("\n")
end

#slave_name(name, build_id) ⇒ Object

Displays the name of the slave where the build was executed



11
12
13
14
15
16
17
18
19
20
# File 'lib/commands/build.rb', line 11

def slave_name(name, build_id)
  slave_name = client.build.slave_name(name, build_id)
  if options[:ec2id]
    slave_name = slave_name.match(/(i-[0-9a-zA-Z]+)/)
                           .captures
                           .first
  end

  puts slave_name
end