grim/convey

Parents e31d4e7f447b
Children e71f90d57ec7
Fix up the shell words issue by moving to github.com/kballard/go-shellquote also set the run attribute of stages. Fixes #118
--- a/loaders/bitbucket/loader.go Mon Sep 04 22:52:13 2017 -0500
+++ b/loaders/bitbucket/loader.go Mon Sep 04 23:14:28 2017 -0500
@@ -23,7 +23,7 @@
"path/filepath"
"strings"
- "github.com/mattn/go-shellwords"
+ "github.com/kballard/go-shellquote"
"bitbucket.org/rw_grim/convey/config"
"bitbucket.org/rw_grim/convey/docker"
@@ -61,6 +61,7 @@
Name: "stage-0",
Enabled: true,
Tasks: []string{"import"},
+ Run: "on-success",
},
},
}
@@ -107,7 +108,7 @@
last := -1
for scriptIdx, command := range pipeline.Steps.Script {
- argv, err := shellwords.Parse(command)
+ argv, err := shellquote.Split(command)
if err != nil {
// TODO fix me soon by returning the error!
panic(err)
--- a/loaders/bitbucket/loader_test.go Mon Sep 04 22:52:13 2017 -0500
+++ b/loaders/bitbucket/loader_test.go Mon Sep 04 23:14:28 2017 -0500
@@ -18,8 +18,6 @@
package bitbucket
import (
- "fmt"
-
"github.com/aphistic/sweet"
. "github.com/onsi/gomega"
@@ -33,7 +31,7 @@
func (b *bitbucketSuite) TestLoaderSimple(t sweet.T) {
l := Loader{}
- rawData := `image: python:3
+ data := []byte(`image: python:3
pipelines:
default:
- step:
@@ -43,9 +41,7 @@
- find . -type d -iname __pycache__ -exec rm -rf {} \; || true
- pip install -r dev-requirements.txt
- flake8
- - PYTHONPATH=%s py.test --color=auto --cov=pipelines --cov-report=term-missing tests`
-
- data := []byte(fmt.Sprintf(rawData, "`pwd`"))
+ - PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests`)
cfg, err := l.Load("", "", data)
@@ -65,7 +61,7 @@
"find . -type d -iname __pycache__ -exec rm -rf {} \\; || true",
"pip install -r dev-requirements.txt",
"flake8",
- "PYTHONPATH=`pwd` py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
+ "PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
},
Shell: "/bin/sh",
},
@@ -92,7 +88,7 @@
func (b *bitbucketSuite) TestLoaderComplexGlobalImage(t sweet.T) {
l := Loader{}
- rawData := `image:
+ data := []byte(`image:
name: python:3
pipelines:
default:
@@ -103,9 +99,7 @@
- find . -type d -iname __pycache__ -exec rm -rf {} \; || true
- pip install -r dev-requirements.txt
- flake8
- - PYTHONPATH=%s py.test --color=auto --cov=pipelines --cov-report=term-missing tests`
-
- data := []byte(fmt.Sprintf(rawData, "`pwd`"))
+ - PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests`)
cfg, err := l.Load("", "", data)
@@ -125,7 +119,7 @@
"find . -type d -iname __pycache__ -exec rm -rf {} \\; || true",
"pip install -r dev-requirements.txt",
"flake8",
- "PYTHONPATH=`pwd` py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
+ "PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
},
Shell: "/bin/sh",
},
@@ -152,7 +146,7 @@
func (b *bitbucketSuite) TestLoaderComplexGlobalImageWithLogin(t sweet.T) {
l := Loader{}
- rawData := `image:
+ data := []byte(`image:
name: registry.docker.io/python:3
username: foo
password: bar
@@ -166,9 +160,7 @@
- find . -type d -iname __pycache__ -exec rm -rf {} \; || true
- pip install -r dev-requirements.txt
- flake8
- - PYTHONPATH=%s py.test --color=auto --cov=pipelines --cov-report=term-missing tests`
-
- data := []byte(fmt.Sprintf(rawData, "`pwd`"))
+ - PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests`)
cfg, err := l.Load("", "", data)
@@ -193,7 +185,7 @@
"find . -type d -iname __pycache__ -exec rm -rf {} \\; || true",
"pip install -r dev-requirements.txt",
"flake8",
- "PYTHONPATH=`pwd` py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
+ "PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
},
Shell: "/bin/sh",
},
@@ -223,7 +215,7 @@
func (b *bitbucketSuite) TestLoaderComplexStepImage(t sweet.T) {
l := Loader{}
- rawData := `pipelines:
+ data := []byte(`pipelines:
default:
- step:
image:
@@ -234,9 +226,7 @@
- find . -type d -iname __pycache__ -exec rm -rf {} \; || true
- pip install -r dev-requirements.txt
- flake8
- - PYTHONPATH=%s py.test --color=auto --cov=pipelines --cov-report=term-missing tests`
-
- data := []byte(fmt.Sprintf(rawData, "`pwd`"))
+ - PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests`)
cfg, err := l.Load("", "", data)
@@ -256,7 +246,7 @@
"find . -type d -iname __pycache__ -exec rm -rf {} \\; || true",
"pip install -r dev-requirements.txt",
"flake8",
- "PYTHONPATH=`pwd` py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
+ "PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
},
Shell: "/bin/sh",
},
@@ -283,7 +273,7 @@
func (b *bitbucketSuite) TestLoaderComplexStepImageWithLogin(t sweet.T) {
l := Loader{}
- rawData := `pipelines:
+ data := []byte(`pipelines:
default:
- step:
image:
@@ -296,9 +286,7 @@
- find . -type d -iname __pycache__ -exec rm -rf {} \; || true
- pip install -r dev-requirements.txt
- flake8
- - PYTHONPATH=%s py.test --color=auto --cov=pipelines --cov-report=term-missing tests`
-
- data := []byte(fmt.Sprintf(rawData, "`pwd`"))
+ - PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests`)
cfg, err := l.Load("", "", data)
@@ -323,7 +311,7 @@
"find . -type d -iname __pycache__ -exec rm -rf {} \\; || true",
"pip install -r dev-requirements.txt",
"flake8",
- "PYTHONPATH=`pwd` py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
+ "PYTHONPATH=$(pwd) py.test --color=auto --cov=pipelines --cov-report=term-missing tests",
},
Shell: "/bin/sh",
},