2

(Magento 2.3.4, 2.4.1, 2.4.2, Composer 1.10.19, Ubuntu 18, PHP 7.3)

We have two marketplace accounts and paid-for extensions in both, for the same Magento instance. We'd like to use auth.json to provide credentials so it can be kept out of source control.

We've tried several solutions for this - all failed:

  • private satis repo to "proxy" the packages
  • using 'connect20.magentocommerce.com' as the hostname (an alternate name for repo.magento.com)
  • using repo URLs in the form '[email protected]'

(where necessary, adding "canonical":false in the repo config so it can 'fall through' to the next repo)

Issues we found were:

  • when looking up the repo credentials, composer seems to only use the hostname so user@host doesn't work
  • when using 'connect20.magentocommerce.com', the URLs in the downloaded package.json files all point to 'repo.magento.com', so it falls back to using the other credentials
  • using satis to 'proxy' it means downloading every version of every package (guessing packagist could help with this, we are yet to try it)

We're using composer with an 'auth.json' file and needed it to be able to pull updates from both accounts during the same composer run.

Next step - we're trying out a private packagist setup to re-package the marketplace accounts.

My question is: is there a neat way to handle this?

(related composer issue: https://github.com/composer/composer/issues/8724 ) (related issue for tar errors when repackaging with satis: https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/2098 )

1
  • Update: We eventually did succeed in using satis to proxy the whole Magento marketplace repo - we had to add "format":"zip" in the "archive" section of satis.json Jan 30, 2022 at 18:27

1 Answer 1

1

I am not sure that this solution will work in your case but this is the solution that worked for us when deploying to Magento Commerce Cloud.

Unfortunately, we did need to commit auth.json to our Git repo.

Our solution:

  1. Enter one set of keys in the Magento Cloud UI as an environment variable under Configure Environment -> Variables

    name: env:COMPOSER_AUTH
    value: {"http-basic": {"repo.magento.com": {"username": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}}}
    
  2. Enter the second set of keys in auth.json in your project root and commit the file to your Git repo.

I understand that it is bad practice to add auth.json to your Git repo but I had to be able to deploy this site on Magento Cloud without forcing the client to repurchase the extension.

It would be nice if Adobe/Magneto would implement the solution that Amasty implemented. Amasty has ten aliases for its repo. https://github.com/composer/composer/issues/8724#issuecomment-789802533

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.