Add support for building docker images for local dev

What does this MR do?

This is an initial attempt to re-add support for building docker images of the runner and runner-helper to support local testing workflows.

Why was this MR needed?

As discusssed in !5252 (merged), documentation and general support for building docker mages locally for the runner and runner-helper has stagnated. The steps recommended in the docs no longer worked, and there didn't exist any direct support in the makefiles to easily make it happen. This MR represents my attempt to fix the make side of things, and if we get consensus on the approach, I'd like to update the documentation to make it clear to future users.

What's the best way to test this MR?

There is still one minor ergonomic concern, in that RUNNER_IMAGES_VERSION needs to be supplied on the command line when run outside of CI/CD. (I updated the MR to assign a default RUNNER_IMAGES_VERSION.)

With these changes, the expectation is that running the following with provide images appropriate for local testing in the local docker context:

make runner-and-helper-local-image        # compile the binaries and build the images
make runner-local-image                   # alternatively, just the runner image
make helper-local-image                   # or, just the helper image
docker inspect gitlab-runner:local        # inspect the runner image
docker inspect gitlab-runner-helper:local # inspect the helper image

Currently, only the default alpine linux images is created, for the host machine architecture.

What are the relevant issue numbers?

I think the most relevant issue is still #36965, as I don't see a more specific issue.

Edited by Anthony Juckel

Merge request reports

Loading