2
- >-
    curl
    -X POST
    --data-urlencode
    "payload={\"channel\": \"#space-unit-tests\", \"username\": \"webhookbot\", \"text\": \"Total number of test cases = $((COUNT_TESTS+MAIN_COUNT)).\", \"icon_emoji\": \":ghost:\"}"
    https://hooks.slack.com/services/...

I am trying to post some data to slack using slack api from gitlab ci file using curl but the above code gives me following error:

$ curl # collapsed multi-line command
curl: try 'curl --help' or 'curl --manual' for more information
ERROR: Job failed: exit code 1

is there any problem with my multiline curl command ? I seached here and google but can not find any problem with curl multiline command.

lila
  • 423
  • 1
  • 4
  • 16
  • This might be related to https://stackoverflow.com/questions/42560083/multiline-yaml-string-for-gitlab-ci-gitlab-ci-yml – pii_ke Jun 10 '18 at 14:04

1 Answers1

0

Add curl command after a pipe symbol in the same format which I attached. It is working Yaml code.

Script:
  -|
   curl -H 'Content-Type: application/json' -d '{"text": "Sample Test"}' "https://outlook.office.com/webhook/..."
Manish Kumar
  • 528
  • 5
  • 11