Class: RoboPigeon::Dsl::Jenkins

Inherits:
JenkinsRoot show all
Defined in:
lib/robopigeon/jenkins/dsl.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from JenkinsRoot

#api_key, #api_url, #api_user, #enabled

Methods inherited from Base

#method_missing, #respond_to_missing?

Methods inherited from Job

#gitlab, #jenkins, #jira, #slack

Methods included from Helpers

#skip

Methods included from Helpers::Markdown

#confluence_from_md, #html_from_md, #jira_from_md, #slack_from_md

Methods included from Helpers::GitLab

#deployment_code_change_stats, #deployment_diff_link, #deployment_ref, #deployment_sha, #deployment_shortlog, #deployment_time, #environment_link, #tickets_in_log_since_deployment_to

Methods included from Helpers::Slack

#slack_name_for, #slack_user_for, #slack_user_group

Methods included from Helpers::Jira

#jira_last_created_ticket, #jira_last_created_ticket_link, #jira_last_created_ticket_slack_link, #jira_slack_link

Methods included from Helpers::Git

#changed_since?, #git_branch_merged_source, #git_branch_merged_target, #git_committer_email, #git_committer_name, #git_merger_email, #git_merger_name

Constructor Details

#initializeJenkins

Returns a new instance of Jenkins.



58
59
60
# File 'lib/robopigeon/jenkins/dsl.rb', line 58

def initialize
  self.job = RoboPigeon::Jenkins::Job.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RoboPigeon::Dsl::Base

Instance Attribute Details

#jobObject

Returns the value of attribute job.



57
58
59
# File 'lib/robopigeon/jenkins/dsl.rb', line 57

def job
  @job
end

Class Method Details

.run(run_now = true, &block) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/robopigeon/jenkins/dsl.rb', line 62

def self.run(run_now = true, &block)
  if RoboPigeon::Jenkins::Client.enabled
    instance = new
    instance.instance_eval(&block)
    instance.job.build_and_watch! if run_now
    instance.job
  else
    puts 'Jenkins is disabled, please remove `enabled false` from your global jenkins config'
  end
end

Instance Method Details

#completion_timeout(seconds) ⇒ Object



94
95
96
# File 'lib/robopigeon/jenkins/dsl.rb', line 94

def completion_timeout(seconds)
  job.build_timeout = seconds
end

#name(name) ⇒ Object



90
91
92
# File 'lib/robopigeon/jenkins/dsl.rb', line 90

def name(name)
  job.name = name
end

#param(key, value) ⇒ Object



82
83
84
# File 'lib/robopigeon/jenkins/dsl.rb', line 82

def param(key, value)
  job.params[key] = value
end

#start_timeout(seconds) ⇒ Object



86
87
88
# File 'lib/robopigeon/jenkins/dsl.rb', line 86

def start_timeout(seconds)
  job.start_timeout = seconds
end