Skip to content

Commit

Permalink
Merge pull request #972 from merico-dev/feat-harbor
Browse files Browse the repository at this point in the history
Refactor: Optimize Naming and Logging, etc. to Reduce Caller Understanding Costs
  • Loading branch information
iyear authored Aug 10, 2022
2 parents a45b3e8 + 61bccd0 commit ec2d745
Show file tree
Hide file tree
Showing 69 changed files with 261 additions and 261 deletions.
6 changes: 3 additions & 3 deletions internal/pkg/plugin/argocd/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (
// Create creates ArgoCD with provided options.
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
helm.Validate,
},
ExecuteOperations: helm.DefaultCreateOperations,
TerminateOperations: helm.DefaultTerminateOperations,
GetStatusOperation: helm.GetPluginAllState,
GetStateOperation: helm.GetPluginAllState,
}

// 2. execute installer get status and error
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/argocd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

func Delete(options map[string]interface{}) (bool, error) {
// 1. config delete operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
helm.Validate,
},
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/argocd/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ const (

func Read(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config read operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
helm.Validate,
},
GetStatusOperation: helm.GetPluginAllState,
GetStateOperation: helm.GetPluginAllState,
}

// 2. get plugin status
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/plugin/argocd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (

func Update(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config update operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.SetDefaultConfig(&defaultHelmConfig),
helm.Validate,
},
ExecuteOperations: helm.DefaultUpdateOperations,
GetStatusOperation: helm.GetPluginAllState,
ExecuteOperations: helm.DefaultUpdateOperations,
GetStateOperation: helm.GetPluginAllState,
}

// 2. update by helm config and get status
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/plugin/argocdapp/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import (
// Create creates an ArgoCD app YAML and applys it.
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
kubectl.ProcessByContent(
"create", file.NewTemplate().FromContent(templateFileLoc),
),
},
GetStatusOperation: getStaticState,
GetStateOperation: getStaticState,
}

// 2. execute installer get status and error
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/argocdapp/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (

func Delete(options map[string]interface{}) (bool, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
kubectl.ProcessByContent(
"delete", file.NewTemplate().FromContent(templateFileLoc),
),
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/argocdapp/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (

func Read(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
},
GetStatusOperation: getDynamicState,
GetStateOperation: getDynamicState,
}

// 2. execute installer get status and error
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/artifactory/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import (

func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultCreateOperations,
TerminateOperations: helm.DefaultTerminateOperations,
GetStatusOperation: helm.GetPluginAllState,
GetStateOperation: helm.GetPluginAllState,
}

// 2. execute installer get status and error
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/artifactory/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

func Delete(options map[string]interface{}) (bool, error) {
// 1. config delete operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultDeleteOperations,
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/artifactory/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import (

func Read(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config read operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
GetStatusOperation: helm.GetPluginAllState,
GetStateOperation: helm.GetPluginAllState,
}

status, err := runner.Execute(plugininstaller.RawOptions(options))
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/plugin/artifactory/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (

func Update(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config update operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
helm.Validate,
},
ExecuteOperations: helm.DefaultUpdateOperations,
GetStatusOperation: helm.GetPluginAllState,
ExecuteOperations: helm.DefaultUpdateOperations,
GetStateOperation: helm.GetPluginAllState,
}

// 2. execute update get status and error
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/devlake/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (

func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
ExecuteOperations: []plugininstaller.BaseOperation{
runner := &plugininstaller.Operator{
ExecuteOperations: plugininstaller.ExecuteOperations{
kubectl.ProcessByContent(
"create", file.NewTemplate().FromRemote(devLakeInstallYAMLDownloadURL),
),
},
GetStatusOperation: getStaticState,
GetStateOperation: getStaticState,
}

// 2. execute installer get status and error
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/devlake/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

func Delete(options map[string]interface{}) (bool, error) {
// 1. config delete operations
runner := &plugininstaller.Runner{
ExecuteOperations: []plugininstaller.BaseOperation{
runner := &plugininstaller.Operator{
ExecuteOperations: plugininstaller.ExecuteOperations{
kubectl.ProcessByContent(
"delete", file.NewTemplate().FromRemote(devLakeInstallYAMLDownloadURL),
),
Expand Down
4 changes: 2 additions & 2 deletions internal/pkg/plugin/devlake/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import "github.com/devstream-io/devstream/internal/pkg/plugininstaller"

func Read(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
GetStatusOperation: getDynamicState,
runner := &plugininstaller.Operator{
GetStateOperation: getDynamicState,
}

// 2. execute installer get status and error
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/plugin/githubactions/golang/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (
// Create sets up GitHub Actions workflow(s).
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
createDockerHubInfoForPush,
github.ProcessAction("create"),
},
GetStatusOperation: github.GetStaticWorkFlowState,
GetStateOperation: github.GetStaticWorkFlowState,
}

// 2. execute installer get status and error
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/githubactions/golang/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

// Delete remove GitHub Actions workflows.
func Delete(options map[string]interface{}) (bool, error) {
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
deleteDockerHubInfoForPush,
github.ProcessAction("delete"),
},
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/githubactions/golang/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
)

func Read(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
github.BuildWorkFlowsWrapper(workflows),
},
GetStatusOperation: github.GetActionState,
GetStateOperation: github.GetActionState,
}

status, err := runner.Execute(plugininstaller.RawOptions(options))
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/plugin/githubactions/golang/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import (

// Update remove and set up GitHub Actions workflows.
func Update(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
deleteDockerHubInfoForPush,
createDockerHubInfoForPush,
github.ProcessAction("update"),
},
GetStatusOperation: github.GetActionState,
GetStateOperation: github.GetActionState,
}

status, err := runner.Execute(plugininstaller.RawOptions(options))
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/plugin/githubactions/nodejs/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import (
// Create sets up GitHub Actions workflow(s).
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
github.ProcessAction("create"),
},
GetStatusOperation: github.GetStaticWorkFlowState,
GetStateOperation: github.GetStaticWorkFlowState,
}

// 2. execute installer get status and error
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/githubactions/nodejs/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

// Delete remove GitHub Actions workflows.
func Delete(options map[string]interface{}) (bool, error) {
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
github.ProcessAction("delete"),
},
}
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/githubactions/nodejs/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import (
)

func Read(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
GetStatusOperation: github.GetActionState,
GetStateOperation: github.GetActionState,
}

status, err := runner.Execute(plugininstaller.RawOptions(options))
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/plugin/githubactions/nodejs/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import (

// Update remove and set up GitHub Actions workflows.
func Update(options map[string]interface{}) (map[string]interface{}, error) {
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
github.ProcessAction("update"),
},
GetStatusOperation: github.GetActionState,
GetStateOperation: github.GetActionState,
}

status, err := runner.Execute(plugininstaller.RawOptions(options))
Expand Down
8 changes: 4 additions & 4 deletions internal/pkg/plugin/githubactions/python/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (
// Create sets up GitHub Actions workflow(s).
func Create(options map[string]interface{}) (map[string]interface{}, error) {
// 1. config install operations
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
createDockerHubInfoForPush,
github.ProcessAction("create"),
},
GetStatusOperation: github.GetStaticWorkFlowState,
GetStateOperation: github.GetStaticWorkFlowState,
}

// 2. execute installer get status and error
Expand Down
6 changes: 3 additions & 3 deletions internal/pkg/plugin/githubactions/python/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (

// Delete remove GitHub Actions workflows.
func Delete(options map[string]interface{}) (bool, error) {
runner := &plugininstaller.Runner{
PreExecuteOperations: []plugininstaller.MutableOperation{
runner := &plugininstaller.Operator{
PreExecuteOperations: plugininstaller.PreExecuteOperations{
github.Validate,
github.BuildWorkFlowsWrapper(workflows),
},
ExecuteOperations: []plugininstaller.BaseOperation{
ExecuteOperations: plugininstaller.ExecuteOperations{
deleteDockerHubInfoForPush,
github.ProcessAction("delete"),
},
Expand Down
Loading

0 comments on commit ec2d745

Please sign in to comment.