Class: RoboPigeon::GitLab::Client
- Inherits:
-
Object
- Object
- RoboPigeon::GitLab::Client
- Defined in:
- lib/robopigeon/gitlab/client.rb
Class Attribute Summary collapse
-
.branch ⇒ Object
Returns the value of attribute branch.
-
.enabled ⇒ Object
Returns the value of attribute enabled.
-
.pipeline_id ⇒ Object
Returns the value of attribute pipeline_id.
-
.project ⇒ Object
Returns the value of attribute project.
Class Method Summary collapse
- .client ⇒ Object
- .create_tag(ref, tag, message) ⇒ Object
- .get_deployment(environment, page = 0) ⇒ Object
- .merge_request_comment(text, source = branch) ⇒ Object
Class Attribute Details
.branch ⇒ Object
Returns the value of attribute branch.
9 10 11 |
# File 'lib/robopigeon/gitlab/client.rb', line 9 def branch @branch end |
.enabled ⇒ Object
Returns the value of attribute enabled.
9 10 11 |
# File 'lib/robopigeon/gitlab/client.rb', line 9 def enabled @enabled end |
.pipeline_id ⇒ Object
Returns the value of attribute pipeline_id.
9 10 11 |
# File 'lib/robopigeon/gitlab/client.rb', line 9 def pipeline_id @pipeline_id end |
.project ⇒ Object
Returns the value of attribute project.
9 10 11 |
# File 'lib/robopigeon/gitlab/client.rb', line 9 def project @project end |
Class Method Details
.client ⇒ Object
10 11 12 |
# File 'lib/robopigeon/gitlab/client.rb', line 10 def client Gitlab.client end |
.create_tag(ref, tag, message) ⇒ Object
28 29 30 |
# File 'lib/robopigeon/gitlab/client.rb', line 28 def create_tag(ref, tag, ) client.create_tag(project, tag, ref, ) end |
.get_deployment(environment, page = 0) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/robopigeon/gitlab/client.rb', line 14 def get_deployment(environment, page = 0) deployments = client.deployments( project, order_by: 'created_at', sort: 'desc', per_page: 20, page: page ) deployment = deployments.select { |dep| dep.environment.name == environment }.first return get_deployment(environment, page + 1) if deployment.nil? && deployments.has_next_page? deployment end |
.merge_request_comment(text, source = branch) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/robopigeon/gitlab/client.rb', line 32 def merge_request_comment(text, source = branch) merge_requests = client.merge_requests(project, source_branch: source) raise "No merge requests exist for branch '#{source}'" if merge_requests.empty? merge_requests.each do |merge_request| client.create_merge_request_discussion(project, merge_request.iid, body: text) end end |