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

Update caching for the Linux Runner #37

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

fabi200123
Copy link
Contributor

  • Update cached runner check in the Linux Cloudconfig Template so that it will check for a cached runner based on the existence of the path /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

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
Copy link
Member

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.

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 also remove the mount -t overlay things. Just check if the folder is there, if not, download and install.

Copy link
Contributor Author

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

@@ -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"
Copy link
Member

@gabriel-samfira gabriel-samfira Oct 12, 2024

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.

@fabi200123 fabi200123 force-pushed the update-linux-template branch from 590e2f7 to 8b640f4 Compare October 14, 2024 09:24
@gabriel-samfira gabriel-samfira merged commit 22c7dd7 into cloudbase:main Oct 14, 2024
2 checks passed
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