Class: Buildkite::Pipeline
- Inherits:
-
Object
- Object
- Buildkite::Pipeline
- Defined in:
- lib/buildkite.rb
Overview
Here is a comment.
Instance Method Summary collapse
- #add_agent(key, value) ⇒ Object
- #add_environment_variable(key, value) ⇒ Object
- #add_notify(notify) ⇒ Object
-
#add_step(step) ⇒ self
Adds a step to the pipeline.
- #build ⇒ Object
-
#initialize ⇒ Pipeline
constructor
A new instance of Pipeline.
- #set_priority(priority) ⇒ Object
- #set_secrets(secrets) ⇒ Object
- #to_json(*_args) ⇒ Object
- #to_yaml ⇒ Object
Constructor Details
#initialize ⇒ Pipeline
Returns a new instance of Pipeline.
11 12 13 14 15 16 17 18 |
# File 'lib/buildkite.rb', line 11 def initialize @steps = [] @agents = nil @env = nil @notify = nil @secrets = nil @priority = nil end |
Instance Method Details
#add_agent(key, value) ⇒ Object
29 30 31 32 |
# File 'lib/buildkite.rb', line 29 def add_agent(key, value) @agents = {} if @agents.nil? @agents[key] = value end |
#add_environment_variable(key, value) ⇒ Object
34 35 36 37 |
# File 'lib/buildkite.rb', line 34 def add_environment_variable(key, value) @env = {} if @env.nil? @env[key] = value end |
#add_notify(notify) ⇒ Object
39 40 41 |
# File 'lib/buildkite.rb', line 39 def add_notify(notify) @notify = notify end |
#add_step(step) ⇒ self
Adds a step to the pipeline.
57 58 59 60 |
# File 'lib/buildkite.rb', line 57 def add_step(step) @steps << step self end |
#build ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/buildkite.rb', line 62 def build pipeline = { "steps" => @steps } pipeline["agents"] = @agents unless @agents.nil? pipeline["env"] = @env unless @env.nil? pipeline["notify"] = @notify unless @notify.nil? pipeline["secrets"] = @secrets unless @secrets.nil? pipeline["priority"] = @priority unless @priority.nil? pipeline end |
#set_priority(priority) ⇒ Object
24 25 26 27 |
# File 'lib/buildkite.rb', line 24 def set_priority(priority) @priority = priority self end |
#set_secrets(secrets) ⇒ Object
20 21 22 |
# File 'lib/buildkite.rb', line 20 def set_secrets(secrets) @secrets = secrets end |
#to_json(*_args) ⇒ Object
74 75 76 |
# File 'lib/buildkite.rb', line 74 def to_json(*_args) JSON.pretty_generate(build, indent: " ") end |
#to_yaml ⇒ Object
78 79 80 |
# File 'lib/buildkite.rb', line 78 def to_yaml build.to_yaml end |