Hi,
I am trying to use the new report functionality but I do not understand why it does not show up.
In the pipeline, I ran
curl --request PUT 'https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/mySystem-001' \ --header 'Content-Type: application/json' \ --data-raw '{ "title": "Security scan report", "details": "This pull request introduces 10 new dependency vulnerabilities.", "report_type": "SECURITY", "reporter": "mySystem", "link": "http://www.mySystem.com/reports/001", "result": "FAILED", "data": [ { "title": "Duration (seconds)", "type": "DURATION", "value": 14 }, { "title": "Safe to merge?", "type": "BOOLEAN", "value": false } ] }'
it ran just fine when I used the pipeline on the pull-request branch.
Something to appear in the report section of the pull request.
Can someone tell me what is not working here?
Edit: Actually I noticed afterward that the response to curl PUT does not trigger a failure to the pipeline. I receive a "Resource not found" error message but I am unable to find out why.
Best
Hey @Sébastien Gachoud ,
welcome to the Atlassian Community!
Looking at the request you shared, it seems you're not adding credentials for authentication, and thus the API is returning a 'Resource not found' error.
I was able to successfully create a report using the example request below :
curl --location -u USERNAME:APP_PASSWORD --request PUT 'https://api.bitbucket.org/2.0/repositories/test-workspace-4/test_zip_file/commit/401321e808c0e06af7cdf954319f0c66e719e35b/reports/mysystem-001' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "Security scan report",
"details": "This pull request introduces 10 new dependency vulnerabilities.",
"report_type": "SECURITY",
"reporter": "mySystem",
"link": "http://www.mySystem.com/reports/001",
"result": "FAILED",
"data": [
{
"title": "Duration (seconds)",
"type": "DURATION",
"value": 14
},
{
"title": "Safe to merge?",
"type": "BOOLEAN",
"value": false
}
]
}'
Where:
Could you adjust your request as per the example above and let us know how it goes?
Also, I would suggest to test the request locally on your terminal first to confirm it's working and make any necessary adjustments, and once it's working locally, you can update your pipeline to match.
I hope that helps! Let us know in case you have any questions.
Thank you, @Sébastien Gachoud !
Patrik S
Hello,
Thank you for your help. I am actually using the proxy:
curl --proxy 'http://localhost:29418' --request PUT 'http://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/mySystem-001' \ --header 'Content-Type: application/json' \ --data-raw '{ "title": "Security scan report", "details": "This pull request introduces 10 new dependency vulnerabilities.", "report_type": "SECURITY", "reporter": "mySystem", "link": "http://www.mySystem.com/reports/001", "result": "FAILED", "data": [ { "title": "Duration (seconds)", "type": "DURATION", "value": 14 }, { "title": "Safe to merge?", "type": "BOOLEAN", "value": false } ] }'
Best
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.