Class: Danger::GitLabCI
Overview
### CI Setup GitLab CI is currently not supported because GitLab’s runners don’t expose the required values in the environment. Namely CI_MERGE_REQUEST_ID does not exist as of yet, however there is an [MR](gitlab.com/gitlab-org/gitlab-ce/merge_requests/5698) fixing this. If that has been merged and you are using either gitlab.com or a release with that change this CISource will work.
Instance Attribute Summary
Attributes inherited from CI
#pull_request_id, #repo_slug, #repo_url
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ GitLabCI
constructor
A new instance of GitLabCI.
- #supported_request_sources ⇒ Object
Methods inherited from CI
available_ci_sources, inherited, #supports?
Constructor Details
#initialize(env) ⇒ GitLabCI
Returns a new instance of GitLabCI.
27 28 29 30 |
# File 'lib/danger/ci_source/gitlab_ci.rb', line 27 def initialize(env) self.repo_slug = env["CI_PROJECT_ID"] self.pull_request_id = env["CI_MERGE_REQUEST_ID"] end |
Class Method Details
.validates_as_ci?(env) ⇒ Boolean
14 15 16 |
# File 'lib/danger/ci_source/gitlab_ci.rb', line 14 def self.validates_as_ci?(env) env.key? "GITLAB_CI" end |
.validates_as_pr?(env) ⇒ Boolean
18 19 20 21 |
# File 'lib/danger/ci_source/gitlab_ci.rb', line 18 def self.validates_as_pr?(env) exists = ["CI_MERGE_REQUEST_ID", "CI_PROJECT_ID", "GITLAB_CI"].all? { |x| env[x] } exists && env["CI_MERGE_REQUEST_ID"].to_i > 0 end |
Instance Method Details
#supported_request_sources ⇒ Object
23 24 25 |
# File 'lib/danger/ci_source/gitlab_ci.rb', line 23 def supported_request_sources @supported_request_sources ||= [Danger::RequestSources::GitLab] end |