Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

how to generate code report in PRs

Hudhayfah February 23, 2022

I am trying to use code report insights, 

I follows the docs,and I added this to the pipeline

script:
- >
curl --request PUT 'http://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/mysystem-002' \
--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" }'

 however, it does not work


` % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 291 0 0 100 291 0 32333 --:--:-- --:--:-- --:--:-- 32333 `

 

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 28, 2022

Hi @Hudhayfah,

I think there are two issues with the API call you are making:

1. You are not providing any authentication credentials or token in the API call.

You can use either OAuth, or Bitbucket username + app password. You can take a look at the following page and if you have any questions please feel free to let me know:

2. You will need to remove the quotes from the url, so instead of

'http://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/mysystem-002'

use

http://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/mysystem-002

Otherwise, the variables in the URL won't get replaced with their actual values.

Please feel free to let me know how it goes and if you need further help.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events