Class: Buildkite::Pipeline

Inherits:
Object
  • Object
show all
Defined in:
lib/buildkite.rb

Overview

Here is a comment.

Instance Method Summary collapse

Constructor Details

#initializePipeline

Returns a new instance of Pipeline.



11
12
13
# File 'lib/buildkite.rb', line 11

def initialize
  @steps = []
end

Instance Method Details

#add_step(step) ⇒ self

Adds a step to the pipeline.

Examples:

Adding a CommandStep

command_step = Buildkite::CommandStep.new(label: "Run tests", commands: ["bundle exec rspec"])
pipeline.add_step(command_step)

Adding a BlockStep

block_step = Buildkite::BlockStep.new(label: "Manual approval", block: "Deploy to production")
pipeline.add_step(block_step)

Parameters:

  • step (Buildkite::CommandStep, Buildkite::BlockStep)

    The step to add, which can be either a CommandStep or a BlockStep.

Returns:

  • (self)

    Returns the pipeline itself for chaining.



29
30
31
32
# File 'lib/buildkite.rb', line 29

def add_step(step)
  @steps << step
  self
end

#to_json(*_args) ⇒ Object



34
35
36
# File 'lib/buildkite.rb', line 34

def to_json(*_args)
  JSON.pretty_generate({ steps: @steps }, indent: "    ")
end

#to_yamlObject



38
39
40
# File 'lib/buildkite.rb', line 38

def to_yaml
  { steps: @steps }.to_yaml
end