ci: run InstallerAuto.php as apache, not root#782
Merged
Conversation
openemr/openemr#12267 added RootCliGuard, which aborts the CI installer when it runs as root (UID 0). The Install step in test-actions-core is shared across all slots (7.0.4, 8.0.0, 8.1.0, 8.1.1, binary, flex), so add --user apache rather than su-exec (which openemr#743 only added to flex/8.1.1/binary). apache owns the baked source in every slot, so it can write sqlconf.php and generated keys. phpunit steps are unaffected: interface/globals.php skips the guard under PHPUNIT_COMPOSER_INSTALL. Assisted-by: Claude Code
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the shared CI composite action to run the OpenEMR installer script (InstallerAuto.php) inside the container as the apache user rather than as root, avoiding failures introduced by OpenEMR’s RootCliGuard when installer/CLI paths execute with UID 0.
Changes:
- Add
docker compose exec --user apacheto the “Install” step in the shared test action. - Document why the installer must not run as root and why
--useris chosen oversu-exec.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bradymiller
approved these changes
Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add
--user apacheto the Install step intest-actions-core/action.ymlsoInstallerAuto.phpruns as theapacheuser instead of root.Why
openemr/openemr#12267 added
RootCliGuard, which aborts the installer when it runs as a root CLI (UID 0). The CI harness runsInstallerAuto.phpviadocker compose exec, which defaults to root in every slot, so every install-driven test slot now fails the guard.Approach
The Install step is shared across all slots (7.0.4, 8.0.0, 8.1.0, 8.1.1, binary, flex).
--user apacheis portable: theapacheuser (uid 1000) and an apache-ownedopenemr/tree exist in every slot's Dockerfile.su-execwas not an option — #743 only added it to flex/8.1.1/binary, so hardcoding it would break 7.0.4/8.0.0/8.1.0 with "su-exec: not found".phpunit steps are unaffected:
interface/globals.phpskips the guard underPHPUNIT_COMPOSER_INSTALL, so those bootstraps stay exempt even as root.Validation
RootCliGuard/RuntimeException, writessqlconf.phpasapache:apachewith$config = 1, web returns HTTP 302;phpunit --testsuite unit→ 275 tests pass.--user apacheexec — exercised by CI here.Unblocks #777, which only needs a rebase once this lands.
Assisted-by: Claude Code