mirror of
https://github.com/jenkinsci/kubernetes-operator.git
synced 2026-09-30 05:01:10 +02:00
#328 Code review fixes
This commit is contained in:
@@ -13,6 +13,8 @@ import (
|
||||
k8s "sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
const groovyUtf8MaxStringLength = 65535
|
||||
|
||||
// ConfigurationAsCode defines API which configures Jenkins with help Configuration as a code plugin
|
||||
type ConfigurationAsCode struct {
|
||||
groovyClient *groovy.Groovy
|
||||
@@ -53,7 +55,6 @@ io.jenkins.plugins.casc.ConfigurationAsCode.get().configureWith(source)
|
||||
`
|
||||
|
||||
func prepareScript(script string) string {
|
||||
groovyUtf8MaxStringLength := 65535
|
||||
var slicedScript []string
|
||||
if len(script) > groovyUtf8MaxStringLength {
|
||||
slicedScript = splitTooLongScript(script)
|
||||
@@ -65,7 +66,6 @@ func prepareScript(script string) string {
|
||||
}
|
||||
|
||||
func splitTooLongScript(groovyScript string) []string {
|
||||
groovyUtf8MaxStringLength := 65535
|
||||
var slicedGroovyScript []string
|
||||
|
||||
lastSubstrIndex := len(groovyScript) % groovyUtf8MaxStringLength
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package casc
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSplitToLongScript(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user