Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SmartDataLab
public
applications
renovate
Commits
2349e559
Unverified
Commit
2349e559
authored
2 years ago
by
Michael Kriese
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(autodiscover): accept simple string (#18531)
parent
f4f89e12
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/config/types.ts
+1
-1
1 addition, 1 deletion
lib/config/types.ts
lib/workers/global/autodiscover.spec.ts
+14
-0
14 additions, 0 deletions
lib/workers/global/autodiscover.spec.ts
lib/workers/global/autodiscover.ts
+7
-1
7 additions, 1 deletion
lib/workers/global/autodiscover.ts
with
22 additions
and
2 deletions
lib/config/types.ts
+
1
−
1
View file @
2349e559
...
@@ -84,7 +84,7 @@ export interface RenovateSharedConfig {
...
@@ -84,7 +84,7 @@ export interface RenovateSharedConfig {
// The below should contain config options where stage=global
// The below should contain config options where stage=global
export
interface
GlobalOnlyConfig
{
export
interface
GlobalOnlyConfig
{
autodiscover
?:
boolean
;
autodiscover
?:
boolean
;
autodiscoverFilter
?:
string
[];
autodiscoverFilter
?:
string
[]
|
string
;
baseDir
?:
string
;
baseDir
?:
string
;
cacheDir
?:
string
;
cacheDir
?:
string
;
containerbaseDir
?:
string
;
containerbaseDir
?:
string
;
...
...
This diff is collapsed.
Click to expand it.
lib/workers/global/autodiscover.spec.ts
+
14
−
0
View file @
2349e559
...
@@ -107,6 +107,20 @@ describe('workers/global/autodiscover', () => {
...
@@ -107,6 +107,20 @@ describe('workers/global/autodiscover', () => {
expect
(
res
.
repositories
).
toEqual
([
'
project/another-repo
'
]);
expect
(
res
.
repositories
).
toEqual
([
'
project/another-repo
'
]);
});
});
it
(
'
filters autodiscovered github repos with minimatch negation
'
,
async
()
=>
{
config
.
autodiscover
=
true
;
config
.
autodiscoverFilter
=
'
!project/re*
'
;
config
.
platform
=
PlatformId
.
Github
;
hostRules
.
find
=
jest
.
fn
(()
=>
({
token
:
'
abc
'
,
}));
ghApi
.
getRepos
=
jest
.
fn
(()
=>
Promise
.
resolve
([
'
project/repo
'
,
'
project/another-repo
'
])
);
const
res
=
await
autodiscoverRepositories
(
config
);
expect
(
res
.
repositories
).
toEqual
([
'
project/another-repo
'
]);
});
it
(
'
fail if regex pattern is not valid
'
,
async
()
=>
{
it
(
'
fail if regex pattern is not valid
'
,
async
()
=>
{
config
.
autodiscover
=
true
;
config
.
autodiscover
=
true
;
config
.
autodiscoverFilter
=
[
'
/project/re**./
'
];
config
.
autodiscoverFilter
=
[
'
/project/re**./
'
];
...
...
This diff is collapsed.
Click to expand it.
lib/workers/global/autodiscover.ts
+
7
−
1
View file @
2349e559
...
@@ -32,7 +32,12 @@ export async function autodiscoverRepositories(
...
@@ -32,7 +32,12 @@ export async function autodiscoverRepositories(
}
}
if
(
config
.
autodiscoverFilter
)
{
if
(
config
.
autodiscoverFilter
)
{
discovered
=
applyFilters
(
discovered
,
config
.
autodiscoverFilter
);
discovered
=
applyFilters
(
discovered
,
is
.
string
(
config
.
autodiscoverFilter
)
?
[
config
.
autodiscoverFilter
]
:
config
.
autodiscoverFilter
);
if
(
!
discovered
.
length
)
{
if
(
!
discovered
.
length
)
{
// Soft fail (no error thrown) if no accessible repositories match the filter
// Soft fail (no error thrown) if no accessible repositories match the filter
...
@@ -40,6 +45,7 @@ export async function autodiscoverRepositories(
...
@@ -40,6 +45,7 @@ export async function autodiscoverRepositories(
return
config
;
return
config
;
}
}
}
}
logger
.
info
(
logger
.
info
(
{
length
:
discovered
.
length
,
repositories
:
discovered
},
{
length
:
discovered
.
length
,
repositories
:
discovered
},
`Autodiscovered repositories`
`Autodiscovered repositories`
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment