Skip to content
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

Bug: Extensions setup failing on AWS Hosted runner #916

Open
1 of 2 tasks
uintaam opened this issue Feb 18, 2025 · 3 comments
Open
1 of 2 tasks

Bug: Extensions setup failing on AWS Hosted runner #916

uintaam opened this issue Feb 18, 2025 · 3 comments
Assignees
Labels
bug Something isn't working self-hosted

Comments

@uintaam
Copy link

uintaam commented Feb 18, 2025

Describe the bug

Installation of extensions is failing on AWS hosted runners with

/codebuild/output/src2709930044/src/actions-runner/_work/_actions/shivammathur/setup-php/v2/src/scripts/../scripts/extensions/add_extensions.sh: line 5: semver: parameter null or not set
Error: The process '/usr/bin/bash' failed with exit code 1

Version

  • v2
  • v1

Runners

Self Hosted

Operating systems

Ubuntu 22.04 aws/codebuild/standard:7.0

PHP versions

PHP 8.4

To Reproduce

steps:
  - name: Setup PHP
    uses: shivammathur/setup-php@v2
    with:
      php-version: 8.4
      extensions: mbstring, json, pdo, redis, mailparse, bcmath, curl, gd, fileinfo, intl
      coverage: none
    env:
      runner: self-hosted

Expected behavior

Installs successfully

Screenshots/Logs

==> Setup PHP
✓ PHP Installed PHP 

==> Setup Extensions
✓ mbstring Enabled
✓ json Enabled
✓ pdo Enabled
/codebuild/output/src2709930044/src/actions-runner/_work/_actions/shivammathur/setup-php/v2/src/scripts/../scripts/extensions/add_extensions.sh: line 5: semver: parameter null or not set
Error: The process '/usr/bin/bash' failed with exit code 1

Additional context

This is our first attempt at self hosted runners so we haven't had this working yet.

Are you willing to submit a PR?

Yes

@uintaam uintaam added the bug Something isn't working label Feb 18, 2025
@shivammathur
Copy link
Owner

@uintaam Please run it using shivammathur/setup-php@more-verbose and provide me the logs.

@uintaam
Copy link
Author

uintaam commented Feb 18, 2025

Configuration file '/etc/php/8.4/mods-available/redis.ini'
 ==> File on system created by you or by a script.
 ==> File also in package provided by package maintainer.
 ==> Using new file as you requested.
Installing new version of config file /etc/php/8.4/mods-available/redis.ini ...
Processing triggers for php8.4-cli (8.4.4-1+ubuntu22.04.1+deb.sury.org+1) ...
Processing triggers for php8.4-phpdbg (8.4.4-1+ubuntu22.04.1+deb.sury.org+1) ...
+ add_extension_log redis 'Installed and enabled'
++ echo redis
++ cut -d - -f 1
+ check_extension redis
+ local extension=redis
+ local extension_list=/tmp/php8.4_extensions
+ '[' '!' -e /tmp/php8.4_extensions ']'
+ '[' redis '!=' mysql ']'
+ grep -i -q -w redis /tmp/php8.4_extensions
+ php -m
+ grep -i -q -w redis
/codebuild/output/src1825702414/src/actions-runner/_work/_actions/shivammathur/setup-php/more-verbose/src/scripts/../scripts/extensions/add_extensions.sh: line 5: semver: parameter null or not set
+ sudo rm -rf /tmp/install.sh.lock

@shivammathur
Copy link
Owner

shivammathur commented Feb 18, 2025

@uintaam
Make sure the user you are running the github actions runner has the required access and password less sudo.
Ref: https://github.com/shivammathur/setup-php/wiki/Dockerized-self-hosted-runner-on-Linux

For example to add a user called runner

adduser --disabled-password --gecos '' runner
usermod -aG sudo runner
mkdir -m 777 -p /home/runner
sed -i 's/%sudo\s.*/%sudo ALL=(ALL:ALL) NOPASSWD : ALL/g' /etc/sudoers

Add the runner as this user, then you should be able to run setup-php without any issues on the codebuild standard 7.0 container.
Test run: https://github.com/shivammathur/test-setup-php/actions/runs/13389476304/job/37393682861

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working self-hosted
Projects
None yet
Development

No branches or pull requests

2 participants