Module: RoboPigeon::Dsl::Helpers::GitLab

Included in:
RoboPigeon::Dsl::Helpers
Defined in:
lib/robopigeon/gitlab/helper_dsl.rb

Instance Method Summary collapse

Instance Method Details

#deployment_code_change_stats(environment) ⇒ Object



43
44
45
46
# File 'lib/robopigeon/gitlab/helper_dsl.rb', line 43

def deployment_code_change_stats(environment)
  dep = RoboPigeon::GitLab::Client.get_deployment(environment)
  `git diff --shortstat #{dep.sha}`.strip
end


19
20
21
22
# File 'lib/robopigeon/gitlab/helper_dsl.rb', line 19

def deployment_diff_link(environment)
  dep = RoboPigeon::GitLab::Client.get_deployment(environment)
  "#{ENV['CI_PROJECT_URL']}/compare/#{dep.ref}...#{ENV['CI_COMMIT_TAG']}"
end

#deployment_ref(environment) ⇒ Object



13
14
15
16
# File 'lib/robopigeon/gitlab/helper_dsl.rb', line 13

def deployment_ref(environment)
  dep = RoboPigeon::GitLab::Client.get_deployment(environment)
  dep.ref
end

#deployment_sha(environment) ⇒ Object



7
8
9
10
# File 'lib/robopigeon/gitlab/helper_dsl.rb', line 7

def deployment_sha(environment)
  dep = RoboPigeon::GitLab::Client.get_deployment(environment)
  dep.sha
end

#deployment_shortlog(environment) ⇒ Object



25
26
27
28
# File 'lib/robopigeon/gitlab/helper_dsl.rb', line 25

def deployment_shortlog(environment)
  dep = RoboPigeon::GitLab::Client.get_deployment(environment)
  `git shortlog --no-merges #{dep.sha}..`.strip
end

#deployment_time(environment) ⇒ Object



31
32
33
34
# File 'lib/robopigeon/gitlab/helper_dsl.rb', line 31

def deployment_time(environment)
  dep = RoboPigeon::GitLab::Client.get_deployment(environment)
  dep.deployable.finished_at
end


37
38
39
40
# File 'lib/robopigeon/gitlab/helper_dsl.rb', line 37

def environment_link(environment)
  dep = RoboPigeon::GitLab::Client.get_deployment(environment)
  "#{ENV['CI_PROJECT_URL']}/environments/#{dep.environment.id}"
end

#tickets_in_log_since_deployment_to(environment, matcher = /[A-Za-z]+-\d+/) ⇒ Object



57
58
59
60
61
# File 'lib/robopigeon/gitlab/helper_dsl.rb', line 57

def tickets_in_log_since_deployment_to(environment, matcher=/[A-Za-z]+-\d+/)
  dep = RoboPigeon::GitLab::Client.get_deployment(environment)
  log = `git log #{dep.sha}..`
  log.scan(matcher)
end