Example for Code Insight Feature : Annotations added, but does not show up in PR

I am following the example from https://developer.atlassian.com/server/bitbucket/tutorials-and-examples/code-insights-tutorial/ - This does create all objects in the back-end.

However the added annotations are not seen in pull request. How do I debug?


curl -i \
-H "Content-type: application/json" \
-H "Authorization: Bearer $bitbucket_token_password" \
-X PUT \
-d @report.json \
"$BBS_URL/rest/insights/latest/projects/$BBS_PROJECT/repos/$BBS_REPO/commits/$COMMIT_ID/reports/$REPORT_KEY"

echo "delete existing"
curl -i -H "Authorization: Bearer $bitbucket_token_password" -H "X-Atlassian-Token: no-check" -X DELETE "$BBS_URL/rest/insights/latest/projects/$BBS_PROJECT/repos/$BBS_REPO/commits/$COMMIT_ID/reports/$REPORT_KEY/annotations"

echo "add new "

curl  -i  -H "Content-type: application/json" -H "Authorization: Bearer $bitbucket_token_password" -X POST -d @annotations.json "$BBS_URL/rest/insights/latest/projects/$BBS_PROJECT/repos/$BBS_REPO/commits/$COMMIT_ID/reports/$REPORT_KEY/annotations"

file content for
report.json

{
            "title": "IntellijInspection",
            "vendor": "IES",
            "logoUrl": "https://eslint.org/img/logo.svg",
            "data": [
                {
                    "title": "Error Count",
                    "value": 1            
                },
                {
                    "title": "Warning Count",
                    "value": 10
                }
            ]
        }

content for annotatons.json



{
    "annotations": [    {
            "line": 0,
            "message": "Something for file",
            "path": "src/main/java/inspect/app/App.java",
            "severity": "HIGH"
        },
		   {
            "line": 20,
            "message": "Null check",
            "path": "src/main/java/inspect/app/App.java",
            "severity": "HIGH"
        } 
    
    ]
}

The report appears in PR but not the annotations . What am I missing?

1 Like

The file path used was incorrect. This does not give any warning unfortunately

1 Like