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
aff618fa
Unverified
Commit
aff618fa
authored
Feb 6, 2020
by
Rhys Arkins
Committed by
GitHub
Feb 6, 2020
Browse files
Options
Downloads
Patches
Plain Diff
feat: dynamic platform list retrieval (#5394)
parent
0ec6617b
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/config/definitions.ts
+3
-14
3 additions, 14 deletions
lib/config/definitions.ts
lib/platform/index.ts
+9
-6
9 additions, 6 deletions
lib/platform/index.ts
with
12 additions
and
20 deletions
lib/config/definitions.ts
+
3
−
14
View file @
aff618fa
...
...
@@ -17,13 +17,8 @@ import {
VERSION_SCHEME_SWIFT
,
}
from
'
../constants/version-schemes
'
;
import
{
getVersionSchemeList
}
from
'
../versioning
'
;
import
{
PLATFORM_TYPE_AZURE
,
PLATFORM_TYPE_BITBUCKET
,
PLATFORM_TYPE_BITBUCKET_SERVER
,
PLATFORM_TYPE_GITHUB
,
PLATFORM_TYPE_GITLAB
,
}
from
'
../constants/platforms
'
;
import
{
PLATFORM_TYPE_GITHUB
}
from
'
../constants/platforms
'
;
import
{
platformList
}
from
'
../platform
'
;
export
interface
RenovateOptionBase
{
admin
?:
boolean
;
...
...
@@ -463,13 +458,7 @@ const options: RenovateOptions[] = [
name
:
'
platform
'
,
description
:
'
Platform type of repository
'
,
type
:
'
string
'
,
allowedValues
:
[
PLATFORM_TYPE_AZURE
,
PLATFORM_TYPE_BITBUCKET
,
PLATFORM_TYPE_BITBUCKET_SERVER
,
PLATFORM_TYPE_GITHUB
,
PLATFORM_TYPE_GITLAB
,
],
allowedValues
:
platformList
,
default
:
PLATFORM_TYPE_GITHUB
,
admin
:
true
,
},
...
...
This diff is collapsed.
Click to expand it.
lib/platform/index.ts
+
9
−
6
View file @
aff618fa
import
fs
from
'
fs
'
;
import
URL
from
'
url
'
;
import
addrs
from
'
email-addresses
'
;
import
*
as
hostRules
from
'
../util/host-rules
'
;
import
{
logger
}
from
'
../logger
'
;
import
{
Platform
}
from
'
./common
'
;
import
{
RenovateConfig
}
from
'
../config/common
'
;
import
{
getOptions
}
from
'
../config/definitions
'
;
import
{
PLATFORM_NOT_FOUND
}
from
'
../constants/error-messages
'
;
export
*
from
'
./common
'
;
const
supportedPlatforms
=
getOptions
().
find
(
option
=>
option
.
name
===
'
platform
'
).
allowedValues
;
export
const
platformList
=
fs
.
readdirSync
(
__dirname
,
{
withFileTypes
:
true
})
.
filter
(
dirent
=>
dirent
.
isDirectory
())
.
map
(
dirent
=>
dirent
.
name
)
.
filter
(
name
=>
name
!==
'
git
'
&&
name
!==
'
utils
'
)
// TODO: should be cleaner
.
sort
();
let
_platform
:
Platform
;
...
...
@@ -28,9 +31,9 @@ const handler: ProxyHandler<Platform> = {
export
const
platform
=
new
Proxy
<
Platform
>
({}
as
any
,
handler
);
export
async
function
setPlatformApi
(
name
:
string
):
Promise
<
void
>
{
if
(
!
supportedP
latform
s
.
includes
(
name
))
if
(
!
p
latform
List
.
includes
(
name
))
throw
new
Error
(
`Init: Platform "
${
name
}
" not found. Must be one of:
${
supportedP
latform
s
.
join
(
`Init: Platform "
${
name
}
" not found. Must be one of:
${
p
latform
List
.
join
(
'
,
'
)}
`
);
...
...
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