docker executor: add platform config option to runner conifg
Description
Docker executor has no option for the platform command line arg of docker (for pull and run).
This option would allow to run different arch via the same host and gitlab-runner service via qemu emulation, in the case somebody either can not provide a functional cross-build environment/pipeline or has a limited number of native runners.
Minor disadvantage: If a runner would support multiple archs that way an image tag can only point to one arch at a time (only an issue if you run into manifest pull limits). Besides arch specific jobs can also use arch specific image tags, if available to avoid this. A third option would be to use separate docker daemon instances for each arch with their own storage path/namespace.
See https://github.com/multiarch/qemu-user-static for a very short example. The image becomes completely agnostic and needs no changes. As can be seen in the examples arch specific images are used for manifest list images (e.g., ubuntu:focal) the platform argument would select the image based on that argument rather than that of host.
docker run --rm --platform linux/arm64 -it ubuntu:focal
Currently, if I did not miss anything, the only way to have multiple arch runners is to use multiple independent gitlab-runner instances on the same host, via the docker images for example. Which of course may need proper resource isolation to avoid possible conflicts(?). Proper resource isolation would imply that each of the instances may access all resources of that host, hence limiting performance if a non-concurrent runner setup were desired.
Proposal
Add an option platform to the docker executor runner config.
[Optional/Followpup] Instead of pulling the tag directly is to fetch and store the manifest-list and get the appropriate image ID to run for that arch to avoid the issue mentioned above. But currently storing seems only to happen in a registry. There is no direct easy solution yet, I guess.
Best regards