Class: Danger::Buddybuild
Overview
### CI Setup
Read how you can setup Danger on the buddybuild blog: www.buddybuild.com/blog/using-danger-with-buddybuild/
### Token Setup
Login to buddybuild and select your app. Go to your *App Settings* and in the *Build Settings* menu on the left, choose *Environment Variables*. docs.buddybuild.com/docs/environment-variables
#### GitHub Add the ‘DANGER_GITHUB_API_TOKEN` to your build user’s ENV.
#### GitLab Add the ‘DANGER_GITLAB_API_TOKEN` to your build user’s ENV.
#### Bitbucket Cloud Add the ‘DANGER_BITBUCKETSERVER_USERNAME`, `DANGER_BITBUCKETSERVER_PASSWORD` to your build user’s ENV.
#### Bitbucket server Add the ‘DANGER_BITBUCKETSERVER_USERNAME`, `DANGER_BITBUCKETSERVER_PASSWORD` and `DANGER_BITBUCKETSERVER_HOST` to your build user’s ENV.
### Running Danger
Once the environment variables are all available, create a custom build step to run Danger as part of your build process: docs.buddybuild.com/docs/custom-prebuild-and-postbuild-steps
Instance Attribute Summary
Attributes inherited from CI
#pull_request_id, #repo_slug, #repo_url
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(env) ⇒ Buddybuild
constructor
A new instance of Buddybuild.
- #supported_request_sources ⇒ Object
Methods inherited from CI
available_ci_sources, inherited, #supports?
Constructor Details
#initialize(env) ⇒ Buddybuild
Returns a new instance of Buddybuild.
56 57 58 59 60 |
# File 'lib/danger/ci_source/buddybuild.rb', line 56 def initialize(env) self.repo_slug = env["BUDDYBUILD_REPO_SLUG"] self.pull_request_id = env["BUDDYBUILD_PULL_REQUEST"] self.repo_url = GitRepo.new.origins # Buddybuild doesn't provide a repo url env variable for now end |
Class Method Details
.validates_as_ci?(env) ⇒ Boolean
34 35 36 37 |
# File 'lib/danger/ci_source/buddybuild.rb', line 34 def self.validates_as_ci?(env) value = env["BUDDYBUILD_BUILD_ID"] return !value.nil? && !env["BUDDYBUILD_BUILD_ID"].empty? end |
.validates_as_pr?(env) ⇒ Boolean
40 41 42 43 |
# File 'lib/danger/ci_source/buddybuild.rb', line 40 def self.validates_as_pr?(env) value = env["BUDDYBUILD_PULL_REQUEST"] return !value.nil? && !env["BUDDYBUILD_PULL_REQUEST"].empty? end |
Instance Method Details
#supported_request_sources ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/danger/ci_source/buddybuild.rb', line 46 def supported_request_sources @supported_request_sources ||= [ Danger::RequestSources::GitHub, Danger::RequestSources::GitLab, Danger::RequestSources::BitbucketServer, Danger::RequestSources::BitbucketCloud ] end |