Cannot publish reports to local proxy via BitBucket Pipelines

michael.hart
Contributor
April 23, 2020

I've been referring to https://confluence.atlassian.com/bitbucket/code-insights-994316785.html, but I'm having zero luck publishing report to proxy:

http://localhost:29418

When I use "-u" with my user password, publishing works, however via pipeline it doesn't. This is my JSON:

DATA='{
"title": "Report",
"details": "This report shows results of behave tests",
"report_type": "TEST",
"reporter": "text",
"link": "https://myurl.com/'"${BITBUCKET_COMMIT}"'/index.html",
"result": "FAILED",
"data": [
{
"title": "Duration (seconds)",
"type": "DURATION",
"value": 14
},
{
"title": "Safe to merge?",
"type": "BOOLEAN",
"value": false
}
]
}'

 

This is my query:

curl --proxy 'http://localhost:29418' --request PUT "https://api.bitbucket.org/2.0/repositories/myorganization/myrepo/commit/${BITBUCKET_COMMIT}/reports/uiauto-${BITBUCKET_BUILD_NUMBER}" \
--header 'Content-Type: application/json' --data $DATA

 

And this is what I get back:

% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (56) Received HTTP code 400 from proxy after CONNECT

5 answers

4 votes
Taras Postument
Contributor
September 2, 2020

Hey guys!
I was fighting with the same error until I realized the solution.

In order to use `--proxy 'http://localhost:29418'` you need to use  HTTP (and NOT HTTPS) API endpoint `http://api.bitbucket.org/2.0/...`

Examples in the documentation actually show that, but it is super easy to miss :)

Here you can find a working example:
https://bitbucket.org/Trane9991/workspace/snippets/on5ekq

marcoow
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 3, 2020

Thanks so much ❤️ – indeed super easy to miss!

0 votes
Mahdi Malekan
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 21, 2024

Hey guys, I know this was for a long time ago, but still I have hope to find an answer.

I have used this proxy http://localhost:29418 in two different files in the same repository.

One of which is a PUT request to send a report, the other one is a GET request to get the pull-request info.

The first one works fine but the second one returns 404 with the following message:


{"type": "error", "error": {"message": "You may not have access to this repository or it no longer exists in this workspace. If you think this repository exists and you have access, make sure you are authenticated."}}

 

Any idea?

Thanks

0 votes
Taras Postument
Contributor
November 11, 2020

For anyone interested, I add Bitbucket Code Insights support to the reviewdog tool, which allows publishing results of different linters, etc as bitbucket reports.

See it here:

https://github.com/reviewdog/reviewdog#reporter-bitbucket-code-insights-reports--reporterbitbucket-code-report

0 votes
Jaik Dean
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 7, 2020

We're seeing the same, did either of you find a resolution to this?

0 votes
minhoryang
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 10, 2020

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events