Skip to content

Instantly share code, notes, and snippets.

@minho-comcom-ai
Created June 10, 2020 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save minho-comcom-ai/014bef4dd9d04b25d8f4e2c7ab7ed9f8 to your computer and use it in GitHub Desktop.
Save minho-comcom-ai/014bef4dd9d04b25d8f4e2c7ab7ed9f8 to your computer and use it in GitHub Desktop.
# Create the report or replace the existing one
echo "Creating insight report"
echo "https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_FULL_NAME/commits/$BITBUCKET_COMMIT/reports/$REPORT_KEY"
curl \
--proxy 'http://localhost:29418' \
-H "Content-type: application/json" \
-X PUT \
-d @report.json \
"https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_FULL_NAME/commits/$BITBUCKET_COMMIT/reports/$REPORT_KEY"
echo "Done"
# Delete old annotations from the report (they may not exist but it is better to be safe)
echo "Deleting any existing annotations"
curl \
--proxy 'http://localhost:29418' \
-H "X-Atlassian-Token: no-check" \
-X DELETE \
"https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_FULL_NAME/commits/$BITBUCKET_COMMIT/reports/$REPORT_KEY/annotations"
echo "Done"
# Create the annotations
echo "Adding annotations to report"
curl \
--proxy 'http://localhost:29418' \
-H "Content-type: application/json" \
-X POST \
-d @annotations.json \
"https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_FULL_NAME/commits/$BITBUCKET_COMMIT/reports/$REPORT_KEY/annotations"
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment