bitbucket-pipeline.yml error: Expected a string but found a mapping

XMLWordPrintable

    • 1
    • Severity 3 - Minor

      Issue Summary

      The following curl command to send API POST request is valid but throws an error in the editor and when running a pipeline:

      Steps to Reproduce

      • Add a step in bitbucket-pipelines.yml step with the below curl command,
      curl --location -g --request PUT 'https://api.bitbucket.org/2.0/repositories/<workspaceID>/<repoSlug>/pipelines_config/variables/{0af2a2ef-cc17-4070-a7ff-f21ae7d558d3}'  --header 'Authorization: Bearer <oauth token here>' \
      --header 'Content-Type: application/json' \
      --data-raw '{"type": "pipeline_variable", 
      "uuid": "{var UUID here}", 
      "key": "DOCKER_HUB_USERNAME", 
      "value": "anyuser", 
      "secured": false}'
      

      Expected Results

      The curl command works and modifies the variable value

      Actual Results

      Pipeline fails with below error,

      There is a YAML syntax error in your bitbucket-pipelines.yml at [line XX, column XX]. Mapping values are not allowed here
      

      Workaround

      Create a .sh file and adding curl command in the .sh file and execute this script from bitbucket-pipelines.yml step

      - step:      
                script: 
                 - chmod +x api.sh
                 - bash api.sh
      

            Assignee:
            Unassigned
            Reporter:
            Swetha Boyapati
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: