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

Add possibility to switch between Composer 1 and Composer 2 #296

Closed
norgeindian opened this issue Feb 11, 2021 · 13 comments · Fixed by #302
Closed

Add possibility to switch between Composer 1 and Composer 2 #296

norgeindian opened this issue Feb 11, 2021 · 13 comments · Fixed by #302
Labels
enhancement New feature or request
Milestone

Comments

@norgeindian
Copy link
Contributor

Magento 2.4.1 supports only Composer1 whereas Magento 2.4.2 supports Composer 2 as well.
So it would be great if this could be a setting to switch between the versions

@Den4ik
Copy link

Den4ik commented Feb 12, 2021

@norgeindian composer1 and compose2 alredy preinstalled.
You may use it by composer or composer2 commands

@norgeindian
Copy link
Contributor Author

norgeindian commented Feb 12, 2021

@Den4ik , just tried it. Does not work in the warden shell.
Even in the current develop branch, composer2 is not found.
And nevertheless it would be great, if only one of both would be installed, so that I don't have to think about which one to use in a specific project

@Den4ik
Copy link

Den4ik commented Feb 12, 2021

@norgeindian Looks like you have older pulled docker images. Please, try to pull latest
Just checked with latest image
docker run --rm -it wardenenv/php-fpm:7.2 bash

Command to help update all pulled images:
docker images | grep -v REPOSITORY | awk '{image=$1":"$2; print image}' | xargs -L1 docker pull

@norgeindian
Copy link
Contributor Author

@Den4ik , thanks a lot for the hint. You are right, now it works.
Anyway, @davidalger , what do you think about adding a general env setting here, so that the composer version for each environment is fixed?
Maybe that could be done in images/php-fpm/Dockerfile?

@davidalger
Copy link
Collaborator

@norgeindian @Den4ik This is a wonderful idea. Added support for this to the image entrypoint. See #300 for details on it. Next steps is to update all usages of php-fpm based images in docker-composer config to pass the value through, should be relatively simple to do.

I grok the awk/xargs usage above to pull all the images. :) Pro-tip: If you only want to pull latest images used by a given environment: warden env pull will do the trick, then the usual warden env up to recreate containers with the new images.

@davidalger
Copy link
Collaborator

COMPOSER_VERSION=2 in the .env file will now cause 'composer' in the container to be v2 instead of v1. The default remains v1 due to v2's newness and to ensure compatibility. It may be changed to default v2 at some point in the future once folks have had more time to update and use it.

@Brengineer
Copy link

I'm not sure if something is hard-coded here, but when I have COMPOSER_VERSION=2.1 (as required by Magento 2.4.4) in my .env file, the version is still 1.x in the Warden shell. However, if I revert to exactly COMPOSER_VERSION=2 in the .env file, then the version is 2.x in the Warden shell (after running $ warden env up of course).

@alinalexandru
Copy link
Contributor

alinalexandru commented Aug 12, 2022 via email

@sohelrana09
Copy link

How to make a specific composer version @alinalexandru? Did you manage @Brengineer?

@alinalexandru
Copy link
Contributor

You can not run a specific version. You can specify to use composer 1.x or 2.x by setting in .env the variable COMPOSER_VERSION

If you set COMPOSER_VERSION=2, the composer version will be 2.2.5, at this moment.
If you set COMPOSER_VERSION=1, the composer version will be 1.10.23, at this moment.

If you need a specific version, there are 2 options:

  • create your one image, and use them
  • install required composer version after each warden env up.

@sohelrana09
Copy link

Thanks @alinalexandru. Our case composer version is 2.3 when we checkout master branch which cause the installation problem for M2.4.4. Not sure which warden version we use for composer 2.2.x.

@alexandrosk
Copy link

Is there a way to specify 2.2.10 when using COMPOSER_VERSION=2 instead of 2.3 ?

@navarr
Copy link
Member

navarr commented Apr 13, 2023

Is there a way to specify 2.2.10 when using COMPOSER_VERSION=2 instead of 2.3 ?

You can specify 2.2 to get the latest 2.2.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
8 participants