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: Unable to create file /github/home/.composer/config.json in Github Action #200

Closed
chris-bateman opened this issue Feb 2, 2024 · 6 comments
Assignees
Labels

Comments

@chris-bateman
Copy link

New Issue

Unable to create file /github/home/.composer/config.json

Diagnose

If you use a Composer installation, please specify:

Output of `composer show` command
...REPLACE ME...

If you use Docker image of PHP Lint, please specify:

Output of `docker inspect overtrue/phplint:latest` command
...REPLACE ME...

If you use PHAR version of PHP Lint, please specify:

Output of `phplint.phar --manifest` command
...REPLACE ME...

Summary

Version 9.0.3 works correctly.
Moving to version 9.0.4 or greater results in the below error.

In ConfigCommand.php line 207:
touch(): Unable to create file /github/home/.composer/config.json because No such file or directory                                                     
                                                                               
config [-g|--global] [-e|--editor] [-a|--auth] [--unset] [-l|--list] [-f|--file FILE] [--absolute] [-j|--json] [-m|--merge] [--append] [--source] [--] [<setting-key> [<setting-value>...]]

/entrypoint.sh: line 13: ::error ::touch(): Unable to create file /github/home/.composer/config.json because No such file or directory/vendor/bin/phplint: not found

Github workflow file in use -

phplint:
        name: PHP Lint
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v4
            - uses: overtrue/phplint@9.0.3

Expected behaviour

It runs successfully

Actual behaviour

image

@llaville llaville self-assigned this Feb 4, 2024
@llaville llaville added the bug label Feb 4, 2024
@llaville
Copy link
Collaborator

llaville commented Feb 4, 2024

Found origin of issue.
As I've no more free time today, I'll give explains and fixes later (probably tomorrow)

@llaville
Copy link
Collaborator

llaville commented Feb 5, 2024

It's time to explains and understand why there are issues since v9.0.4, while v9.0.3 works as expected :

Look and compare Dockerfile both versions :

I've introduced a non-root user to avoid issue #182

I've also, introduced a new issue with line https://github.com/overtrue/phplint/blob/9.0.4/Dockerfile#L19.

Look and also compare entrypoint.sh both versions :

Until v9.0.3, PHPLint used Docker root (account), and hardcoded the path with /root/.composer/vendor/bin/phplint

I've tried to removed the hardcoded syntax by using this $(composer config --global home)/vendor/bin/phplint new syntax.

It will be ok, if GitHub Action Runner did not hardcode itself the HOME user directory (with /github/home value).
TL;DR: read actions/runner#863 for more information.

As it's not yet possible, unless GitHub Action team decide to revert their behaviour,
we should come back to a hardcoded path version of PHPLint into entrypoint.sh (but now with the non-root user).

Hope these explains are enough to understand current status of PHPLint !

llaville added a commit that referenced this issue Feb 5, 2024
@llaville
Copy link
Collaborator

llaville commented Feb 5, 2024

Bugfix releases 9.0.7 and 9.1.1 are on way !

/cc @overtrue

llaville added a commit that referenced this issue Feb 5, 2024
…for all context and not only debugging purpose
@llaville
Copy link
Collaborator

llaville commented Feb 5, 2024

Fix already available with version 9.0.8

I'll release then 9.1.1 accordingly

@llaville llaville closed this as completed Feb 5, 2024
llaville added a commit that referenced this issue Feb 5, 2024
@llaville
Copy link
Collaborator

llaville commented Feb 5, 2024

@chris-bateman I recommend to use the latest version 9.1.1 (quite similar to 9.0.8) unless you're still running with PHP 8.0 on your platform

@chris-bateman
Copy link
Author

@llaville Thank you for the quick turn around. Working perfectly now :)
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants