Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: symlink cached runner instead of copy #25

Closed
wants to merge 1 commit into from

Conversation

maigl
Copy link

@maigl maigl commented May 2, 2024

This should (sometimes dramatically) improve boot times if cache runner image is used.
We currently see that copying those ~500 MB takes around 3 Minutes during boot .. I don't know why it's that slow, and later the disk IO speed seems to be much better, but anyway we could skip that copy step all together.

The only issue is see is if /home is mounted on a different disk than /opt , in this case the symlink would probably not be what you would want. Do you think that is an issue? Am I missing other problems with that?

- this should (sometimes dramatically) improve boot times if cache runner image is used
@maigl maigl marked this pull request as draft May 2, 2024 14:03
@gabriel-samfira
Copy link
Member

Generally speaking as long as symlink targets are absolute paths, it does not matter if the symlink points to a different filesystem. Hard links will complain, but symlinks are just pointers.

The $CACHED_RUNNER contains an absolute path in /opt, so it should be fine to create a link to "$CACHED_RUNNER/actions-runner"

@@ -126,8 +126,8 @@ if [ -z "$CACHED_RUNNER" ];then
sudo ./bin/installdependencies.sh || fail "failed to install dependencies"
else
sendStatus "using cached runner found in $CACHED_RUNNER"
sudo cp -a "$CACHED_RUNNER" "/home/{{ .RunnerUsername }}/actions-runner"
sudo chown {{ .RunnerUsername }}:{{ .RunnerGroup }} -R "/home/{{ .RunnerUsername }}/actions-runner" || fail "failed to change owner"
ln -s "$CACHED_RUNNER"/actions-runner "/home/{{ .RunnerUsername}}/actions-runner" || fail "failed to create symlink"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can quote the entire path:

ln -s "$CACHED_RUNNER/actions-runner" "/home/{{ .RunnerUsername}}/actions-runner" || fail "failed to create symlink"

Variables cannot have slashes in them and the shell does the right thing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. this change is very much relevant for us since it reduces our azure VM boot times quite significantly. However, we will need some more tweaks and changes, so I will close this one for now and create a new one once we're done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't suggesting to not add the change. It was just a nit which can be ignored. The change looked ok. Feel free to reopen when ready.

@maigl maigl closed this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants