Hey there, I’m currently trying to setup a workflow where CircleCI tests our npm front end code, then if the test is successful it should trigger our Docker Hub build.(currently we’re just spoofing it till we can get deployment to work correectly.)
So our stack is basically:
CircleCI --> Docker Hub --> Docker Cloud
What we want to do is give our developers more instantaneous feedback instead of having to wait on a Docker Image to build and then deploy before we know if their code is broken or not.
My circle.yml
file looks as follow:
machine:
node:
version: 5.10.1
dependencies:
cache_directories:
- node_modules
# override:
# - npm prune && npm install
# - npm run build
test:
override:
- echo "Testing docker hub build trigger"
deployment:
staging:
branch: develop
commands:
- $TRIGGER
So that’s the gist of the current circle.yml
file.
The TRIGGER
environment variable is declared manually on the CircleCI web front.
It looks as follow:
curl -H "Content-Type: application/json" --data '{"docker_tag": "${CIRCLE_BRANCH}"}' -X POST https://registry.hub.docker.com/u/[censored]/trigger/[censored trigger]/
I have tried escaping double quotes:
curl -H \"Content-Type: application/json\" --data '{\"docker_tag\": \"${CIRCLE_BRANCH}\"}' -X POST https://registry.hub.docker.com/u/[censored again]/trigger/[just cause its a private repo]/
All in all I’ve tried adding the -g
tag to the cURL command as well but it seems like I get the same errors from CircleCI which are:
curl: (6) Could not resolve host: application
curl: (3) [globbing] unmatched close brace/bracket in column 10
OK
So what happens then in the end is it literally triggers either no builds, or all of the builds. Obviously with Docker Cloud running off of my Docker Hub images and automatically continuously deploying my images as they update I don’t want to randomly just update my latest release or master branches if I’m pushing code to my develop branch.
Any ideas perhaps on how I could go about fixing this? I have gone as far as trying to use a ./deploy.sh
script but the idea is to not add any extra files to the repository if possible…