Automattic / wp-e2e-tests

Automated end-to-end tests for WordPress.com

Home Page:https://github.com/Automattic/wp-calypso

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate using a custom docker image for CircleCI builds

bsessions85 opened this issue · comments

In order to add video recording to our tests, I had to install ffmpeg within the docker image we're using for circleCI. In order to save time on each build, we should look in to using a custom image that is based off the circleCI image, but already has ffmpeg installed. Ideally, we could set it up so that the image is created automatically as we update the node version so that there is little to no maintenance necessary to keep it going.

We used to use a custom image, it was a lot more work to maintain than using a vanilla CircleCI one. Things like updating the node version become more tedious, but we can look into doing it again if this will improve speed/performance.

@hoverduck: your thoughts?

The issue we were having before was that it was a manual process for me to update the Docker image and push it to Hub, then update the Circle config file to pull the new version. And that was further complicated by the fact that different wrapper repos were running on different versions of CircleCI, some of which (Jetpack at least, I think) were using the Docker image and others were using CI 1.0 and the default image. And I was the only one maintaining this piece at the time, so it was a single point of failure.

But I think if you build it right from the start, then it shouldn't be too much extra hassle. Like @bsessions85 mentioned, you can add a step to the build process that rebuilds and pushes the custom image when necessary (#781 - not helpful, just noting for posterity).

And if you properly use Docker image tags, then all the wrapper repos should be able to pick up the changes automatically too. It's generally a bad practice to just use the :latest tag since you don't know what you're really getting, but as long as the CI process itself is the only one in charge of pushing a new image then that should be fine. My main concern when I was working on that was that if I was pushing a development build it would accidentally get tagged latest and CI would break.

HOWEVER - to circle back to the beginning...this may not actually save that much time. You'll have to run some comparisons to see which is faster, installing ffmpeg on every build, or pulling the custom image from Docker Hub. CircleCI does theoretically cache the image, but from what I've seen it was still re-downloading it fairly frequently.

Thinking about caches, though, I wonder if it's possible to get a pre-compiled version of ffmpeg with its libraries and just cache those directories directly. Then you could keep using the stock CircleCI image.