Errors when Github Bot is only installed on some repositories
See original GitHub issueExpected Behavior
When I install my Github Bot on only some of an organisations repositories. I would like Github Discovery to successfully crawl all repositories that it has access to, without erroring on repositories it doesn’t have access to.
I’d likely do this by telling the Github Credentials Manager to not limit by repositories, as I don’t (think) I need that behaviour.
Current Behavior
GithubAppManager will attempt to create an installation for specific repos, returning the below error.
catalog warn Processor GithubDiscoveryProcessor threw an error while reading github-discovery:https://github.com/{org}/*/blob/master/{custom-file}; caused by HttpError: There is at least one repository that does not exist or is not accessible to the parent installation. type=plugin
Possible Solution
I tested a workaround to this solution by changing the following line to not limit the access token by repository. https://github.com/backstage/backstage/blob/29d616592bd2349d8e9bdd6bb0b1713cd435f8ab/packages/integration/src/github/GithubCredentialsProvider.ts#L107
const repositories = repositorySelection !== 'all' && repo !== '*' ? [repo!] : undefined;
This worked, but likely isn’t a good idea for everyone. To suggest a solution I’d first need to understand why the access tokens are being created limited by repository, my guess is that’s just not needed for a Github App access but not sure.
Steps to Reproduce
-
Create a Github App and install it only one some repositories in an organisation
-
Add The Github App and a Catalog item
integrations:
github:
- host: github.com
apps:
- $include: github-app-credentials.yaml
catalog:
locations:
- type: github-discovery
target: https://github.com/{ORG}/*/blob/master/app-config.yaml
Context
I’m investigating the use of BackStage and would like to trial it without giving full access to the entire organisation. I’d typically do this by limiting the repositories it has access to.
I’m also going to have rate limiting problems due to the large number of repositories on the org, so whilst testing it can be helpful to limit to a subset of repos, so I can avoid rate limit problems for now.
Your Environment
- NodeJS Version (v12): v14
- Operating System and Version (e.g. Ubuntu 14.04): Mac OS
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
I believe @punkle got you covered 😁 #6539, will prolly be part of the next release
You are welcome @jahredhope. Glad to have been able to help.