Receiving 404 trying to create report from pipelines

I’ve been following the guide at Code Insights to be able to create a report from inside bitbucket pipelines. From what I understand it basically boils down to:

curl --proxy 'http://localhost:29418' --request PUT "$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/mySystem-001" --header 'Content-Type: application/json' --data-raw "<...>"

However, I am getting a 404 error from this endpoint. I’ve tried also using host.docker.internal as the proxy and tried https and http.

I feel I am missing something obvious but cannot see it.

Welcome to the Atlassian developer community @SandonJoubert,

That does seem like it should work, except for “custom pipes”. How are you making that curl call?

Here’s my bitbucket-pipelines.yml with only relevant details

image: atlassian/default-image:3

# Workflow Configuration

    # ...
    - step:
        name: Upload Report
          - node
          - cd infrastructure/scripts
          - "curl --proxy 'http://localhost:29418' --request PUT '$BITBUCKET_WORKSPACE/$BITBUCKET_REPO_SLUG/commit/$BITBUCKET_COMMIT/reports/linter-001' --header 'Content-Type: application/json' --data-binary '@test.json'"

The .js file creates test.json which looks something like:

  title: 'Lint Report',
  details: 'FAILED (Warnings: 19, Errors: 21, Fatal Errors: 0)',
  report_type: 'BUG',
  reporter: 'Linter',
  result: 'FAILED',
  data: [
    { title: 'Warnings', type: 'NUMBER', value: 19 },
    { title: 'Errors', type: 'NUMBER', value: 21 },
    { title: 'Fatal Errors', type: 'NUMBER', value: 0 }


Thanks for sharing the actual YAML. The translation of strings in Bash alone is confusing and it gets worse with a layer of YAML over it. I’m pretty sure the problem is with single quotes. In Bash, single quotes are just literal strings, with no variable interpolation. So the 404 is because the workspace, repo, and commit aren’t getting plugged into the right slots.

To avoid that problem, and a whole class of YAML string → Bash command problems, I highly recommend putting anything that requires quotes (of any kind) into a script file, and calling the script. At least that gives you the opportunity to change the command to an echo and make sure it looks like you expect.

Thank you that was the solution.

I moved the script out into it’s own .sh file and took note of my quote usage.