Gerrit/Cross-repo dependencies

From MediaWiki.org
Jump to navigation Jump to search

Cross-repo dependencies are commits to other repositories which a commit requires for functioning correctly. For example, you want to add new functionality to an extension, but there is no hook for it, so you submit a core patch adding a new hook, and a patch to the extension adding a handler for that hook. Declaring the core patch as a dependency of the extension patch ensures that the extension path is not tested and not merged without the core patch.

Cross-repo dependencies can be declared with a Depends-On tag in the commit message, a syntax similar to that of connecting patches to Phabricator tasks: in the commit message, you write something like

Subscribe to Foo hook

The extension now uses the Foo hook to make foo.

Bug: T123456
Depends-On: I123456abc...
Change-Id: I456790def...

where I123456abc... is the 40-character gerrit ID of the other commit (which is in the Change-Id line of the commit message of that commit).

This has two effects:

  • Zuul (the gatekeeper of the MediaWiki continuous integration system) will refuse to merge the patch until all dependencies are merged.
  • whenever the CI system builds a test environment, all dependencies are cherry-picked on top of the master branches of their respective repositories; thus, even if your extensions tests depend on the new core functionality, the tests will work correctly.

If one of the dependencies cannot be merged (typically, because it has a merge conflict and needs rebase) the CI system will refuse to run tests, and jenkins-bot will report an error like This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. instead. In some rare cases, this very same message could indicate a corruption in the Git repository, see T134062.

More information[edit]