Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
semantic-release
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
go-semantic-release
semantic-release
Commits
a99c38e5
Commit
a99c38e5
authored
3 years ago
by
Christoph Witzko
Browse files
Options
Downloads
Patches
Plain Diff
feat: add plugin-resolver flag
parent
1b57e434
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
pkg/config/config.go
+6
-0
6 additions, 0 deletions
pkg/config/config.go
pkg/plugin/discovery/discovery.go
+5
-1
5 additions, 1 deletion
pkg/plugin/discovery/discovery.go
with
11 additions
and
1 deletion
pkg/config/config.go
+
6
−
0
View file @
a99c38e5
...
...
@@ -39,6 +39,7 @@ type Config struct {
DownloadPlugins
bool
ShowProgress
bool
AllowMaintainedVersionOnDefaultBranch
bool
PluginResolver
string
}
func
mustGetString
(
cmd
*
cobra
.
Command
,
name
string
)
string
{
...
...
@@ -130,6 +131,7 @@ func NewConfig(cmd *cobra.Command) (*Config, error) {
DownloadPlugins
:
mustGetBool
(
cmd
,
"download-plugins"
),
ShowProgress
:
mustGetBool
(
cmd
,
"show-progress"
),
AllowMaintainedVersionOnDefaultBranch
:
mustGetBool
(
cmd
,
"allow-maintained-version-on-default-branch"
),
PluginResolver
:
viper
.
GetString
(
"pluginResolver"
),
}
return
conf
,
nil
}
...
...
@@ -187,6 +189,7 @@ func SetFlags(cmd *cobra.Command) {
cmd
.
Flags
()
.
Bool
(
"show-progress"
,
false
,
"shows the plugin download progress"
)
cmd
.
Flags
()
.
String
(
"config"
,
""
,
"config file (default is .semrelrc)"
)
cmd
.
Flags
()
.
Bool
(
"allow-maintained-version-on-default-branch"
,
false
,
"allow configuring the maintained version on the default branch"
)
cmd
.
Flags
()
.
String
(
"plugin-resolver"
,
"registry"
,
"which resolver should be used to resolve plugins (registry or github)"
)
cmd
.
Flags
()
.
SortFlags
=
true
must
(
viper
.
BindPFlag
(
"maintainedVersion"
,
cmd
.
Flags
()
.
Lookup
(
"maintained-version"
)))
...
...
@@ -198,6 +201,9 @@ func SetFlags(cmd *cobra.Command) {
must
(
viper
.
BindPFlag
(
"plugins.changelog-generator.name"
,
cmd
.
Flags
()
.
Lookup
(
"changelog-generator"
)))
must
(
viper
.
BindPFlag
(
"plugins.files-updater.names"
,
cmd
.
Flags
()
.
Lookup
(
"files-updater"
)))
must
(
viper
.
BindPFlag
(
"plugins.hooks.names"
,
cmd
.
Flags
()
.
Lookup
(
"hooks"
)))
must
(
viper
.
BindPFlag
(
"pluginResolver"
,
cmd
.
Flags
()
.
Lookup
(
"plugin-resolver"
)))
must
(
viper
.
BindEnv
(
"pluginResolver"
,
"SEMREL_PLUGIN_RESOLVER"
))
}
func
InitConfig
(
cmd
*
cobra
.
Command
)
error
{
...
...
This diff is collapsed.
Click to expand it.
pkg/plugin/discovery/discovery.go
+
5
−
1
View file @
a99c38e5
...
...
@@ -38,7 +38,11 @@ func New(config *config.Config) (*Discovery, error) {
return
nil
,
err
}
// use the registry resolver as default
resolvers
[
"default"
]
=
resolvers
[
"registry"
]
resolvers
[
"default"
]
=
resolvers
[
config
.
PluginResolver
]
if
resolvers
[
"default"
]
==
nil
{
return
nil
,
fmt
.
Errorf
(
"resolver %s does not exist"
,
config
.
PluginResolver
)
}
return
&
Discovery
{
config
:
config
,
...
...
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