Running new config files without committing


#1

I’ve had to push a number of builds to get a working 2.0 config on different projects. This trick has helped me to iterate faster.

curl --user ${CIRCLECI_CLI_TOKEN}: \
     --request POST \
     --form config=@.circleci/config.yml \
     --form notify=false \
     https://circleci.com/api/v1.1/project/github/circleci/discourse/tree/master

This assumes:

  • CIRCLECI_CLI_TOKEN is available locally, and the CircleCI user associated with it has permission to push to the project repo in question (in this case: circleci/discourse).
  • Your config file is at .circleci/config.yml. If you’re using a circle.yml, then adjust the filename accordingly. We currently support both files, but suggest .circleci/config.yml moving forward.

I suggest you use a branch other than master so that you can file away your config experiments from your more useful builds. You’ll have to push a commit to that branch first for CircleCI to pick up on it.


#2

Vim users, you can iterate on your config without leaving your editor with something like:

:nnoremap <leader>rr :!curl --user ${CIRCLECI_CLI_TOKEN}: --request POST --form config=@.circleci/config.yml --form notify=false PROJET_BRANCH_URL<cr>

Then <leader>rr after saving a change in config.yml


#3