Class: LabClient::Pipeline
- Includes:
- ClassHelpers
- Defined in:
- lib/labclient/pipelines/pipeline.rb
Overview
Inspect Helper
Instance Attribute Summary
Attributes inherited from Klass
Attributes inherited from LabStruct
Instance Method Summary collapse
- #cancel ⇒ Object
- #delete ⇒ Object
- #inspect ⇒ Object
- #jobs(scope = nil) ⇒ Object
- #reload ⇒ Object
- #retry ⇒ Object
- #variables ⇒ Object
-
#wait_for_status(total_time = 300, sleep_time = 15) ⇒ Object
Wait for Import / Set a Hard Limit.
Methods included from ClassHelpers
Methods inherited from Klass
#api_methods, #collect_project_id, #collect_release_id, #collect_repository_id, date_time_attrs, #format_time?, #group_name, #help, #initialize, #klass, #quiet?, #success?, #to_json, #update_self, user_attrs, #valid_group_project_levels, #verbose
Methods included from Docs
#demo, #desc, #doc, docs, #example, #group_name, #help, json, #markdown, #navigation, #option, #result, #subtitle, #title
Methods included from CurlHelper
Methods included from Logger
Methods inherited from LabStruct
#[], #[]=, #as_json, #client, #initialize, #key?, #keys, #method_missing, #respond_to_missing?, #slice, #success?, #to_h
Constructor Details
This class inherits a constructor from LabClient::Klass
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class LabClient::LabStruct
Instance Method Details
#cancel ⇒ Object
21 22 23 24 |
# File 'lib/labclient/pipelines/pipeline.rb', line 21 def cancel project_id = collect_project_id update_self client.pipelines.cancel(project_id, id) end |
#delete ⇒ Object
26 27 28 29 |
# File 'lib/labclient/pipelines/pipeline.rb', line 26 def delete project_id = collect_project_id client.pipelines.delete(project_id, id) end |
#inspect ⇒ Object
7 8 9 |
# File 'lib/labclient/pipelines/pipeline.rb', line 7 def inspect "#<Pipeline id: #{id}, ref: #{ref}, status: #{status}>" end |
#jobs(scope = nil) ⇒ Object
31 32 33 34 |
# File 'lib/labclient/pipelines/pipeline.rb', line 31 def jobs(scope = nil) project_id = collect_project_id client.jobs.pipeline(project_id, id, scope) end |
#reload ⇒ Object
36 37 38 39 |
# File 'lib/labclient/pipelines/pipeline.rb', line 36 def reload project_id = collect_project_id update_self client.pipelines.show(project_id, id) end |
#retry ⇒ Object
16 17 18 19 |
# File 'lib/labclient/pipelines/pipeline.rb', line 16 def retry project_id = collect_project_id client.pipelines.retry(project_id, id) end |
#variables ⇒ Object
11 12 13 14 |
# File 'lib/labclient/pipelines/pipeline.rb', line 11 def variables project_id = collect_project_id client.pipelines.variables(project_id, id) end |
#wait_for_status(total_time = 300, sleep_time = 15) ⇒ Object
Wait for Import / Set a Hard Limit
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/labclient/pipelines/pipeline.rb', line 44 def wait_for_status(total_time = 300, sleep_time = 15) # running # pending # success # failed # canceled # skipped # manual # created # Wait # [running created pending] # Success # [skipped manual canceled success] # Fail # [failed] Timeout.timeout(total_time) do loop do reload logger.info('Waiting for Pipeline', status: status) unless quiet? break if %w[skipped manual canceled success].include? status raise 'Pipeline failed' if status == 'failed' sleep sleep_time end end end |