How to properly use curl in Travis?

This is slowly driving me crazy. We have an enterprise account, I’m running some JUnit tests and I would like to upload the tests results to my own server, so it’s much easier to browse them.

Basically, all I want do is to call this:

curl -H 'Authorization: Token someToken' -X POST -F filedata=@file.txt

So this is what I’m trying to do in .travis.yml file.

 - curl -H 'Authorization: Token someToken' -X POST -F filedata=@file.txt

The problem is that for the line above I’m getting an error which looks like this:

$ {:"curl -H '\"Authorization"=>"Token someToken\"' -X POST -F filedata=@file.txt"}
/home/travis/ line 45: Token someToken"' -X POST -F filedata=@file.txt}: No such file or directory

This is where I’m stuck and I just get the same error over and over again:

curl -H '"Authorization: Token someToken"'
curl -H "\"Authorization: Token someToken\""
curl -H "'Authorization: Token someToken'"
curl -H '"Authorization": Token someToken'

i feel like being stupid and I know that the fix for this is probably a simple thing, but I’ve felt into that “escape quotes while escaping quotes” thing and if anyone could just point me in the right direction, I would be really grateful.

thank you

In YAML, colons are delimiters that separate map keys and values, as well as key value pairs.

What you have now:

curl -H 'Authorization: token someToken' "$TRAVIS_TAG"

Is explicitly a map with key:

curl -H 'Authorization` and value `token someToken'

The second half of that if you look closely is:


You can see how this creeps into the build script. What you want is a properly quoted string:

  - "curl -H 'Authorization: token someToken' \"$TRAVIS_TAG\"