-
Notifications
You must be signed in to change notification settings - Fork 81
Allow non-root container #264
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
Conversation
7be250d to
ef8e11f
Compare
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.
Pull Request Overview
This PR adds support for running containers as non-root users by implementing proper volume permissions and security contexts. The changes address issue #257 by ensuring that file system operations work correctly when containers run with non-root user IDs (specifically user 1001).
Key changes:
- Added security context with
fsGroup: 1001to pod specifications - Created new
WORK_VOLUMEfor the work directory with proper permissions - Updated tar extraction to use
--no-same-ownerflag and explicit permission fixes - Modified init container to create and prepare all required directories
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/k8s/src/k8s/index.ts | Implements core non-root container support with security contexts, volume mounts, and permission handling |
| packages/k8s/src/k8s/utils.ts | Adds WORK_VOLUME constant and updates volume mount configurations |
| packages/k8s/tests/prepare-job-test.ts | Adds test case for non-root container functionality |
| packages/k8s/tests/e2e-test.ts | Formatting cleanup (whitespace only) |
| package.json | Adds lint:fix script for convenience |
Comments suppressed due to low confidence (1)
packages/k8s/src/k8s/index.ts:1
- The
mvcommand will fail if/home/runner/externals/is empty because the glob pattern*won't match anything. This will cause the init container to fail. Consider adding|| trueat the end of the command or checking if the directory is not empty before moving:[ -n \"$(ls -A /home/runner/externals)\" ] && mv /home/runner/externals/* /mnt/externals/ || true
import * as core from '@actions/core'
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| `find ${shlex.quote(containerPath)} -type f -exec chmod u+rw {} \\; 2>/dev/null; ` + | ||
| `find ${shlex.quote(containerPath)} -type d -exec chmod u+rwx {} \\; 2>/dev/null` |
Copilot
AI
Nov 21, 2025
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 three separate find commands can be inefficient for large directory trees. Consider combining them into a single find command with multiple -o (or) operators, or use find ... -type f -exec chmod u+rw {} + -o -type d -exec chmod u+rwx {} + to reduce process spawning overhead. The + instead of \\; will also batch file arguments for better performance.
| `find ${shlex.quote(containerPath)} -type f -exec chmod u+rw {} \\; 2>/dev/null; ` + | |
| `find ${shlex.quote(containerPath)} -type d -exec chmod u+rwx {} \\; 2>/dev/null` | |
| `find ${shlex.quote(containerPath)} \\( -type f -exec chmod u+rw {} + -o -type d -exec chmod u+rwx {} + \\) 2>/dev/null` |
Fixes #257