Skip to content

Commit

Permalink
ENH Allow developers to declare which packages are inaccessible.
Browse files Browse the repository at this point in the history
This provides a common configuration point for modules which provide additional functionality to the maintenance report that may attempt to access private and otherwise inaccessible repositories.
  • Loading branch information
GuySartorelli committed Dec 13, 2021
1 parent 24bd9c6 commit ae22cd9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,25 @@ newer releases don't show up as expected. We recommend to have looser constraint
(e.g. `silverstripe/framework:^4.3`). When the "Latest" version shows `dev-master`,
it likely means that you have `"minimum-stability": "dev"` in your `composer.json`.

## Private repositories

While this module itself doesn't fetch information about repositories, other modules (such as the [update-checker](https://github.com/bringyourownideas/silverstripe-composer-update-checker)) do. If you have private repositories for which you are unable to provide authentication details to the respective module, you should mark those repositories as inaccessible.

This can be done either per repository:
```yml
BringYourOwnIdeas\Maintenance\Tasks:
inaccessible_packages:
- some-org/some-package-name
```
or for situations where you are hosting repositories yourself, per host:
```yml
BringYourOwnIdeas\Maintenance\Tasks:
inaccessible_repository_hosts:
- gitea.mycompany.com
```
This catches packages whether they're referenced by https or ssh URLs - for example, for `https://gitea.mycompany.com/some-org/some-package-name.git` and for `[email protected]:some-org/some-package-name.git`, the value should be `gitea.mycompany.com`.

## Documentation

Please see the [user guide](docs/en/userguide/index.md) section.
Expand Down
23 changes: 23 additions & 0 deletions src/Tasks/UpdatePackageInfoTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@ class UpdatePackageInfoTask extends BuildTask
'silverstripe-vendormodule',
];

/**
* A list of package names which composer will not be able to access
* e.g. private packages for which you aren't allowed to provide credentials.
*
* @config
* @var array
*/
private static $inaccessible_packages = [];

/**
* A list of repository hosts which composer will not be able to access
* e.g. private repository hosts for which you aren't allowed to provide credentials.
*
* This works for https AND ssh URLs - for example, for
* `https://gitea.mycompany.com/some-org/some-repository.git` and for
* `[email protected]:some-org/some-repository.git`, the value should be
* `gitea.mycompany.com`
*
* @config
* @var array
*/
private static $inaccessible_repository_hosts = [];

/**
* @var ComposerLoader
*/
Expand Down

0 comments on commit ae22cd9

Please sign in to comment.