diff --git a/go.mod b/go.mod index c81c3aaf5..5c11fb7e9 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,6 @@ require ( github.com/docker/docker v20.10.14+incompatible github.com/docker/go-units v0.4.0 github.com/drone/envsubst v1.0.3 - github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf github.com/gin-gonic/gin v1.7.7 github.com/go-ap/httpsig v0.0.0-20210714162115-62a09257db51 diff --git a/go.sum b/go.sum index 0b7890f2a..3f0de448b 100644 --- a/go.sum +++ b/go.sum @@ -143,8 +143,6 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7 github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ= -github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf h1:NrF81UtW8gG2LBGkXFQFqlfNnvMt9WdB46sfdJY4oqc= github.com/franela/goblin v0.0.0-20211003143422-0a4f594942bf/go.mod h1:VzmDKDJVZI3aJmnRI9VjAn9nJ8qPPsN1fqzr9dqInIo= diff --git a/pipeline/frontend/yaml/container_test.go b/pipeline/frontend/yaml/container_test.go index 5b1964adc..0ee54dd1e 100644 --- a/pipeline/frontend/yaml/container_test.go +++ b/pipeline/frontend/yaml/container_test.go @@ -72,7 +72,7 @@ func TestUnmarshalContainer(t *testing.T) { }, CapAdd: []string{"ALL"}, CapDrop: []string{"NET_ADMIN", "SYS_ADMIN"}, - Command: types.Command{"bundle", "exec", "thin", "-p", "3000"}, + Command: types.Command{"bundle exec thin -p 3000"}, Commands: types.Stringorslice{"go build", "go test"}, CPUQuota: types.StringorInt(11), CPUSet: "1,2", diff --git a/pipeline/frontend/yaml/types/command.go b/pipeline/frontend/yaml/types/command.go index 8a1635bbf..eb0b2f360 100644 --- a/pipeline/frontend/yaml/types/command.go +++ b/pipeline/frontend/yaml/types/command.go @@ -5,8 +5,6 @@ import ( "fmt" "github.com/docker/docker/api/types/strslice" - // TODO: search for maintained - "github.com/flynn/go-shlex" ) // Command represents a docker command, can be a string or an array of strings. @@ -16,11 +14,7 @@ type Command strslice.StrSlice func (s *Command) UnmarshalYAML(unmarshal func(interface{}) error) error { var stringType string if err := unmarshal(&stringType); err == nil { - parts, err := shlex.Split(stringType) - if err != nil { - return err - } - *s = parts + *s = []string{stringType} return nil } diff --git a/pipeline/frontend/yaml/types/command_test.go b/pipeline/frontend/yaml/types/command_test.go index a8fa66a7e..5b75c81b6 100644 --- a/pipeline/frontend/yaml/types/command_test.go +++ b/pipeline/frontend/yaml/types/command_test.go @@ -37,6 +37,11 @@ func TestUnmarshalCommand(t *testing.T) { - sleep 3s`), s3) assert.Nil(t, err) assert.Equal(t, Command{`echo AAA; echo "wow"`, `sleep 3s`}, s3.Command) + + s4 := &StructCommand{} + err = yaml.Unmarshal([]byte(`command: echo AAA; echo "wow"`), s4) + assert.Nil(t, err) + assert.Equal(t, Command{`echo AAA; echo "wow"`}, s4.Command) } var sampleEmptyCommand = `{}`