Class: Danger::BitbucketPipelines

Inherits:
CI
  • Object
show all
Defined in:
lib/danger/ci_source/bitbucket_pipelines.rb

Overview

### CI Setup

Install dependencies and add a danger step to your ‘bitbucket-pipelines.yml`. “`yaml

script:
  - bundle exec danger --verbose

“‘

#### Token Setup

Add ‘DANGER_BITBUCKETCLOUD_USERNAME` and `DANGER_BITBUCKETCLOUD_USERNAME` to your pipeline repository variable or instead using `DANGER_BITBUCKETCLOUD_OAUTH_KEY` and `DANGER_BITBUCKETCLOUD_OAUTH_SECRET`.

You can find them in Settings > Pipelines > Repository Variables

Instance Attribute Summary

Attributes inherited from CI

#pull_request_id, #repo_slug, #repo_url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CI

available_ci_sources, inherited, #supports?

Constructor Details

#initialize(env) ⇒ BitbucketPipelines

Returns a new instance of BitbucketPipelines.



31
32
33
34
35
# File 'lib/danger/ci_source/bitbucket_pipelines.rb', line 31

def initialize(env)
  self.repo_url = env["BITBUCKET_GIT_HTTP_ORIGIN"]
  self.repo_slug = "#{env["BITBUCKET_REPO_OWNER"]}/#{env["BITBUCKET_REPO_SLUG"]}"
  self.pull_request_id = env["BITBUCKET_PR_ID"]
end

Class Method Details

.validates_as_ci?(env) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/danger/ci_source/bitbucket_pipelines.rb', line 19

def self.validates_as_ci?(env)
  env.key? "BITBUCKET_BUILD_NUMBER"
end

.validates_as_pr?(env) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/danger/ci_source/bitbucket_pipelines.rb', line 23

def self.validates_as_pr?(env)
  env.key? "BITBUCKET_PR_ID"
end

Instance Method Details

#supported_request_sourcesObject



27
28
29
# File 'lib/danger/ci_source/bitbucket_pipelines.rb', line 27

def supported_request_sources
  @supported_request_sources ||= [Danger::RequestSources::BitbucketCloud]
end