feat(catalog-backend-module-gitlab): Added option to skip forked repos in GitlabDiscoveryEntityProvider config
Signed-off-by: alessandro <alessandro.manno@facile.it>
This commit is contained in:
@@ -23,6 +23,7 @@ catalog:
|
||||
host: gitlab-host # Identifies one of the hosts set up in the integrations
|
||||
branch: main # Optional. Used to discover on a specific branch
|
||||
fallbackBranch: main # Optional. Fallback to be used if there is no default branch configured at the Gitlab repository. It is only used, if `branch` is undefined. Uses `master` as default
|
||||
skipForkedRepos: false # Optional. If the project is a fork, skip repository
|
||||
group: example-group # Optional. Group and subgroup (if needed) to look for repositories. If not present the whole instance will be scanned
|
||||
entityFilename: catalog-info.yaml # Optional. Defaults to `catalog-info.yaml`
|
||||
projectPattern: '[\s\S]*' # Optional. Filters found projects based on provided patter. Defaults to `[\s\S]*`, which means to not filter anything
|
||||
|
||||
@@ -90,4 +90,5 @@ export type GitlabProviderConfig = {
|
||||
groupPattern: RegExp;
|
||||
orgEnabled?: boolean;
|
||||
schedule?: TaskScheduleDefinition;
|
||||
skipForkedRepos?: boolean;
|
||||
};
|
||||
|
||||
@@ -177,6 +177,13 @@ export class GitlabDiscoveryEntityProvider implements EntityProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
this.config.skipForkedRepos &&
|
||||
project.hasOwnProperty('forked_from_project')
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
!this.config.branch &&
|
||||
this.config.fallbackBranch === '*' &&
|
||||
|
||||
@@ -43,6 +43,8 @@ function readGitlabConfig(id: string, config: Config): GitlabProviderConfig {
|
||||
config.getOptionalString('groupPattern') ?? /[\s\S]*/,
|
||||
);
|
||||
const orgEnabled: boolean = config.getOptionalBoolean('orgEnabled') ?? false;
|
||||
const skipForkedRepos: boolean =
|
||||
config.getOptionalBoolean('skipForkedRepos') ?? false;
|
||||
|
||||
const schedule = config.has('schedule')
|
||||
? readTaskScheduleDefinitionFromConfig(config.getConfig('schedule'))
|
||||
@@ -60,6 +62,7 @@ function readGitlabConfig(id: string, config: Config): GitlabProviderConfig {
|
||||
groupPattern,
|
||||
schedule,
|
||||
orgEnabled,
|
||||
skipForkedRepos,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user