Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POST /api/2.0/repositories/<org>/<repo>/<commit>/statuses/build fails when Jenkins url not configured #2

Open
ctataryn opened this issue Oct 7, 2016 · 2 comments

Comments

@ctataryn
Copy link

ctataryn commented Oct 7, 2016

If you leave your Jenkins URL pointing at localhost under Manage Jenkins->Configure System->Jenkins Location->Jenkins URL when an api call is made by com.cloudbees.jenkins.plugins.bitbucket.client.BitBucketCloudApiAdapter for:

POST /api/2.0/repositories/<org>/<repo>/<commit>/statuses/build

It will fail with the error:

This response was received:{"error": {"fields": {"url": ["Enter a valid URL."]}, "message": "Bad request"}}

The reason for this is when you leave your Jenkins URL configured for localhost, somewhere along the way the URL is replaced with http://unconfigured-jenkins-location/... When this is passed into the POST body like so:

{"description":"The tests have started...","state":"INPROGRESS","url":"http://unconfigured-jenkins-location/job/myrepo/job/myjob/11/","key":"JENKINS-2","name":"#11"}

The BitBucket API will complain with the aforementioned error.

WORKAROUND:
If you go in and just change the Jenkins URL, everything works right. Even if you change the Jenkins URL back to localhost it's enough just so that field is dirtied and then written to the configuration.

ctataryn referenced this issue in ctataryn/bitbucket-branch-source-plugin Oct 7, 2016
@ljpeters
Copy link

I've encountered a problem with 'unconfigured-jenkins-location' when trying to reach the jenkins build from bitbucket pull request. The URL pointed to http://unconfigured-jenkins-location/... , while the 'Jenkins location' in the jenkins configuration was supplied correctly.

Maybe because the bitbucket-branch-source-plugin was installed áfter the 'Jenkins location' was specified in the jenkins configuration, the URL was not set in the plugin configuration. After altering the jenkins location and then changing it back to the correct URL, the issue was resolved. Now bitbucket receives the correct url to jenkins for pull request builds. This imo confirms the workaround decribed above.

@devpie
Copy link

devpie commented Oct 11, 2017

I also have this issue.

amuniz pushed a commit that referenced this issue Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants