Giter VIP home page Giter VIP logo

Comments (8)

fgilio avatar fgilio commented on August 21, 2024 4

I'm having this exact same issue when using the PHP 8 image, will share any info I find


EDIT: Oooook. We found an acceptable workaround.
TLDR: Run rm -rf ./vendor before your composer install before deploying.

Now to our analysis 👇🏼

We run all our tests and deploys in GitLab CI (thanks to @lorisleiva 🤗 ). And we have 3 jobs in 3 stages:

  1. preparation stage runs the "composer" job, which runs composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts
  2. testing stage runs the "phpunit" job
  3. deploy stage runs our Vapor deploy script, which runs COMPOSER_MIRROR_PATH_REPOS=1 composer install --prefer-dist --no-ansi --no-interaction --no-progress --optimize-autoloader --no-dev

So, in the composer job we install our dev dependencies because we need them to test the app. The resulting ./vendor directory gets cached by GitLab's CI system and it's automatically made available for the subsequent stages.
That's great, cause it means we install dependencies once and then we can re use that in the testing and deploying stages. So we "deploy the same thing that we tested"...
But that's actually false, cause for production we don't want to install the development dependencies. That's why we use the --no-dev flag in composer in the deploy stage. Keep in mind, we do need those development dependencies to run phpunit.
And when we run it we see a message like:

Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Package operations: 0 installs, 0 updates, 73 removals

That makes sense, we already have access to the cached ./vendor directory from the composer job and now we only need to remove the development dependencies.
That's when things fall apart. I've no idea if this is a bug in composer itself, in a dependency, in our codebase, etc... but composer errors out with the ...GithubActionError.php error when trying to remove the development dependencies. If we remove the --no-dev it works perfectly, but That's A NoNo.

Long story short, our solution is to embrace the fact that composer.lock exists and that this job runs in CI (where the download speed is insanely fast). So we nuke the ./vendor directory running rm -rf ./vendor right before the deployable composer install ... --no-dev.

In the end, I think this is perfectly acceptable.
I'm sure there's a way to tell GitLab to avoid downloading the cached ./vendor directory, or an overall better way to do this. But we've spent way to much time today trying to understand and fix this... so, it's going to stay like this. And, no, it doesn't seen to be related to lorisleiva/laravel-docker:x.x docker images.

I hope this is helpful or at least interesting :)
Please do let me know if anyone finds a better approach.

from laravel-docker.

Majicbob avatar Majicbob commented on August 21, 2024 1

I ran into this same issue with a forked version of 7.4
After some debugging I wasn't able to determine the root cause but it appeared to be on GitLab's end.
Clearing the runner caches on GitLab fixed it for me.

from laravel-docker.

jnbn avatar jnbn commented on August 21, 2024 1

We're having the same error with 8.0 image and still couldn't find any solutions

https://stackoverflow.com/questions/70608657/error-on-composer-before-deploying-on-bitbucket-pipeline

from laravel-docker.

lorisleiva avatar lorisleiva commented on August 21, 2024 1

Hi Franco 👋

Thanks for the detailed report and for sharing it with us!

Do let me know if there's anything this repository can do to improve the developer experience regarding this issue.

from laravel-docker.

admin1for2 avatar admin1for2 commented on August 21, 2024

I have the exact same problem as you : composer updates failing with error finding the file GithubActionError.php.
Did you manage to find a solution ?

Thanks

from laravel-docker.

yoelpc4 avatar yoelpc4 commented on August 21, 2024

@admin1for2 Nope, current solution is upgrading to 7.3 or 7.4

from laravel-docker.

lorisleiva avatar lorisleiva commented on August 21, 2024

Sorry guys, this repo no longer maintains versions below 7.3.

from laravel-docker.

hakanersu avatar hakanersu commented on August 21, 2024

I had same issue and i found a different solution that i post here https://stackoverflow.com/a/71529389/7736155

include(/builds/myapp/myapp-api/vendor/composer/../composer/composer/sr  
  c/Composer/Console/GithubActionError.php): Failed to open stream: No such f  
  ile or directory 

TL;TD

composer command actually not working as expected i download new composer.phar file and everything works fine now.

from laravel-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.