Class: RoboPigeon::Jenkins::Job
- Inherits:
-
Object
- Object
- RoboPigeon::Jenkins::Job
- Defined in:
- lib/robopigeon/jenkins/job.rb
Constant Summary collapse
- DEFAULT_START_TIMEOUT =
45 minutes
(45 * 60)
Instance Attribute Summary collapse
-
#build_opts ⇒ Object
Returns the value of attribute build_opts.
-
#build_timeout ⇒ Object
Returns the value of attribute build_timeout.
-
#jid ⇒ Object
Returns the value of attribute jid.
-
#logs ⇒ Object
Returns the value of attribute logs.
-
#name ⇒ Object
Returns the value of attribute name.
-
#params ⇒ Object
Returns the value of attribute params.
-
#poll_interval ⇒ Object
Returns the value of attribute poll_interval.
Instance Method Summary collapse
- #build_and_watch! ⇒ Object
- #client ⇒ Object
-
#initialize ⇒ Job
constructor
A new instance of Job.
- #job_url(jid) ⇒ Object
- #start_timeout=(timeout) ⇒ Object
Constructor Details
#initialize ⇒ Job
Returns a new instance of Job.
6 7 8 9 10 11 12 13 14 |
# File 'lib/robopigeon/jenkins/job.rb', line 6 def initialize self.build_timeout = 60 * 60 # 60 minutes in seconds self.params = {} self.poll_interval = 10 self.build_opts = { 'build_start_timeout' => DEFAULT_START_TIMEOUT, 'cancel_on_build_start_timeout' => true } end |
Instance Attribute Details
#build_opts ⇒ Object
Returns the value of attribute build_opts.
5 6 7 |
# File 'lib/robopigeon/jenkins/job.rb', line 5 def build_opts @build_opts end |
#build_timeout ⇒ Object
Returns the value of attribute build_timeout.
5 6 7 |
# File 'lib/robopigeon/jenkins/job.rb', line 5 def build_timeout @build_timeout end |
#jid ⇒ Object
Returns the value of attribute jid.
5 6 7 |
# File 'lib/robopigeon/jenkins/job.rb', line 5 def jid @jid end |
#logs ⇒ Object
Returns the value of attribute logs.
5 6 7 |
# File 'lib/robopigeon/jenkins/job.rb', line 5 def logs @logs end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/robopigeon/jenkins/job.rb', line 5 def name @name end |
#params ⇒ Object
Returns the value of attribute params.
5 6 7 |
# File 'lib/robopigeon/jenkins/job.rb', line 5 def params @params end |
#poll_interval ⇒ Object
Returns the value of attribute poll_interval.
5 6 7 |
# File 'lib/robopigeon/jenkins/job.rb', line 5 def poll_interval @poll_interval end |
Instance Method Details
#build_and_watch! ⇒ Object
28 29 30 31 32 33 |
# File 'lib/robopigeon/jenkins/job.rb', line 28 def build_and_watch! self.jid = client.job.build(name, params.to_h, build_opts) puts "Created jenkins job: #{job_url(jid)}" watch_build end |
#client ⇒ Object
16 17 18 |
# File 'lib/robopigeon/jenkins/job.rb', line 16 def client RoboPigeon::Jenkins::Client.client end |
#job_url(jid) ⇒ Object
24 25 26 |
# File 'lib/robopigeon/jenkins/job.rb', line 24 def job_url(jid) "#{RoboPigeon::Jenkins::Client.url}/jobs/#{name}/#{jid}" end |
#start_timeout=(timeout) ⇒ Object
20 21 22 |
# File 'lib/robopigeon/jenkins/job.rb', line 20 def start_timeout=(timeout) build_opts['build_start_timeout'] = timeout end |