-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Composer: circular dependencies and COMPOSER_ROOT_VERSION
#3888
Comments
Hardcoding the version to diff --git a/composer/lib/dependabot/composer/update_checker/version_resolver.rb b/composer/lib/dependabot/composer/update_checker/version_resolver.rb
index ac02f8f5a..e6f7e5c97 100644
--- a/composer/lib/dependabot/composer/update_checker/version_resolver.rb
+++ b/composer/lib/dependabot/composer/update_checker/version_resolver.rb
@@ -137,7 +137,10 @@ module Dependabot
dependency.name.downcase,
git_credentials,
registry_credentials
- ]
+ ],
+ env: {
+ "COMPOSER_ROOT_VERSION" => "dev-master"
+ }
)
end
end
|
This is basically a duplicate of #2008, but I feel all the data provided here + suggested solution merits keeping this one open. |
It's been a while since this was opened. Is it on the roadmap? |
It looks like there was an undocumented feature some time ago, that allowed you to set it up like this: registries:
composer-root-version:
type: php-environment-variable
env-key: COMPOSER_ROOT_VERSION
env-value: dev-master dependabot-core/composer/lib/dependabot/composer/file_updater/lockfile_updater.rb Lines 455 to 459 in dba839c
But now dependabot says it's not valid according to the config file schema. |
An alternative approach (that does not require any environment variables) is to switch from the shallow clone that confuses Composer to a blobless ( Footnotes |
COMPOSER_ROOT_VERSION
Package ecosystem
composer
Package manager version
irrelevant
Language version
irrelevant
Manifest location and content prior to update
/composer.json
https://github.com/weirdan/psalm/blob/051125971bce3db49469e0f2c6d4b2429dc3464f/composer.json
dependabot.yml content
https://github.com/weirdan/psalm/blob/051125971bce3db49469e0f2c6d4b2429dc3464f/.github/dependabot.yml
Updated dependency
irrelevant
What you expected to see, versus what you actually saw
Some dependencies updated (pull requests created), e.g. for
symfony/process
Native package manager behavior
Locally it would update with no issues, as Composer guesses root package version from git branch (
dev-master
in this case).Images of the diff or a link to the PR, issue or logs
No PRs created. Github-native Dependabot emits the following error:
It can also be reproduced locally in
dependabot-core
repo by runningIf
.git
folder is not removed, Composer picks up current branch ofdependabot-core
repo and uses that to construct the version (the output above would showvimeo/psalm dev-main
instead ofvimeo/psalm 1.0.0
).Root cause
The problem is caused by the circular dependency between
vimeo/psalm
andpsalm/plugin-phpunit
(see its manifest: https://github.com/psalm/psalm-plugin-phpunit/blob/1ce1ef2c3fe8bed6ddaba1607c00b48a52145023/composer.json), where the latter requiresvimeo/psalm:dev-master
, but Composer fails to detect current version and falls back to1.0.0
which is incompatible withpsalm/plugin-phpunit
.Possible fix
This can be solved by providing root package version via
COMPOSER_ROOT_VERSION
environment variable (see https://getcomposer.org/doc/03-cli.md#composer-root-version), setting it todev-
+ the target branch.The text was updated successfully, but these errors were encountered: