I’m undertaking a lot of dev work on a build job and rather than commit each change during development, I wanted to post config using a build request.
I’ve done this using the following:
config=`yaml2json .travis.yml`
body="{
\"request\": {
\"branch\":\"travis-ci\",
\"config\": $config
}}"
echo "$body"
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token xxxxxxxxxxx" \
-d "$body" \
https://api.travis-ci.org/repo/xxxxxxxxxxxx/requests
where yaml2json
is a conversion tool and the .travis.yml file contains merge_mode: replace
.
Everything works as expected except that sections with lists are not replaced, instead they are merged with what already exists on the branch.
This is especially poor when it comes to the way the jobs matrix works as many jobs are created when modifying the env
section and is making development very tedious.
Example job where this is an issue:
https://travis-ci.org/github/theia-ide/theia-apps/builds/693423667/config
It should be producing a matrix of 6 build jobs, but instead creates 69!