Skip to content

Pre-build the main branch of all the tested projects

Adam Coldrick requested to merge sotk/ci/speedup into master

Description

Currently the end-to-end tests work by fetching the source of all the projects to be tested, and building them into an environment image at test runtime. This is nice, but extremely slow in our CI runners (all the e2e tests take around half an hour, the vast majority of which is spent building the projects). Most of the time there's no need to have this slow build time, since we'll want to use the main branch for most of the projects, and will likely be building code that we've already built in previous runs.

This MR splits up the environment image into two. A base image which builds the tip of the main branch of each of the tested projects, and the current e2e-environment stripped down to not fetch any new sources, and only rebuild any sources mounted into the image to override the main branches.

This base image is built in CI and pushed to the container registry, so it can be reused by all the downstream e2e jobs. This avoids the need for the actual test job (and all the downstream test jobs) to build all of buildbox, making the running of the end-to-end test suite much quicker.

Validation

Look at the CI pipeline for this MR to see the kind of time difference this will make.

It may be worth some manual validation, since the CI for this repository doesn't exercise the rebuilding functionality. Fetch down a buildbox project (eg. buildbox-casd) and run the tests as follows.

docker build -t buildbox-e2e-base:local -f e2e-environment-base.dockerfile .
docker build -t e2e .
docker run -e ENV_BASE_IMAGE=buildbox-e2e-base:local -v /var/run/docker.sock:/var/run/docker.sock -v /path/to/buildbox-casd:/buildbox-e2e/src/buildbox-casd -t e2e

You should see the final command rebuild buildbox-casd, but not all of buildbox as would happen previously.

Building the base image and passing it in via ENV_BASE_IMAGE is required since the image won't exist in the registry until this MR is merged. Once this MR is merged and the new image(s) uploaded, downstream jobs should seamlessly start using the new behaviour.

Merge request reports