Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: jenkins' test_env options was overridden #996

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/pkg/plugin/jenkins/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func Create(options map[string]interface{}) (map[string]interface{}, error) {
// Initialize Operator with Operations
operator := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
setDefaultValue(defaultHelmConfig),
helm.Validate,
replaceStroageClass,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/jenkins/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ func Delete(options map[string]interface{}) (bool, error) {
// Initialize Operator with Operations
operator := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
setDefaultValue(defaultHelmConfig),
helm.Validate,
replaceStroageClass,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/jenkins/jenkins.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/devstream-io/devstream/pkg/util/types"
)

var defaultHelmConfig = helm.Options{
var defaultHelmConfig = &helm.Options{
Chart: helmCommon.Chart{
ChartName: "jenkins/jenkins",
Timeout: "5m",
Expand Down
13 changes: 12 additions & 1 deletion internal/pkg/plugin/jenkins/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package jenkins
import (
"github.com/mitchellh/mapstructure"

"github.com/devstream-io/devstream/internal/pkg/plugin/common/helm"
"github.com/devstream-io/devstream/internal/pkg/plugininstaller"
"github.com/devstream-io/devstream/internal/pkg/plugininstaller/helm"
)

type jenkinsOptions struct {
Expand All @@ -28,3 +28,14 @@ func (opts *jenkinsOptions) encode() (map[string]interface{}, error) {
}
return options, nil
}

func setDefaultValue(defaultOpts *helm.Options) plugininstaller.MutableOperation {
return func(options plugininstaller.RawOptions) (plugininstaller.RawOptions, error) {
opts, err := newOptions(options)
if err != nil {
return nil, err
}
opts.FillDefaultValue(defaultOpts)
return opts.encode()
}
}
2 changes: 1 addition & 1 deletion internal/pkg/plugin/jenkins/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ func Read(options map[string]interface{}) (map[string]interface{}, error) {
// Initialize Operator with Operations
operator := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
setDefaultValue(defaultHelmConfig),
helm.Validate,
replaceStroageClass,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugin/jenkins/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func Update(options map[string]interface{}) (map[string]interface{}, error) {
// Initialize Operator with Operations
operator := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
setDefaultValue(defaultHelmConfig),
helm.Validate,
replaceStroageClass,
},
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugininstaller/helm/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func (opts *Options) Encode() (map[string]interface{}, error) {
return options, nil
}

func (opts *Options) fillDefaultValue(defaultOpts *Options) {
func (opts *Options) FillDefaultValue(defaultOpts *Options) {
chart := &opts.Chart
chart.FillDefaultValue(&defaultOpts.Chart)
repo := &opts.Repo
Expand Down
2 changes: 1 addition & 1 deletion internal/pkg/plugininstaller/helm/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func SetDefaultConfig(defaultConfig *Options) plugininstaller.MutableOperation {
if err != nil {
return nil, err
}
opts.fillDefaultValue(defaultConfig)
opts.FillDefaultValue(defaultConfig)
return opts.Encode()
}
}