actions-runner-controller icon indicating copy to clipboard operation
actions-runner-controller copied to clipboard

Enhance ARC runner image dockerfiles for RunnerScaleSet compatibility

Open mumoshu opened this issue 2 years ago • 7 comments

Hi! I made our current runner images work with the new RunnerScaleSet.

Let me share how so everyone can try and figure out how to build custom runner images that contain more tools and software you like 👋

I'm submitting this as a pull request because it doesn't break our current runner images and is worth merging for a better experience migrating to the new ARC!


There are only a few differences between the new and the current runner images.

TL;DR; We can add some dockerfile build args and envs and make the part that calls config.sh to be conditional and that's all you need to make it work with RunnerScaleSet.

Here are the differences:

Current New
Images https://hub.docker.com/r/summerwind/actions-runner, https://github.com/orgs/actions-runner-controller/packages https://github.com/actions/runner/pkgs/container/actions-runner
Dockerfiles https://github.com/actions/actions-runner-controller/tree/master/runner https://github.com/actions/runner/tree/main/images
$HOME /runner /home/runner
Location of source "externals" dir /runner/externalstmp /home/runner/externals
How you copy externals for dind sidecar startup.sh within runner container runs cp Init container runs cp
Token registration Controller creates a registration token and config.sh within runner obtains another token for actions/runner Controller obtains the token and runner uses it as-is, without config.sh

And apparently, the changes introduced via this pull request is all you need to make it work for both.

You can build e.g., an Ubuntu 20.04 runner image that seems to work with the new RunnerScaleSet by overriding some paths via new build args added in this PR:

# Whatever version you want to use for this
DOCKER_REPO=yourcontainerregistry/arc-runner-temp-v1-ubuntu-20.04
VER=0.1
docker build \
  --build-arg RUNNER_ASSETS_DIR=/home/runner \
  --build-arg TARGETPLATFORM=linux/amd64 \
  --build-arg RUNNER_VERSION=2.304.0 \
  --build-arg EXTERNALS_DIR_NAME=externals \
  -t $DOCKER_REPO:$VER \
  -f runner/actions-runner.ubuntu-20.04.dockerfile \
  runner
# Add `--load ` or `--push` if you're using buildx!

mumoshu avatar May 23 '23 02:05 mumoshu

Awesome work as usual @mumoshu ! Do you want me to test this or you're confident with your tests?

Link- avatar May 25 '23 17:05 Link-

JFY: I tested this pull request as https://github.com/int128/actions-runner-controller-in-actions/pull/6. I'm not sure but found the following issues:

  • actions-runner image works perfectly 👍
  • actions-runner-dind image:
  • actions-runner-dind-rootless image:
    • actions/checkout did not work due to this error: An error occurred trying to start process '/home/runner/externals/node16/bin/node' with working directory '/home/runner/_work/actions-runner-controller-in-actions/actions-runner-controller-in-actions'. No such file or directory

int128 avatar May 30 '23 06:05 int128

I hope this would be an official image for RunnerScaleSets.

We tried ghcr.io/actions/runner image in our organization, but some actions such as ruby/setup-ruby did not work since that image is Debian based.

int128 avatar Jun 02 '23 13:06 int128

Switch from Debian to Ubuntu 22.04 https://github.com/actions/runner/pull/2651

Link- avatar Jun 14 '23 12:06 Link-

Hello. Is this going to get in? I like that this image comes with most required software included, makes it more closely aligned to using the GHA Cloud Runners.

apr-1985 avatar Jul 18 '23 13:07 apr-1985

Pending testing

Link- avatar Sep 07 '23 11:09 Link-

I really like both old and new setups, but in the new setup I do miss the option to run dind in a single image and be able to set precise requests and limits for the whole thing.

rs1986x avatar Sep 17 '23 11:09 rs1986x