grim/convey

37339c9211b8
Parents 7a5346ae4f58
Children 5d008963f8e1
Bust out a bunch of the yaml to yaml files
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loaders/bitbucket/data/complex-global-image-with-login.yml Mon Feb 12 00:24:54 2018 -0600
@@ -0,0 +1,15 @@
+image:
+ name: registry.docker.io/python:3
+ username: foo
+ password: bar
+ email: email
+pipelines:
+ default:
+ - step:
+ script:
+ - set -ex
+ - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
+ - 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loaders/bitbucket/data/complex-global-image.yml Mon Feb 12 00:24:54 2018 -0600
@@ -0,0 +1,12 @@
+image:
+ name: python:3
+pipelines:
+ default:
+ - step:
+ script:
+ - set -ex
+ - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
+ - 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loaders/bitbucket/data/complex-step-image-with-login.yml Mon Feb 12 00:24:54 2018 -0600
@@ -0,0 +1,14 @@
+pipelines:
+ default:
+ - step:
+ image:
+ name: registry.docker.io/python:3
+ username: user
+ password: pass
+ script:
+ - set -ex
+ - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
+ - 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loaders/bitbucket/data/complex-step-image.yml Mon Feb 12 00:24:54 2018 -0600
@@ -0,0 +1,12 @@
+pipelines:
+ default:
+ - step:
+ image:
+ name: python:3
+ script:
+ - set -ex
+ - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
+ - 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loaders/bitbucket/data/complex-step-simple-image.yml Mon Feb 12 00:24:54 2018 -0600
@@ -0,0 +1,11 @@
+pipelines:
+ default:
+ - step:
+ image: python:3
+ script:
+ - set -ex
+ - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
+ - 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loaders/bitbucket/data/docker-mixed.yml Mon Feb 12 00:24:54 2018 -0600
@@ -0,0 +1,13 @@
+image: gliderlabs/alpine:edge
+pipelines:
+ default:
+ - step:
+ script:
+ - hostname
+ - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
+ - date +%s
+ - docker build -t atlassian/my-app:$BITBUCKET_COMMIT .
+ - docker push atlassian/my-app:$BITBUCKET_COMMIT
+ - date +%s
+options:
+ docker: true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loaders/bitbucket/data/docker-simple.yml Mon Feb 12 00:24:54 2018 -0600
@@ -0,0 +1,9 @@
+pipelines:
+ default:
+ - step:
+ script:
+ - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
+ - docker build -t atlassian/my-app:$BITBUCKET_COMMIT .
+ - docker push atlassian/my-app:$BITBUCKET_COMMIT
+options:
+ docker: true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/loaders/bitbucket/data/simple.yml Mon Feb 12 00:24:54 2018 -0600
@@ -0,0 +1,11 @@
+image: python:3
+pipelines:
+ default:
+ - step:
+ script:
+ - set -ex
+ - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
+ - 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
--- a/loaders/bitbucket/loader_test.go Sun Feb 11 22:39:39 2018 -0600
+++ b/loaders/bitbucket/loader_test.go Mon Feb 12 00:24:54 2018 -0600
@@ -30,17 +30,7 @@
func (b *bitbucketSuite) TestLoaderSimple(t sweet.T) {
l := Loader{}
- data := []byte(`image: python:3
-pipelines:
- default:
- - step:
- script:
- - set -ex
- - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
- - 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`)
+ data := t.Sweet().LoadFile("data/simple.yml")
cfg, err := l.Load("", "", data, []string{}, true)
@@ -87,19 +77,7 @@
func (b *bitbucketSuite) TestLoaderComplexGlobalImage(t sweet.T) {
l := Loader{}
- data := []byte(`image:
- name: python:3
-pipelines:
- default:
- - step:
- script:
- - set -ex
- - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
- - 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`)
-
+ data := t.Sweet().LoadFile("data/complex-global-image.yml")
cfg, err := l.Load("", "", data, []string{}, true)
Expect(err).To(BeNil())
@@ -145,22 +123,7 @@
func (b *bitbucketSuite) TestLoaderComplexGlobalImageWithLogin(t sweet.T) {
l := Loader{}
- data := []byte(`image:
- name: registry.docker.io/python:3
- username: foo
- password: bar
- email: email
-pipelines:
- default:
- - step:
- script:
- - set -ex
- - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
- - 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`)
-
+ data := t.Sweet().LoadFile("data/complex-global-image-with-login.yml")
cfg, err := l.Load("", "", data, []string{}, true)
Expect(err).To(BeNil())
@@ -211,22 +174,56 @@
Expect(cfg).To(Equal(expected))
}
+func (b *bitbucketSuite) TestLoaderComplexStepSimpleImage(t sweet.T) {
+ l := Loader{}
+
+ data := t.Sweet().LoadFile("data/complex-step-simple-image.yml")
+ cfg, err := l.Load("", "", data, []string{}, true)
+
+ Expect(err).To(BeNil())
+
+ expected := &config.Config{
+ Tasks: map[string]tasks.Task{
+ "import": &docker.Import{
+ Files: []string{"."},
+ },
+ "default-0": &docker.Run{
+ Image: "python:3",
+ WorkDir: "/workspace",
+ Script: []string{
+ "set -ex",
+ "find . -type f -iname \"*.pyc\" -exec rm -f {} \\; || true",
+ "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",
+ },
+ Shell: "/bin/sh",
+ },
+ },
+ Plans: map[string]plans.Plan{
+ "default": {
+ Stages: []stages.Stage{
+ {
+ Name: "stage-0",
+ Enabled: true,
+ Concurrent: false,
+ Run: "on-success",
+ Environment: nil,
+ Tasks: []string{"import", "default-0"},
+ },
+ },
+ },
+ },
+ }
+
+ Expect(cfg).To(Equal(expected))
+}
+
func (b *bitbucketSuite) TestLoaderComplexStepImage(t sweet.T) {
l := Loader{}
- data := []byte(`pipelines:
- default:
- - step:
- image:
- name: python:3
- script:
- - set -ex
- - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
- - 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`)
-
+ data := t.Sweet().LoadFile("data/complex-step-image.yml")
cfg, err := l.Load("", "", data, []string{}, true)
Expect(err).To(BeNil())
@@ -272,21 +269,7 @@
func (b *bitbucketSuite) TestLoaderComplexStepImageWithLogin(t sweet.T) {
l := Loader{}
- data := []byte(`pipelines:
- default:
- - step:
- image:
- name: registry.docker.io/python:3
- username: user
- password: pass
- script:
- - set -ex
- - find . -type f -iname "*.pyc" -exec rm -f {} \; || true
- - 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`)
-
+ data := t.Sweet().LoadFile("data/complex-step-image-with-login.yml")
cfg, err := l.Load("", "", data, []string{}, true)
Expect(err).To(BeNil())
@@ -337,24 +320,51 @@
Expect(cfg).To(Equal(expected))
}
+func (b *bitbucketSuite) TestLoaderBranchImage(t sweet.T) {
+ l := Loader{}
+
+ data := t.Sweet().LoadFile("data/branch-image.yml")
+ cfg, err := l.Load("", "", data, []string{}, true)
+
+ Expect(err).To(BeNil())
+
+ expected := &config.Config{
+ Tasks: map[string]tasks.Task{
+ "import": &docker.Import{
+ Files: []string{"."},
+ },
+ "branch-develop-0": &docker.Run{
+ Image: "library/alpine",
+ WorkDir: "/workspace",
+ Script: []string{
+ "true",
+ },
+ Shell: "/bin/sh",
+ },
+ },
+ Plans: map[string]plans.Plan{
+ "branch-develop": {
+ Stages: []stages.Stage{
+ {
+ Name: "stage-0",
+ Enabled: true,
+ Concurrent: false,
+ Run: "on-success",
+ Environment: nil,
+ Tasks: []string{"import", "branch-develop-0"},
+ },
+ },
+ },
+ },
+ }
+
+ Expect(cfg).To(Equal(expected))
+}
+
func (b *bitbucketSuite) TestLoaderDockerMixed(t sweet.T) {
l := Loader{}
- data := []byte(`image: gliderlabs/alpine:edge
-pipelines:
- default:
- - step:
- script:
- - hostname
- - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- - date +%s
- - docker build -t atlassian/my-app:$BITBUCKET_COMMIT .
- - docker push atlassian/my-app:$BITBUCKET_COMMIT
- - date +%s
-options:
- docker: true
-`)
-
+ data := t.Sweet().LoadFile("data/docker-mixed.yml")
cfg, err := l.Load("", "", data, []string{}, true)
Expect(err).To(BeNil())
@@ -424,17 +434,7 @@
func (b *bitbucketSuite) TestLoaderDockerSimple(t sweet.T) {
l := Loader{}
- data := []byte(`pipelines:
- default:
- - step:
- script:
- - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- - docker build -t atlassian/my-app:$BITBUCKET_COMMIT .
- - docker push atlassian/my-app:$BITBUCKET_COMMIT
-options:
- docker: true
-`)
-
+ data := t.Sweet().LoadFile("data/docker-simple.yml")
cfg, err := l.Load("", "", data, []string{}, true)
Expect(err).To(BeNil())