Refactoring
This commit is contained in:
parent
1104df0b88
commit
aff974b466
|
|
@ -6,7 +6,6 @@ import (
|
|||
"text/template"
|
||||
|
||||
virtuslabv1alpha1 "github.com/VirtusLab/jenkins-operator/pkg/apis/virtuslab/v1alpha1"
|
||||
"github.com/VirtusLab/jenkins-operator/pkg/controller/render"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -42,7 +41,7 @@ func buildCreateJenkinsOperatorUserGroovyScript() (*string, error) {
|
|||
OperatorPasswordFile: OperatorCredentialsSecretPasswordKey,
|
||||
}
|
||||
|
||||
output, err := render.Render(createOperatorUserGroovyFmtTemplate, data)
|
||||
output, err := render(createOperatorUserGroovyFmtTemplate, data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package render
|
||||
package resources
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"text/template"
|
||||
)
|
||||
|
||||
// Render executes a parsed template (go-template) with configuration from data
|
||||
func Render(template *template.Template, data interface{}) (string, error) {
|
||||
// render executes a parsed template (go-template) with configuration from data
|
||||
func render(template *template.Template, data interface{}) (string, error) {
|
||||
var buffer bytes.Buffer
|
||||
if err := template.Execute(&buffer, data); err != nil {
|
||||
return "", err
|
||||
|
|
@ -7,7 +7,6 @@ import (
|
|||
virtuslabv1alpha1 "github.com/VirtusLab/jenkins-operator/pkg/apis/virtuslab/v1alpha1"
|
||||
"github.com/VirtusLab/jenkins-operator/pkg/controller/jenkins/constants"
|
||||
|
||||
"github.com/VirtusLab/jenkins-operator/pkg/controller/render"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
|
@ -287,7 +286,7 @@ func buildInitBashScript(pluginsToInstall map[string][]string) (*string, error)
|
|||
JenkinsScriptsVolumePath: jenkinsScriptsVolumePath,
|
||||
}
|
||||
|
||||
output, err := render.Render(initBashTemplate, data)
|
||||
output, err := render(initBashTemplate, data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue