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

Use bash -c instead of sh -c #714

Merged
merged 3 commits into from
Jan 22, 2024
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
11 changes: 5 additions & 6 deletions controllers/spec/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ package spec
import (
"bytes"
"context"
"regexp"

autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2"

// used for template
_ "embed"
Expand All @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion controllers/spec/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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], "&&")
Expand Down
Loading