Skip to content

fix(ci): Fix bootstrap script and sudo helper for GitHub Actions#16

Merged
ralflang merged 4 commits intoFRAMEWORK_6_0from
fix/ci-sudo-and-bootstrap-issues
Mar 3, 2026
Merged

fix(ci): Fix bootstrap script and sudo helper for GitHub Actions#16
ralflang merged 4 commits intoFRAMEWORK_6_0from
fix/ci-sudo-and-bootstrap-issues

Conversation

@ralflang
Copy link
Member

@ralflang ralflang commented Mar 3, 2026

Summary

Fix multiple issues discovered during Phase 3 CI deployment testing on horde/Http.

Issues Fixed

1. Environment Variable Not Respected (6452f8a9)

Bootstrap script hardcoded PHAR URL instead of respecting environment variable from workflow.

Changed:

COMPONENTS_PHAR_URL="{{COMPONENTS_PHAR_URL}}"

To:

COMPONENTS_PHAR_URL="${COMPONENTS_PHAR_URL:-{{COMPONENTS_PHAR_URL}}}"

Now prefers environment variable while maintaining fallback default.

2. Invalid PHAR Validation Command (989ccc6)

Bootstrap script used --version flag which doesn't exist in horde-components.

Changed: php "$COMPONENTS_PHAR" --version
To: php "$COMPONENTS_PHAR" help

The help command works without arguments and validates PHAR functionality.

3. Wrong Option Name (51fbf11)

Bootstrap script used --mode=github but command expects --ci-mode=github.

Changed: --mode=github
To: --ci-mode=github

4. Sudo When Running as Root (e22316f)

SudoHelper always prefixed commands with sudo even when already running as root (GitHub Actions).

Added:

  • isRoot() method to detect root user (euid 0)
  • Cached result for performance
  • Skip sudo prefix in all methods when running as root

Methods updated:

  • canRunPasswordless() - returns true if root
  • addPpa() - skips sudo if root
  • installPhp() - skips sudo if root
  • installExtension() - skips sudo if root
  • isPhpInstalled() - skips sudo if root

Testing

Tested on horde/Http PR #2:

  • ✅ PHAR downloads from correct URL (org variable)
  • ✅ PHAR validation passes
  • ✅ CI setup command accepts options
  • ⏳ Waiting for sudo fix verification

Impact

Critical fixes for GitHub Actions CI execution. Without these changes:

  • Workflow uses wrong PHAR version (ignores org variable)
  • Bootstrap script fails on PHAR validation
  • CI setup command rejects options
  • All privileged operations fail with sudo errors

Next Steps

After merge:

  1. Release v1.0.0-alpha28
  2. Update org variable to new PHAR URL
  3. Regenerate CI files for horde/Http
  4. Complete Phase 3 deployment validation

ralflang added 4 commits March 3, 2026 19:31
…p script

The bootstrap template was hardcoding the PHAR URL instead of
respecting the environment variable passed from the workflow.

Changed line 14 from:
  COMPONENTS_PHAR_URL="{{COMPONENTS_PHAR_URL}}"

To:
  COMPONENTS_PHAR_URL="${COMPONENTS_PHAR_URL:-{{COMPONENTS_PHAR_URL}}}"

This allows the workflow to pass the organization variable value
while maintaining a fallback default.

Without this fix, the org variable COMPONENTS_PHAR_URL is ignored
and the hardcoded default is always used.
The horde-components PHAR does not support --version flag
(it requires --version-part argument). This caused the bootstrap
script to always fail when validating the downloaded PHAR.

Changed validation from:
  php "$COMPONENTS_PHAR" --version &> /dev/null

To:
  php "$COMPONENTS_PHAR" help &> /dev/null

The help command works without arguments and validates that the
PHAR is executable and functional.

Also removed the redundant --version call after download that
would also fail.
Add isRoot() method to detect if running as root (euid 0) and cache
the result. When running as root, skip the 'sudo' prefix in all
privileged commands.

This fixes CI execution in GitHub Actions where the runner process
runs as root and doesn't need sudo to execute privileged operations.

Changes:
- Add isRoot() static method with cached result
- Update canRunPasswordless() to return true if root
- Update addPpa() to skip sudo if root
- Update installPhp() to skip sudo if root
- Update installExtension() to skip sudo if root
- Update isPhpInstalled() to skip sudo if root

Without this fix, all sudo commands fail in GitHub Actions because
the helper script is called with sudo when already running as root.
@ralflang ralflang merged commit cb34919 into FRAMEWORK_6_0 Mar 3, 2026
1 check failed
ralflang added a commit that referenced this pull request Mar 3, 2026
Release version 1.0.0-alpha28 (API Version: 1.0.0-alpha1)

fix(ci): Fix bootstrap script and sudo helper for GitHub Actions (#16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant