Services: use a newly built container?

I have a workflow where I want to smoke test a container that is built in the same PR that I’m using it from. Imagine a build step that bakes the container, then starting another container.

I currently “hack” it a bit by having a build step that uses docker save to an artifact which is then downloaded for other build steps, then use compose to set it up. Since cache is coming, I can avoid the uploading part - but I’d also like to reduce the overall hacky-ness of using docker compose by using services. Perhaps its possible to restore the cache as a step prior the service is run somehow? Any input much appreciated!

Services are setup before any of the users steps are run so there is no way to use a container in services that does not come from a registry right now.  We discussed some options in this area but we could not come up with a deterministic model to enable this workflow.

For what it’s worth, I’m considering

  • pushing to registry in a previous build (downside: these are clearly not suitable for public) and referencing it (for instance $image_name:PR-$github_sha)

  • staying with not using services but increasing complexity with compose (downside: not very elegant, still requires manual setup for cache/reuse purposes)

We really need to get support for using docker images in steps from private registries.

1 Like