Skip to content

Explore rootless Copilot CLI installation for ARC/DinD runners #46046

Description

@lpcox

Summary

The Copilot CLI install script (actions/setup/sh/install_copilot_cli.sh) unconditionally uses sudo to install to /usr/local/bin. This forces ARC/DinD operators to allow privilege escalation in their runner pods, which conflicts with Kubernetes PodSecurity policies that enforce allowPrivilegeEscalation: false.

The AWF install script (install_awf_binary.sh) already solves this with a --rootless flag that installs to ~/.local/bin and ~/.local/lib/ without sudo. The Copilot CLI install could adopt a similar pattern.

Current sudo usage in install_copilot_cli.sh

Line Command Purpose
44 sudo chown -R "$(id -u):$(id -g)" "$COPILOT_DIR" Fix ownership of .copilot dir created by chroot
53 sudo find /tmp -maxdepth 1 -name 'awf-*-chroot-home' ... Clean up stale chroot home dirs
455 sudo install -m 0755 "$wrapper_path" "${INSTALL_DIR}/copilot" Install wrapper script to /usr/local/bin
547 sudo tar -xz -C "${INSTALL_DIR}" -f ... Extract binary to /usr/local/bin
548 sudo chmod +x "${INSTALL_DIR}/copilot" Make binary executable

Proposed approach

Follow the install_awf_binary.sh pattern:

  1. Accept a --rootless flag
  2. When rootless, set INSTALL_DIR="${HOME}/.local/bin" instead of /usr/local/bin
  3. Replace sudo calls with a maybe_sudo wrapper that skips sudo in rootless mode
  4. Append $INSTALL_DIR to $GITHUB_PATH so subsequent steps find the binary
  5. The chown and find cleanup calls may not need sudo at all in rootless mode since the files would be owned by the runner user

Impact

This would allow ARC/DinD runners to enforce allowPrivilegeEscalation: false in their pod security context, removing the last known limitation for ARC/DinD deployments documented in the setup guide.

Related

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions