-
-
Notifications
You must be signed in to change notification settings - Fork 457
Description
Hi,
I found this project just yesterday and got very curios to give it a try 😄
So while playing around today I got to the point where I had some reports to add to a Bitbucket Server instance from a Jenkins job.
But unfortunately I ran into the following issue:
$ export CI_PULL_REQUEST=14
$ export CI_REPO_OWNER=haya14busa
$ export CI_REPO_NAME=reviewdog
$ export CI_COMMIT=$(git rev-parse HEAD)
$ export BITBUCKET_USER="my_user"
$ export BITBUCKET_PASSWORD="my_password"
$ export BITBUCKET_SERVER_URL="https://bitbucket.my-company.com/bitbucket"
$ reviewdog -reporter=bitbucket-code-report
2022/02/16 22:15:05 reviewdog: [start] runner=eslint
2022/02/16 22:15:05 reviewdog: [finish] runner=eslint
reviewdog: failted to delete code insights report: bitubucket API error: 405 Method Not Allowed
After cloning the project locally and enabling debugging of the Bitbucket API client I found that requests were using the wrong URL.
The calls were made to https://bitbucket.my-company.com/rest/...
instead of the expected URL https://bitbucket.my-company.com/bitbucket/rest/...
.
The reason seems to be that the path portion is dropped within this function:
reviewdog/service/bitbucket/server_api_context.go
Lines 43 to 58 in 49afd38
// WithServerVariables adds server variable to context | |
func withServerVariables(ctx context.Context, bbURL string) (context.Context, error) { | |
parsed, err := url.Parse(bbURL) | |
if err != nil { | |
return ctx, fmt.Errorf("failed to parse Bitbucket Server URL: %w", err) | |
} | |
return context.WithValue( | |
ctx, | |
insights.ContextServerVariables, | |
map[string]string{ | |
"protocol": parsed.Scheme, | |
"bitbucketDomain": parsed.Host, | |
}, | |
), nil | |
} |
Unfortunately the error message does not indicate which server or at least service is used in regards to URL or Bitbucket Cloud vs. Bitbucket Server.
I suspected first that I was talking to Bitbucket Cloud by accident due to a wrong configuration.
reviewdog version: v0.14.0