Run setup-docker-engine only on certain nodes

docker
2.0

#1

Similar to Run "setup-docker-engine" only on certain branches, but this is about running it only on certain nodes of a parallel build.

My team runs a parallel build, primarily because we have two large codebases in a common repo, and they take about the same amount of time to build and test, so we run them in parallel, which is awesome.

Each branch of the build builds docker images, so setup-docker-engine being global is fine.

I was experimenting today with a 3-wide approach, with a third parallel node doing all the docker stuff. This works great, except that now I really want setup-docker-engine to apply only to this node.

Something like:

    setup-docker-engine:
      nodes:
        - 2

would be great.

Alternatively, if setup-docker-engine could be a binary we can call from shell, you could do:

- run: |
    if [[ $CIRCLE_NODE_INDEX == 2 ]]; then
      setup-docker-engine
    fi

#2

I have a ticket opened internally for this but it has not yet been implemented.


#4

@9len Just a heads up, setup-docker-engine has been standardized as setup_docker_engine. If it works for you now, it might not in the long-term so you’ll want to make sure you get that step changed over.

As for your request/approach, your first example would be my preferred method. Doing that even for Bash commands would be pretty neat to limit to specific nodes.


#5

Thanks, it’s correct in our yaml, I just mistyped it. Having a node list available for all step types would be great. About 1/2 of our steps right now are bash commands guarded by CIRCLE_NODE_INDEX tests.


#6

@rohara what odds would you set of this getting done sometime soon? I think it would shave 20-30% off of my team’s build time if I could init the docker remote on only one node.

(Is there some better way to check status of feature requests besides pinging the thread? Would love to bother you nice people less)


#7

I don’t have an ETA unfortunately. But you can try circleci step halt, like this;

if [ $CIRCLE_NODE_INDEX -gt 0 ] ; then circleci step halt ; fi

What that does is halt the build, allowing you to conditionally run commands after the build halts for other containers.


#8

that is some deep stuff. will try it out.


#10