You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use latest Danger version (8.3.1) in Bitrise over a self hosted bitbucket server with an URL like this: https://{host}/bitbucket/scm/{project}/{repo}.git
After getting the error below described bitbucket_server.rb:61:in 'setup_danger_branches': undefined method '[]' for nil:NilClass (NoMethodError), I forked Danger and I put a few debug prints there.
It turns out that the repo slug calculated in bitrise.rb for a an URL like the one above will be like this /bitbucket/scm/{project}/{repo}.
I don't think this is expected, my first idea to fix this was to replace /bitbucket/scm with an empty string (similar to removing .git in bitrise.rb) but I'd like to know if someone else experienced this issue and if that is the correct way to handle this case.
I workarounded this issue in bitrise setting a fake URL like this, it feels a bit wrong but it works: export GIT_REPOSITORY_URL="https://{host}/{project}/{repo}.git"
What did you do?
Set up Danger in Bitrise, with the required environment variables for Bitbucket Server.
export DANGER_BITBUCKETSERVER_HOST="{HOST}"
export DANGER_BITBUCKETSERVER_PASSWORD="{PASSWORD}"
export DANGER_BITBUCKETSERVER_USERNAME= "{USERNAME}"
And run this:
bundle exec danger --verbose
What did you expect to happen?
Running the Dangerfile and Danger commenting on my Bitbucket Server PR.
What happened instead?
bundler: failed to load command: danger (/Users/vagrant/.rbenv/versions/2.6.5/bin/danger)
/Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/danger-8.3.1/lib/danger/request_sources/bitbucket_server.rb:61:in `setup_danger_branches': undefined method `[]' for nil:NilClass (NoMethodError)
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/danger-8.3.1/lib/danger/danger_core/environment_manager.rb:58:in `ensure_danger_branches_are_setup'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/danger-8.3.1/lib/danger/danger_core/dangerfile.rb:273:in `setup_for_running'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/danger-8.3.1/lib/danger/danger_core/dangerfile.rb:284:in `run'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/danger-8.3.1/lib/danger/danger_core/executor.rb:29:in `run'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/danger-8.3.1/lib/danger/commands/runner.rb:73:in `run'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/danger-8.3.1/bin/danger:5:in `<top (required)>'
from /Users/vagrant/.rbenv/versions/2.6.5/bin/danger:23:in `load'
from /Users/vagrant/.rbenv/versions/2.6.5/bin/danger:23:in `<top (required)>'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/cli/exec.rb:63:in `load'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/cli/exec.rb:63:in `kernel_load'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/cli/exec.rb:28:in `run'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/cli.rb:494:in `exec'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/cli.rb:30:in `dispatch'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/cli.rb:24:in `start'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/exe/bundle:49:in `block in <top (required)>'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
from /Users/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/bundler-2.2.14/exe/bundle:37:in `<top (required)>'
from /Users/vagrant/.rbenv/versions/2.6.5/bin/bundle:23:in `load'
from /Users/vagrant/.rbenv/versions/2.6.5/bin/bundle:23:in `<main>'
Your Environment
Which CI are you running on? Bitrise
Are you running the latest version of Danger? Yes (8.3.1)
What is your Dangerfile? Irrelevant for this issue
The text was updated successfully, but these errors were encountered:
Report
I'm trying to use latest Danger version (8.3.1) in Bitrise over a self hosted bitbucket server with an URL like this:
https://{host}/bitbucket/scm/{project}/{repo}.git
After getting the error below described
bitbucket_server.rb:61:in 'setup_danger_branches': undefined method '[]' for nil:NilClass (NoMethodError)
, I forked Danger and I put a few debug prints there.It turns out that the repo slug calculated in
bitrise.rb
for a an URL like the one above will be like this/bitbucket/scm/{project}/{repo}
.danger/lib/danger/ci_source/bitrise.rb
Lines 56 to 61 in b44e9e4
Problem appears in
bitbucket_server.rb
when trying to get project and slug. In this particular case I gotbitbucket
asproject
andscm
asslug
danger/lib/danger/request_sources/bitbucket_server.rb
Line 36 in b44e9e4
I don't think this is expected, my first idea to fix this was to replace
/bitbucket/scm
with an empty string (similar to removing.git
inbitrise.rb
) but I'd like to know if someone else experienced this issue and if that is the correct way to handle this case.I workarounded this issue in bitrise setting a fake URL like this, it feels a bit wrong but it works:
export GIT_REPOSITORY_URL="https://{host}/{project}/{repo}.git"
What did you do?
Set up Danger in Bitrise, with the required environment variables for Bitbucket Server.
export DANGER_BITBUCKETSERVER_HOST="{HOST}"
export DANGER_BITBUCKETSERVER_PASSWORD="{PASSWORD}"
export DANGER_BITBUCKETSERVER_USERNAME= "{USERNAME}"
And run this:
bundle exec danger --verbose
What did you expect to happen?
Running the Dangerfile and Danger commenting on my Bitbucket Server PR.
What happened instead?
Your Environment
The text was updated successfully, but these errors were encountered: