Snippets

Taras Postument Curl Code Insights Report Example

Created by Taras Postument
# example snipped for the forum question
# https://community.atlassian.com/t5/Bitbucket-Pipelines-questions/Cannot-publish-reports-to-local-proxy-via-BitBucket-Pipelines/qaq-p/1358924

image: alpine

pipelines:
  default:
    - step:
        script: # Modify the commands below to build your repository.
          - apk add curl
          - export REPORT_NAME=taras=test
          - >
            curl --proxy 'http://localhost:29418' \
              --request PUT \
              --header 'Content-Type: application/json' \
              --data-raw '{
                 "title": "Taras test report",
                 "details": "This pull request was reviewed by Taras",
                 "report_type": "SECURITY",
                 "reporter": "Taras",
                 "result": "FAILED",
                 "data": [
                   {
                     "title": "Duration (seconds)",
                     "type": "DURATION",
                     "value": 333
                   },
                   {
                     "title": "Safe to merge?",
                     "type": "BOOLEAN",
                     "value": false
                   }
                 ]
               }' \
                "http://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/$REPORT_NAME"
          - >
            curl --proxy 'http://localhost:29418' \
              --request PUT \
              --header 'Content-Type: application/json' \
              --data-raw '{
                "title": "Security scan report",
                "annotation_type": "VULNERABILITY",
                "summary": "This line represents a security thread.",
                "severity": "HIGH",
                "path": "bitbucket-pipelines.yml",
                "line": 43
              }' \
              "http://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/$REPORT_NAME/annotations/test1"
          

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.