Class: Danger::Jenkins
Overview
### CI Setup
Ah Jenkins, so many memories. So, if you’re using Jenkins, you’re hosting your own environment. You will want to be using the [GitHub pull request builder plugin](wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin) in order to ensure that you have the build environment set up for PR integration.
With that set up, you can edit your job to add ‘bundle exec danger` at the build action.
### Token Setup
As you own the machine, it’s up to you to add the enviroment variable for the ‘DANGER_GITHUB_API_TOKEN`.
Instance Attribute Summary
Attributes inherited from CI
#pull_request_id, #repo_slug, #repo_url
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ Jenkins
constructor
A new instance of Jenkins.
- #supported_request_sources ⇒ Object
Methods inherited from CI
available_ci_sources, inherited, #supports?
Constructor Details
#initialize(env) ⇒ Jenkins
Returns a new instance of Jenkins.
32 33 34 35 36 37 38 |
# File 'lib/danger/ci_source/jenkins.rb', line 32 def initialize(env) self.repo_url = env["GIT_URL"] self.pull_request_id = env["ghprbPullId"] repo_matches = self.repo_url.match(%r{([\/:])([^\/]+\/[^\/.]+)(?:.git)?$}) self.repo_slug = repo_matches[2] unless repo_matches.nil? end |
Class Method Details
.validates_as_ci?(env) ⇒ Boolean
20 21 22 |
# File 'lib/danger/ci_source/jenkins.rb', line 20 def self.validates_as_ci?(env) env.key? "JENKINS_URL" end |
.validates_as_pr?(env) ⇒ Boolean
24 25 26 |
# File 'lib/danger/ci_source/jenkins.rb', line 24 def self.validates_as_pr?(env) ["ghprbPullId"].all? { |x| env[x] } end |
Instance Method Details
#supported_request_sources ⇒ Object
28 29 30 |
# File 'lib/danger/ci_source/jenkins.rb', line 28 def supported_request_sources @supported_request_sources ||= [Danger::RequestSources::GitHub] end |