Skip to content

fix: add runner user alias for GARM image compatibility (ISD-5726)#223

Draft
florentianayuwono wants to merge 12 commits into
mainfrom
fix/garm-image-incompatibility-isd-5726
Draft

fix: add runner user alias for GARM image compatibility (ISD-5726)#223
florentianayuwono wants to merge 12 commits into
mainfrom
fix/garm-image-incompatibility-isd-5726

Conversation

@florentianayuwono
Copy link
Copy Markdown
Contributor

@florentianayuwono florentianayuwono commented May 27, 2026

  1. Applicable spec: ISD278 - Design of MVP GitHub runner charm with GARM as workload

Overview

Adds a runner user as an alias to the ubuntu user in the cloud-init script. Both users share the same UID, GID, and home directory (/home/ubuntu), so /home/runner/actions-runner resolves to the same path as /home/ubuntu/actions-runner.

Rationale

GARM (GitHub Actions Runner Manager) expects a runner user and looks for the runner application at /home/runner/actions-runner. The current image builder only creates an ubuntu user, causing GARM to fail when attempting to boot runners from the produced images.

The user alias approach was chosen over alternatives (e.g. an opt-in garm-support databag field) because it requires a single, minimal change with zero impact on existing deployments.

Juju Events Changes

None.

Module Changes

  • app/src/github_runner_image_builder/templates/cloud-init.sh.j2: Added runner user creation in configure_system_users(). The runner user is created with the same UID/GID as ubuntu and the same home directory, then added to the same groups (docker, microk8s, lxd, sudo).

Library Changes

None.

Checklist

florentianayuwono and others added 2 commits May 27, 2026 16:00
GARM expects a 'runner' user with /home/runner/actions-runner path.
This adds a runner user as an alias to ubuntu (same UID/GID, same home
directory) so GARM can boot runners from images produced by this charm
without breaking existing GitHub runner charm deployments.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@florentianayuwono florentianayuwono self-assigned this May 27, 2026
florentianayuwono and others added 3 commits May 27, 2026 16:06
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to make images produced by the charm compatible with GARM by introducing a runner user “alias” for the existing ubuntu user in the generated cloud-init, and documenting the change via changelog + version bump.

Changes:

  • Add runner user creation steps to the cloud-init template (and update the unit test expected script).
  • Document the GARM compatibility change in docs/changelog.md.
  • Bump application version from 0.14.0 to 0.14.1.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
docs/changelog.md Adds a changelog entry describing the GARM compatibility change.
app/tests/unit/test_openstack_builder.py Updates expected generated cloud-init script to include runner user alias steps.
app/src/github_runner_image_builder/templates/cloud-init.sh.j2 Adds runner user alias creation logic to the cloud-init script.
app/pyproject.toml Bumps project version to 0.14.1.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/github_runner_image_builder/templates/cloud-init.sh.j2
Comment thread app/src/github_runner_image_builder/templates/cloud-init.sh.j2
Comment thread app/tests/unit/test_openstack_builder.py Outdated
Comment thread app/tests/unit/test_openstack_builder.py
…ility

- Add --non-unique to useradd so the duplicate UID is accepted instead
  of silently failing
- Add symlink /home/runner -> /home/ubuntu so GARM's hardcoded
  /home/runner/actions-runner path resolves correctly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread app/src/github_runner_image_builder/templates/cloud-init.sh.j2 Outdated
Use rmdir guard + ln -sfnT to handle all cases:
- No /home/runner: symlink created directly
- /home/runner is a symlink: -f replaces it, -T prevents acting as dir target
- /home/runner is an empty directory: rmdir removes it, then symlink created
- /home/runner is a non-empty directory: rmdir fails silently, ln -sfnT
  then fails loudly (correct - something unexpected occupies that path)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment on lines +178 to +180
# 2>/dev/null || true: ignore errors (e.g. runner user already exists) without failing the script.
/usr/sbin/useradd --non-unique --uid "$UBUNTU_UID" --gid "$UBUNTU_GID" --no-create-home --home-dir /home/ubuntu runner 2>/dev/null || true
/usr/sbin/usermod --append --groups docker,microk8s,lxd,sudo runner 2>/dev/null || true
Comment on lines +182 to +186
# If /home/runner exists as a plain directory (not a symlink), remove it first; otherwise ln -sfnT would
# create the symlink inside the directory instead of replacing it.
# -T: treat destination as a file path, never as a directory target (prevents ln from creating the
# symlink inside /home/runner if it exists as a directory after rmdir fails).
[ -d /home/runner ] && ! [ -L /home/runner ] && rmdir /home/runner 2>/dev/null || true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants