actions / actions-runner-controller

Kubernetes controller for GitHub Actions self-hosted runners
Apache License 2.0
4.71k stars 1.11k forks source link

Add unzip/git to runner dependencies #51

Closed reiniertimmer closed 4 years ago

reiniertimmer commented 4 years ago

I'm not sure if you're willing to consider this, but for some use cases it would be very helpful to have some additional dependencies installed in the runner. Although it is easy to get around by building your own runner image with the additional dependencies, maybe the following ones could have added value for the official runner image.

unzip

Some tool installation packages use .zip instead of .tgz, which will fail on this runner

git > 2.18

The official checkout action actions/checkout gives the following message when checking out a repository:

The repository will be downloaded using the GitHub REST API
To create a local Git repository instead, add Git 2.18 or higher to the PATH

If you want to work with a local git repo (analyze, commit, etc) then a higher git version is needed. At the moment, the base ubuntu:18.04 image contains git 2.17.1, so in my custom image I install this via ppa (I'm not sure if this is desirable or if there's a viable alternative)

Again - I'm not sure this should be in the official image - it's also very well possible to do without and use a custom runner image

mumoshu commented 4 years ago

I think we should do our best to make the runner image compatible with the managed runner's runtime env. In that sense, I believe this should be good additions to the runner image.

@summerwind WDYT?

mumoshu commented 4 years ago

BTW, where can we find the exact version numbers of binaries and packages installed into the official managed runner VMs? If such thing exists, it should be a good reference for us.

reiniertimmer commented 4 years ago

I think we should do our best to make the runner image compatible with the managed runner's runtime env. In that sense, I believe this should be good additions to the runner image.

The software installations on the VMs is quite extensive https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md

So installing all of that would be a bit much. Most can be installed with various tool installer actions and for most part that is fine I guess.

mumoshu commented 4 years ago

Whoa really! That's too much!

mumoshu commented 4 years ago

Do we even need that many golang versions preinstalled into the VM while we usually use setup/go for setting up the specific go for builds??

https://github.com/actions/setup-go

mumoshu commented 4 years ago

Well anyway, perhaps we can try to install as many packages as possible, as long as one is listed in https://github.com/actions/virtual-environments/blob/master/images/linux/Ubuntu1804-README.md AND there's no setup-XX action exists for that package?

TL;DR;, I still think git (2.26.0) and uzip should be a good starting point.

reiniertimmer commented 4 years ago

Quite a list eh? ;) It could be that most of these are already there for efficiency reasons (so the setup actions don't need to download them). So no, these things should not be in the docker image.

The things that I've come across so far are just unzip & git and for me that works fine for all workflows that I'm running.

reiniertimmer commented 4 years ago

@mumoshu thanks for your feedback, I'll create a PR that adds both dependencies at least. We can discuss further there

summerwind commented 4 years ago

Thank you for the feedback! Basically, I'm in favor of making the runner image to be compatible with the managed runner.

I've actually considered using actions/virtual-environments before, but I've found the following problems with using it.

  1. Installing all the tools will make the container image very large (probably a few GB).
  2. The configuration script in actions/virtual-environments is divided into multiple files, which may be difficult to follow their updates.

I agree with installing basic tools like git or curl, but I think it would be better to maintain the documentation so that users can create their own runner image that meets their requirements.

Thought?

reiniertimmer commented 4 years ago

Thanks for your answer.

Basically, I think it would be very difficult to be completely compatible with the virtual environment.

We could consider installing the tools listed in the "basic CLI" section (because there's usually no setup action for these).. but it's probably very difficult to get it right for most of the users anyway

Customizing the summerwind image is easy to do (you can just use from summerwind/actions-runner:v169.1 and add your changes on top, no need to rebuild the entire image from scratch) and I think this is a perfectly acceptable solution.

So maybe just mentioning this process in the README would be the best solution for everyone in the end

summerwind commented 4 years ago

I totally agree with your opinion. Installing "Basic CLI" to the image is the reasonable way I think. We'll add the following packages in the container image.

We'll also add the instructions for building a custom image to the documentation. Any PR related to this is welcome 😄

reiniertimmer commented 4 years ago

I checked including all your recommended packages @summerwind and the resulting docker image is 725 Mb (compared to the ~400 original).

Edit: I have included this in the related PR as well as some documentation about the runner image

summerwind commented 4 years ago

Thanks for the validation, 725 MB is acceptable to me. I'm really happy with the addition of the documentation as well, thank you!