diff --git a/controllers/spec/common.go b/controllers/spec/common.go index 3ef849f8..697df7a3 100644 --- a/controllers/spec/common.go +++ b/controllers/spec/common.go @@ -20,9 +20,6 @@ package spec import ( "bytes" "context" - "regexp" - - autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" // used for template _ "embed" @@ -32,12 +29,14 @@ import ( "html/template" "os" "reflect" + "regexp" "sort" "strconv" "strings" appsv1 "k8s.io/api/apps/v1" autov2 "k8s.io/api/autoscaling/v2" + autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" v1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -354,7 +353,7 @@ func MakeJavaFunctionCommand(downloadPath, packageFile, name, clusterName, gener authProvided, tlsProvided, tlsConfig, authConfig), " ") processCommand = downloadCommand + " && " + processCommand } - return []string{"sh", "-c", processCommand} + return []string{"bash", "-c", processCommand} } func MakePythonFunctionCommand(downloadPath, packageFile, name, clusterName, generateLogConfigCommand, details, uid string, @@ -371,7 +370,7 @@ func MakePythonFunctionCommand(downloadPath, packageFile, name, clusterName, gen tlsProvided, tlsConfig, authConfig), " ") processCommand = downloadCommand + " && " + processCommand } - return []string{"sh", "-c", processCommand} + return []string{"bash", "-c", processCommand} } func MakeGoFunctionCommand(downloadPath, goExecFilePath string, function *v1alpha1.Function) []string { @@ -390,7 +389,7 @@ func MakeGoFunctionCommand(downloadPath, goExecFilePath string, function *v1alph function.Spec.Pulsar.TLSSecret != "", function.Spec.Pulsar.TLSConfig, function.Spec.Pulsar.AuthConfig), " ") processCommand = downloadCommand + " && ls -al && pwd &&" + processCommand } - return []string{"sh", "-c", processCommand} + return []string{"bash", "-c", processCommand} } func MakeGenericFunctionCommand(downloadPath, functionFile, language, clusterName, details, uid string, authProvided, tlsProvided bool, secretMaps map[string]v1alpha1.SecretRef, diff --git a/controllers/spec/common_test.go b/controllers/spec/common_test.go index 9cf055ea..f9a168a1 100644 --- a/controllers/spec/common_test.go +++ b/controllers/spec/common_test.go @@ -439,7 +439,7 @@ func TestGetSourceRunnerImage(t *testing.T) { func TestMakeGoFunctionCommand(t *testing.T) { function := makeGoFunctionSample(TestFunctionName) commands := MakeGoFunctionCommand("", "/pulsar/go-func", function) - assert.Equal(t, commands[0], "sh") + assert.Equal(t, commands[0], "bash") assert.Equal(t, commands[1], "-c") assert.True(t, strings.HasPrefix(commands[2], "SHARD_ID=${POD_NAME##*-} && echo shardId=${SHARD_ID}")) innerCommands := strings.Split(commands[2], "&&")