Add support for 'connection' concept
This is a large refactor and as small as I could feasibly make it
while keeping the tests working. I'll do the documentation and
touch ups in the next commit to make digesting easier.
Change-Id: Iac5083996a183d1d8a9b6cb8f70836f7c39ee910
diff --git a/tests/fixtures/layouts/bad_gerrit_missing.yaml b/tests/fixtures/layouts/bad_gerrit_missing.yaml
new file mode 100644
index 0000000..8db7248
--- /dev/null
+++ b/tests/fixtures/layouts/bad_gerrit_missing.yaml
@@ -0,0 +1,18 @@
+pipelines:
+ - name: check
+ manager: IndependentPipelineManager
+ trigger:
+ not_gerrit:
+ - event: patchset-created
+ success:
+ review_gerrit:
+ verified: 1
+ failure:
+ review_gerrit:
+ verified: -1
+
+projects:
+ - name: test-org/test
+ check:
+ - test-merge
+ - test-test
diff --git a/tests/fixtures/layouts/bad_merge_failure.yaml b/tests/fixtures/layouts/bad_merge_failure.yaml
index fc6854e..d9b973c 100644
--- a/tests/fixtures/layouts/bad_merge_failure.yaml
+++ b/tests/fixtures/layouts/bad_merge_failure.yaml
@@ -2,13 +2,13 @@
- name: check
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
success:
- gerrit:
+ review_gerrit:
verified: 1
failure:
- gerrit:
+ review_gerrit:
verified: -1
# merge-failure-message needs a string.
merge-failure-message:
@@ -17,20 +17,20 @@
manager: DependentPipelineManager
failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
trigger:
- gerrit:
+ review_gerrit:
- event: comment-added
approval:
- approved: 1
success:
- gerrit:
+ review_gerrit:
verified: 2
submit: true
failure:
- gerrit:
+ review_gerrit:
verified: -2
merge-failure:
start:
- gerrit:
+ review_gerrit:
verified: 0
precedence: high
diff --git a/tests/fixtures/layouts/bad_misplaced_ref.yaml b/tests/fixtures/layouts/bad_misplaced_ref.yaml
index f009c39..d8bb6bc 100644
--- a/tests/fixtures/layouts/bad_misplaced_ref.yaml
+++ b/tests/fixtures/layouts/bad_misplaced_ref.yaml
@@ -2,7 +2,7 @@
- name: 'check'
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
ref: /some/ref/path
diff --git a/tests/fixtures/layouts/bad_pipelines5.yaml b/tests/fixtures/layouts/bad_pipelines5.yaml
index f95a78e..a91ac7a 100644
--- a/tests/fixtures/layouts/bad_pipelines5.yaml
+++ b/tests/fixtures/layouts/bad_pipelines5.yaml
@@ -2,7 +2,7 @@
- name: check
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
# event is a required item but it is missing.
- approval:
- approved: 1
diff --git a/tests/fixtures/layouts/bad_pipelines6.yaml b/tests/fixtures/layouts/bad_pipelines6.yaml
index aa91c77..bf2d538 100644
--- a/tests/fixtures/layouts/bad_pipelines6.yaml
+++ b/tests/fixtures/layouts/bad_pipelines6.yaml
@@ -2,7 +2,7 @@
- name: check
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: comment-added
# approved is not a valid entry. Should be approval.
approved: 1
diff --git a/tests/fixtures/layouts/bad_reject.yaml b/tests/fixtures/layouts/bad_reject.yaml
index b1e7f84..0549875 100644
--- a/tests/fixtures/layouts/bad_reject.yaml
+++ b/tests/fixtures/layouts/bad_reject.yaml
@@ -17,5 +17,5 @@
- code-review: [-1, -2]
username: core-person
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
diff --git a/tests/fixtures/layouts/bad_swift.yaml b/tests/fixtures/layouts/bad_swift.yaml
index e79dca6..f217821 100644
--- a/tests/fixtures/layouts/bad_swift.yaml
+++ b/tests/fixtures/layouts/bad_swift.yaml
@@ -2,13 +2,13 @@
- name: check
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
success:
- gerrit:
+ review_gerrit:
verified: 1
failure:
- gerrit:
+ review_gerrit:
verified: -1
jobs:
diff --git a/tests/fixtures/layouts/bad_template1.yaml b/tests/fixtures/layouts/bad_template1.yaml
index cab17a1..8868edf 100644
--- a/tests/fixtures/layouts/bad_template1.yaml
+++ b/tests/fixtures/layouts/bad_template1.yaml
@@ -4,7 +4,7 @@
- name: 'check'
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
project-templates:
diff --git a/tests/fixtures/layouts/bad_template2.yaml b/tests/fixtures/layouts/bad_template2.yaml
index b731543..09a5f91 100644
--- a/tests/fixtures/layouts/bad_template2.yaml
+++ b/tests/fixtures/layouts/bad_template2.yaml
@@ -4,7 +4,7 @@
- name: 'check'
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
project-templates:
diff --git a/tests/fixtures/layouts/good_connections1.conf b/tests/fixtures/layouts/good_connections1.conf
new file mode 100644
index 0000000..768cbb0
--- /dev/null
+++ b/tests/fixtures/layouts/good_connections1.conf
@@ -0,0 +1,42 @@
+[gearman]
+server=127.0.0.1
+
+[zuul]
+layout_config=layout.yaml
+url_pattern=http://logs.example.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.number}
+job_name_in_report=true
+
+[merger]
+git_dir=/tmp/zuul-test/git
+git_user_email=zuul@example.com
+git_user_name=zuul
+zuul_url=http://zuul.example.com/p
+
+[swift]
+authurl=https://identity.api.example.org/v2.0/
+user=username
+key=password
+tenant_name=" "
+
+default_container=logs
+region_name=EXP
+logserver_prefix=http://logs.example.org/server.app/
+
+[connection review_gerrit]
+driver=gerrit
+server=review.example.com
+user=jenkins
+sshkey=none
+
+[connection other_gerrit]
+driver=gerrit
+server=review2.example.com
+user=jenkins2
+sshkey=none
+
+[connection my_smtp]
+driver=smtp
+server=localhost
+port=25
+default_from=zuul@example.com
+default_to=you@example.com
diff --git a/tests/fixtures/layouts/good_connections1.yaml b/tests/fixtures/layouts/good_connections1.yaml
new file mode 100644
index 0000000..f5f55b1
--- /dev/null
+++ b/tests/fixtures/layouts/good_connections1.yaml
@@ -0,0 +1,18 @@
+pipelines:
+ - name: check
+ manager: IndependentPipelineManager
+ source: review_gerrit
+ trigger:
+ review_gerrit:
+ - event: patchset-created
+ success:
+ review_gerrit:
+ verified: 1
+ failure:
+ other_gerrit:
+ verified: -1
+
+projects:
+ - name: org/project
+ check:
+ - project-check
diff --git a/tests/fixtures/layouts/good_layout.yaml b/tests/fixtures/layouts/good_layout.yaml
index 3608d0c..0e21d57 100644
--- a/tests/fixtures/layouts/good_layout.yaml
+++ b/tests/fixtures/layouts/good_layout.yaml
@@ -8,7 +8,7 @@
open: True
current-patchset: True
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
- event: comment-added
require-approval:
@@ -17,16 +17,16 @@
approval:
- workflow: 1
success:
- gerrit:
+ review_gerrit:
verified: 1
failure:
- gerrit:
+ review_gerrit:
verified: -1
- name: post
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: ref-updated
ref: ^(?!refs/).*$
ignore-deletes: True
@@ -46,32 +46,32 @@
approval:
- code-review: [-1, -2]
trigger:
- gerrit:
+ review_gerrit:
- event: comment-added
approval:
- approved: 1
start:
- gerrit:
+ review_gerrit:
verified: 0
success:
- gerrit:
+ review_gerrit:
verified: 2
code-review: 1
submit: true
failure:
- gerrit:
+ review_gerrit:
verified: -2
workinprogress: true
- name: merge-check
manager: IndependentPipelineManager
- source: gerrit
+ source: review_gerrit
ignore-dependencies: true
trigger:
zuul:
- event: project-change-merged
merge-failure:
- gerrit:
+ review_gerrit:
verified: -1
jobs:
diff --git a/tests/fixtures/layouts/good_merge_failure.yaml b/tests/fixtures/layouts/good_merge_failure.yaml
index f69b764..afede3c 100644
--- a/tests/fixtures/layouts/good_merge_failure.yaml
+++ b/tests/fixtures/layouts/good_merge_failure.yaml
@@ -3,47 +3,47 @@
manager: IndependentPipelineManager
merge-failure-message: "Could not merge the change. Please rebase..."
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
success:
- gerrit:
+ review_gerrit:
verified: 1
failure:
- gerrit:
+ review_gerrit:
verified: -1
- name: post
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: ref-updated
ref: ^(?!refs/).*$
merge-failure:
- gerrit:
+ review_gerrit:
verified: -1
- name: gate
manager: DependentPipelineManager
failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
trigger:
- gerrit:
+ review_gerrit:
- event: comment-added
approval:
- approved: 1
success:
- gerrit:
+ review_gerrit:
verified: 2
submit: true
failure:
- gerrit:
+ review_gerrit:
verified: -2
merge-failure:
- gerrit:
+ review_gerrit:
verified: -1
- smtp:
+ my_smtp:
to: you@example.com
start:
- gerrit:
+ review_gerrit:
verified: 0
precedence: high
diff --git a/tests/fixtures/layouts/good_require_approvals.yaml b/tests/fixtures/layouts/good_require_approvals.yaml
index 75bdc8e..d899765 100644
--- a/tests/fixtures/layouts/good_require_approvals.yaml
+++ b/tests/fixtures/layouts/good_require_approvals.yaml
@@ -5,7 +5,7 @@
- name: check
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: comment-added
require-approval:
- username: jenkins
@@ -23,10 +23,10 @@
username: jenkins
email: jenkins@example.com
success:
- gerrit:
+ review_gerrit:
verified: 1
failure:
- gerrit:
+ review_gerrit:
verified: -1
projects:
diff --git a/tests/fixtures/layouts/good_swift.yaml b/tests/fixtures/layouts/good_swift.yaml
index 913c268..48ca7f0 100644
--- a/tests/fixtures/layouts/good_swift.yaml
+++ b/tests/fixtures/layouts/good_swift.yaml
@@ -2,13 +2,13 @@
- name: check
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
success:
- gerrit:
+ review_gerrit:
verified: 1
failure:
- gerrit:
+ review_gerrit:
verified: -1
jobs:
diff --git a/tests/fixtures/layouts/good_template1.yaml b/tests/fixtures/layouts/good_template1.yaml
index ad060a4..1680c7b 100644
--- a/tests/fixtures/layouts/good_template1.yaml
+++ b/tests/fixtures/layouts/good_template1.yaml
@@ -2,7 +2,7 @@
- name: 'check'
manager: IndependentPipelineManager
trigger:
- gerrit:
+ review_gerrit:
- event: patchset-created
project-templates:
diff --git a/tests/fixtures/layouts/zuul_default.conf b/tests/fixtures/layouts/zuul_default.conf
new file mode 100644
index 0000000..6440027
--- /dev/null
+++ b/tests/fixtures/layouts/zuul_default.conf
@@ -0,0 +1,36 @@
+[gearman]
+server=127.0.0.1
+
+[zuul]
+layout_config=layout.yaml
+url_pattern=http://logs.example.com/{change.number}/{change.patchset}/{pipeline.name}/{job.name}/{build.number}
+job_name_in_report=true
+
+[merger]
+git_dir=/tmp/zuul-test/git
+git_user_email=zuul@example.com
+git_user_name=zuul
+zuul_url=http://zuul.example.com/p
+
+[swift]
+authurl=https://identity.api.example.org/v2.0/
+user=username
+key=password
+tenant_name=" "
+
+default_container=logs
+region_name=EXP
+logserver_prefix=http://logs.example.org/server.app/
+
+[connection review_gerrit]
+driver=gerrit
+server=review.example.com
+user=jenkins
+sshkey=none
+
+[connection my_smtp]
+driver=smtp
+server=localhost
+port=25
+default_from=zuul@example.com
+default_to=you@example.com