danger: Unable to Setup with Bitbucket Server

Hey,

we are currently trying to integrate danger into our internal infrastructure. Sadly we are unable to do so, as the docs seem to be incomplete.

version: computer:App user$ gem list | grep danger danger (4.2.1)

executing danger:

computer:App user$ bundle exec danger local --verbose
bundler: failed to load command: danger (/usr/local/bin/danger)
RuntimeError: danger cannot find your git remote, please set a remote. And the repository must host on GitHub.com or GitHub Enterprise.
 /Library/Ruby/Gems/2.0.0/gems/danger-4.2.1/lib/danger/ci_source/local_git_repo.rb:61:in `raise_error_for_missing_remote'
 /Library/Ruby/Gems/2.0.0/gems/danger-4.2.1/lib/danger/ci_source/local_git_repo.rb:43:in `initialize'
 /Library/Ruby/Gems/2.0.0/gems/danger-4.2.1/lib/danger/danger_core/environment_manager.rb:30:in `new'
 /Library/Ruby/Gems/2.0.0/gems/danger-4.2.1/lib/danger/danger_core/environment_manager.rb:30:in `initialize'
 /Library/Ruby/Gems/2.0.0/gems/danger-4.2.1/lib/danger/commands/local.rb:70:in `new'
 /Library/Ruby/Gems/2.0.0/gems/danger-4.2.1/lib/danger/commands/local.rb:70:in `run'
 /Library/Ruby/Gems/2.0.0/gems/claide-1.0.1/lib/claide/command.rb:334:in `run'
 /Library/Ruby/Gems/2.0.0/gems/danger-4.2.1/bin/danger:5:in `<top (required)>'
 /usr/local/bin/danger:23:in `load'
 /usr/local/bin/danger:23:in `<top (required)>'

environment vars: export DANGER_BITBUCKETSERVER_USERNAME=username export DANGER_BITBUCKETSERVER_PASSWORD=password export DANGER_BITBUCKETSERVER_HOST=address-to-bitbucket-server (e.g. bitbucket.local.com) export GIT_URL=ssh://git@bitbucket.local.com:7999/PROJECTNAME/REPONAME.git

Are there any major missteps on our side?

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 32 (17 by maintainers)

Most upvoted comments

For anyone interested, I got danger (5.8.2) working locally (for testing purposes) with Bitbucket Server as follows:

DANGER_BITBUCKETSERVER_HOST="https://your-bitbucket-server.com" \
DANGER_BITBUCKETSERVER_USERNAME="USERNAME" \
DANGER_BITBUCKETSERVER_PASSWORD="PASSWORD" \
JENKINS_URL="https://your-jenkins.com" \
GIT_URL=ssh://git@your-bitbucket-server.com/project/repo.git \
CHANGE_ID=1 \
bundle exec danger

Couple of notes:

  • JENKINS_URL - It can technically be anything. It is just to force Jenkins behavior of Danger
  • GIT_URL - Address of your GIT repo (set by Jenkins by default)
  • CHANGE_ID - ID of the PR

Make sure your locale is UTF-8 to avoid crashes

printenv LC_ALL
en_US.UTF-8

ISSUE RESOLVED

I just changed DANGER_BITBUCKETSERVER_HOST=“https://XXX@git.TTT.com/path/to/project.git” to DANGER_BITBUCKETSERVER_HOST=“https://git.TTT.com” in above command & it worked. Thank you very much @orta @jeroenvisser101 for you help.