flex icon indicating copy to clipboard operation
flex copied to clipboard

Downloader.php still tries to access raw.githubusercontent.com when SYMFONY_ENDPOINT set

Open alexjfisher opened this issue 3 years ago • 3 comments
trafficstars

Hi

Is there anyway to prevent the DEFAULT_ENDPOINTS being tried in addition to the endpoint set with the SYMFONY_ENDPOINT environment variable? This is causing issues as my environment is behind a firewall with no access to https://raw.githubusercontent.com

I can proxy https://raw.githubusercontent.com via an Artifactory instance, but am running into issues with the downloader still trying to access github directly, (with each attempt timing out eventually)

export SYMFONY_ENDPOINT=https://artifactory.example.com/artifactory/githubusercontent/symfony/recipes/flex/main/index.json
composer.phar -vvv create-project symfony/skeleton test

--SNIP--

Installs: symfony/flex:v1.19.2
  - Installing symfony/flex (v1.19.2): Reading /home/alex/.composer/cache/files/symfony/flex/78583d5ef559c143918ad2d66e882c87d8c6901e.zip from cache
Loading from cache
 Extracting archiveLoading plugin Symfony\Flex\Flex
Composer >=1.7 not found, downloads will happen in sequence
Downloading https://artifactory.example.com/artifactory/api/composer/packages/packages.json
Writing /home/alex/.composer/cache/repo/https---artifactory.example.com-artifactory-api-composer-packages/packages.json into cache
Downloading https://artifactory.example.com/artifactory/api/composer/composer-github-remote/packages.json
Writing /home/alex/.composer/cache/repo/https---artifactory.example.com-artifactory-api-composer-composer-github-remote/packages.json into cache
Reading /home/alex/test/vendor/composer/installed.json
Writing lock file
Generating optimized autoload files
Reading /home/alex/.composer/cache/repo/flex/https---artifactory.example.com-artifactory-githubusercontent-symfony-recipes-flex-main-index.json from cache
Downloading https://artifactory.example.com/artifactory/githubusercontent/symfony/recipes/flex/main/index.json
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json
Downloading https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json
Downloading https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json
Downloading https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json

Thanks!

alexjfisher avatar Jun 16 '22 12:06 alexjfisher

Found your post when searching for the same thing! 😆 I could ping you on Teams, but figured it might be useful for others...

The environment variable doesn't seem to work. Although you can set the URL within the composer.json file, like below:

    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "5.4.*",
	    "endpoint": ["https://artifactory.example.com/artifactory/githubusercontent/symfony/recipes/flex/main/index.json"]
        }
    }

Ensure it's set as an array though, seems if it's just a string it doesn't work.

Doing a "composer update" no longer uses "raw.githubusercontent.com".

adamwilson919 avatar Jul 12 '22 11:07 adamwilson919

The SYMFONY_ENDPOINT env variable indeed adds an endpoint in the list, it does not replace default endpoints entirely. The same is true when specifying a string in the config.

stof avatar Jul 12 '22 11:07 stof

This needs better documentation for sure. @stof is right. The way to completly ignore the default endpoints is to set the enpoint as an array in composer.json.

Up for a doc PR?

nicolas-grekas avatar Jul 12 '22 11:07 nicolas-grekas