Using the CircleCI API I'd like to be able to start a pipeline with a configuration provided in the request body.
This would allow to not have to commit any changes to test them. This will be specially helpful when working with macOS executors given that those cannot be ran locally with the CLI tool.
The request would include the commit at which the pipeline will run and it will include the string contents of a configuration file.
A quick (perhaps non-working) sample of how the command could look like:
# Read the YAML file into JSON
config_json=$(yaml2json ./.circleci/config.yml)
# Construct the data payload
data=$(cat <<EOF
{
"tag": "v0.1", // optional
"parallel": 2, //optional, default null
"build_parameters": { // optional
"RUN_EXTRA_TESTS": "true"
},
config: $config_json
}
EOF
)
echo $data | curl -X POST --header "Content-Type: application/json" -H "Circle-Token: <circle-token>" -d @-