fix(container): preserve image init process#2243
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (10)
✅ Files skipped from review due to trivial changes (3)
🚧 Files skipped from review as they are similar to previous changes (5)
📝 WalkthroughWalkthroughThis PR integrates ChangesInit Process Integration
🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
charts/dagu/templates/coordinator-deployment.yaml (1)
27-31:⚠️ Potential issue | 🟠 MajorEnsure
/entrypoint.shprivilege-drop is compatible with the mounted/dataPVCSwitching
command:→args:preserves the image’stiniENTRYPOINT, so Kubernetes now executes/entrypoint.sh:args: - dagu - coordinator - --config - /etc/dagu/dagu.yaml
entrypoint.shends with:
exec sudo ... -u "#${PUID}" -g "#${RUN_GID}" -- "$@"The Helm chart sets no
securityContext/runAsUser/fsGroup, and the image defaultsPUID=${USER_UID}/PGID=${USER_GID}(both default to1000;DOCKER_GID=-1⇒RUN_GID=PGID). That changes the container from running as root (whencommand:bypassed the ENTRYPOINT) to running as1000:1000.Because the entrypoint only
mkdir -p $DAGU_HOME(and the chart setsDAGU_HOME=/data) withoutchowning the mounted PVC, pre-existing/datapermissions that were root-owned or otherwise not readable/writable by UID 1000 may break pods after this change.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@charts/dagu/templates/coordinator-deployment.yaml` around lines 27 - 31, The container now runs the image ENTRYPOINT which drops privileges to PUID/PGID (PUID/PGID → RUN_GID) and may be unable to write the mounted /data (DAGU_HOME); add a compatible securityContext and/or an init step: set pod.spec.containers[*].securityContext to runAsUser: <PUID> and fsGroup: <RUN_GID> (make these values configurable via chart values), or add an initContainer that runs as root to mkdir -p $DAGU_HOME and chown it to the same UID/GID before the main container starts; reference the args block (switch to ENTRYPOINT), entrypoint.sh privilege-drop, PUID, RUN_GID, PGID, and DAGU_HOME when implementing the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/packaging/container_init_test.go`:
- Around line 33-38: Replace raw t.Fatalf checks in container_init_test.go with
stretchr/testify require assertions: where the test currently does string
presence checks using strings.Contains and t.Fatalf (referencing variables
tiniEntrypoint, content, and file), use require.Contains/require.NotContains
(e.g., require.Contains(t, content, tiniEntrypoint, "%s must run /entrypoint.sh
under tini") and require.True/require.False as appropriate) and replace any
readFile error checks with require.NoError(t, err, "read %s", path). Apply the
same pattern to the other occurrences called out (lines around the blocks
referencing content/file at 61-66, 76-81, 88-99) to ensure consistent
testify-style assertions.
---
Outside diff comments:
In `@charts/dagu/templates/coordinator-deployment.yaml`:
- Around line 27-31: The container now runs the image ENTRYPOINT which drops
privileges to PUID/PGID (PUID/PGID → RUN_GID) and may be unable to write the
mounted /data (DAGU_HOME); add a compatible securityContext and/or an init step:
set pod.spec.containers[*].securityContext to runAsUser: <PUID> and fsGroup:
<RUN_GID> (make these values configurable via chart values), or add an
initContainer that runs as root to mkdir -p $DAGU_HOME and chown it to the same
UID/GID before the main container starts; reference the args block (switch to
ENTRYPOINT), entrypoint.sh privilege-drop, PUID, RUN_GID, PGID, and DAGU_HOME
when implementing the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 69d35c92-5519-4e87-9d9a-c9d287d05ecd
📒 Files selected for processing (15)
DockerfileDockerfile.alpineDockerfile.devcharts/dagu/Chart.yamlcharts/dagu/templates/coordinator-deployment.yamlcharts/dagu/templates/scheduler-deployment.yamlcharts/dagu/templates/ui-deployment.yamlcharts/dagu/templates/worker-deployment.yamldeploy/docker/Dockerfile.alpinedeploy/docker/Dockerfile.devdeploy/docker/compose.minimal.yamldeploy/k8s/README.mddeploy/k8s/server-deployment.yamldeploy/k8s/worker-deployment.yamlinternal/packaging/container_init_test.go
There was a problem hiding this comment.
1 issue found across 8 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
Testing
Closes #2237
Summary by CodeRabbit
Release Notes
New Features
tiniinit process (PID 1) to Docker images for improved container process management and signal handling.Improvements
Documentation
Tests
Chores