Top Level Namespace
Defined Under Namespace
Modules: RSpec
Instance Method Summary collapse
- #job(stage_name, name) ⇒ Object
- #pipeline ⇒ Object
- #pull_request ⇒ Object
-
#push_to_branch(name) ⇒ Object
events.
- #push_to_master ⇒ Object
- #stage(name) ⇒ Object
- #step(stage_name, job_name, name) ⇒ Object
Instance Method Details
#job(stage_name, name) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rspec/pipeline/helper.rb', line 23 def job(stage_name, name) job = stage(stage_name)['jobs'].find { |item| item['job'] == name } raise "Job not found: #{name}" if job.nil? job['blockType'] = 'Job' job['blockName'] = job['job'] job end |
#pipeline ⇒ Object
6 7 8 9 10 |
# File 'lib/rspec/pipeline/helper.rb', line 6 def pipeline pipeline = RSpec::Pipeline::PipelineLoader.new(pipeline_name) pipeline.load end |
#pull_request ⇒ Object
60 61 62 |
# File 'lib/rspec/pipeline/helper.rb', line 60 def pull_request # TODO end |
#push_to_branch(name) ⇒ Object
events
48 49 50 51 52 53 54 |
# File 'lib/rspec/pipeline/helper.rb', line 48 def push_to_branch(name) { 'type' => :push, 'branch' => name, 'condition' => "eq(variables['build.sourceBranch'], 'refs/heads/#{name}'" } end |
#push_to_master ⇒ Object
56 57 58 |
# File 'lib/rspec/pipeline/helper.rb', line 56 def push_to_master push_to_branch 'master' end |
#stage(name) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rspec/pipeline/helper.rb', line 12 def stage(name) stage = pipeline['stages'].find { |item| item['stage'] == name } raise "Stage not found: #{name}" if stage.nil? stage['blockType'] = 'Stage' stage['blockName'] = stage['stage'] stage end |
#step(stage_name, job_name, name) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rspec/pipeline/helper.rb', line 34 def step(stage_name, job_name, name) job_to_search = job(stage_name, job_name) raise "Job #{job_name} doesn't have steps" unless job_to_search['steps'] step = job_to_search['steps'].find { |item| item['name'] == name } raise "Step not found: #{name} (available: #{job_to_search['steps'].map { |item| item['name'] }})" if step.nil? step['blockType'] = 'Step' step['blockName'] = step['name'] step end |