composer
composer copied to clipboard
Composer unable to apply patches
This github action is unable to apply composer patches, the specific add on I am using is - https://github.com/cweagans/composer-patches It is strange that if I use "composer install" instead of this package then composer can apply the patches. The add on requires "patch" to be installed on the server, I can confirm this was installed on the Ubuntu OS. Are there permission restriction on what this action can do? Perhaps it cannot write/update to the the file system?
Hi @joz-cti,
This isn't something I'm familiar with, but I'll look into it for you as soon as I can.
Any follow up information here would be useful, but I'll pick it up as soon as I get some time.
Cheers, Greg.
composer-patches
I am facing the same issue.
Hi @joz-cti
I'm following up on this as the issue is still unresolved. Please could you help me by showing me the output of your failing workflow? I can't see any reason why this wouldn't work out of the box, as Ubuntu does indeed have diff and patch installed by default.
Thanks, Greg.
Hi Greg,
I will look into this tomorrow and provide you the log
Joz
On Mon, 5 Sept 2022, 22:32 Greg Bowler, @.***> wrote:
Hi @joz-cti https://github.com/joz-cti
I'm following up on this as the issue is still unresolved. Please could you help me by showing me the output of your failing workflow? I can't see any reason why this wouldn't work out of the box, as Ubuntu does indeed have diff and patch installed by default.
Thanks, Greg.
— Reply to this email directly, view it on GitHub https://github.com/php-actions/composer/issues/62#issuecomment-1237470468, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUPGUUINSZAFNVFWY2PLHE3V4ZRG3ANCNFSM5CPDS6XQ . You are receiving this because you were mentioned.Message ID: @.***>
Hi Greg,
I have the same issue with applying compose patches. I can share you the output message, perhaps will help you
patch '-p1' --no-backup-if-mismatch -d '<package_name>' < '<path_to_file_patch.patch'
sh: patch: not found
Interesting - it looks like this is run within sh
rather than bash
, and the patch
command isn't available by default. I'll look into this on the example-composer repository and see if I can replicate, and once it's replicable it's fixable. Thanks for your input @viktor-borysiuk
I've added the help wanted
label because I'm not sure how to fix this myself.
@g105b - First, I'm no expert on Github actions, and could be completely off base, so take it for what its worth. But this is the rabbit trail I've gone down for looking into this.
- Sounds like
patch
command isn't found and I would assume this is a docker issue - You're creating the docker image here: https://raw.githubusercontent.com/php-actions/php-build/cee5b9fa9fbc4c888e7a62bbb7b8eade18e3c56b/php-build.bash
- Looks like the base is only a php base image, not a composer base image
- Looking at a composer docker file (example) you can see they are explicitly installing
patch
in the first run command
So after that rabbit trail... I think adding patch
at least to your docker image in the RUN apk
command is the first place to start. However, I'm not sure how to test this locally.
Also, I guess I would also ask, why not use a composer docker image?
@g105b
OK - I forked 2 of your repos, and I think I have this working.
Simply put, in your php-build.bash file in php-actions/php-build, I changed:
RUN apk add --update --no-cache zip git bash openssh"
to
RUN apk add --update --no-cache bash coreutils git make openssh patch unzip zip"
I added in a few others from composer's docker file.
I want to keep looking into this on my site to make sure it really is working.
Oh that looks a lot simpler than I thought. I'll make that change on php-build
, unless you want to raise a PR for it, then we can test it for real on https://github.com/php-actions/example-composer
Just added a PR. I worked on it a little more yesterday and is working for my case.
Will update this ticket later with the outcome of testing.
Hi - this looks to be working now on a test branch. Please can you give it a run by using this step in your workflow file:
- name: Install dependencies
uses: php-actions/composer@bluecadet
The bluecadet branch is using the PR raised by @pingevt.
Thanks!
@g105b Finally got around to looking into this... At first pass it looks like it is working for my use case.
Has this issue been fixed? I've tried using both the v6 and the bluecadet builds, but still get the same errors reported in this ticket when applying patches.
Here is my workflow:
jobs:
update-composer-lock:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Update lock file"
uses: php-actions/composer@bluecadet
env:
COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
with:
php_version: "8.0"
php_extensions: bcmath gd
ssh_key: ${{ secrets.SSH_KEY }}
ssh_key_pub: ${{ secrets.SSH_KEY_PUB }}
command: update
args: -vvv --with-all-dependencies
- uses: actions/upload-artifact@v3
with:
name: debug-output
path: output.log
The error response I get is:
- Applying patches for drupal/core
https://git.drupalcode.org/project/drupal/-/merge_requests/71.diff (Support entities that are neither content nor config entities[node/3042467])
Executing command (CWD): patch '-p2' --no-backup-if-mismatch -d 'web/core' < '/tmp/63efb2b950e20.patch'
patch '-p2' --no-backup-if-mismatch -d 'web/core' < '/tmp/63efb2b950e20.patch'
sh: patch: not found
Could not apply patch! Skipping
Hey @pingevt I wondered if you could take a look at @shawnachieve's message and compare your issue with theirs?
It may be that there is a different issue here, in which case we can re-open this and I can try to replicate with the supplied yml.
Looks like its still the same error: sh: patch: not found
So thats a bit interesting.
@shawnachieve could you provide some more information? Your composer file or Is this in a public repo we could look at?
The thing I notice from the error message is that it's being generated from a part of the script that's running in sh
rather than bash
... I'm just making a note to myself here for tomorrow when I look at it.
Why is this issue closed, is it resolved? I tried to use "patch" in my composer.json and I am facing the same error.
patch '-p2' --no-backup-if-mismatch -d 'docroot/core' < '/tmp/641d4245c3285.patch' sh: patch: not found
I got the same error "sh: patch: not found" with php-actions/composer@bluecadet.