-
Notifications
You must be signed in to change notification settings - Fork 6
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
Update caching for the Linux Runner #37
Update caching for the Linux Runner #37
Conversation
cloudconfig/templates.go
Outdated
sudo mkdir -p $OFS_DIR/upper-layer $OFS_DIR/work-layer $RUN_HOME | ||
sudo chown {{ .RunnerUsername }}:{{ .RunnerGroup }} -R $OFS_DIR/upper-layer $OFS_DIR/work-layer $CACHED_RUNNER $RUN_HOME | ||
sudo mount -t overlay overlay -o lowerdir=$CACHED_RUNNER,upperdir=$OFS_DIR/upper-layer,workdir=$OFS_DIR/work-layer $RUN_HOME || OFS_AVAIL=0 | ||
sudo chown {{ .RunnerUsername }}:{{ .RunnerGroup }} -R $OFS_DIR/upper-layer $OFS_DIR/work-layer $RUN_HOME $RUN_HOME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can skip the chown. If it's cached, it should already have proper ownership. Also, the OFS_DIR thing can be removed. There is no upper-layer or work-layer if we don't use overlay.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also remove the mount -t overlay things. Just check if the folder is there, if not, download and install.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the part regarding the check for .ExtraContext.OFS_DIR
as well, since the only place it was used, was the cached runner
cloudconfig/templates.go
Outdated
@@ -122,25 +90,15 @@ function downloadAndExtractRunner() { | |||
# chown {{ .RunnerUsername }}:{{ .RunnerGroup }} -R /home/{{ .RunnerUsername }}/actions-runner/ || fail "failed to change owner" | |||
} | |||
|
|||
CACHED_RUNNER=$(getCachedToolsPath) | |||
if [ -z "$CACHED_RUNNER" ];then | |||
RUN_HOME="/home/{{ .RunnerUsername }}/actions-runner" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the path defined in this variable is also used in downloadAndExtractRunner
(and probably other places. Could you define the RUN_HOME
variable at the top and just use it throughout the template?
It should reduce the size of the userdata as well.
590e2f7
to
8b640f4
Compare
/home/runner/actions-runner
instead of the/opt/cache/runner/<version>
or/opt/cache/runner/latest
and then copying the content to/home/runner/actions-runner