Remove ZUUL_VOTING and add zuul.voting
Removing old ZUUL_ env variables which have been replaced with
Ansible variables.
Also, fix the tests which examined the voting flag since neither
actually worked.
Change-Id: I1c1dcfb8333bbe6984fdb198eda2d448989ae0ee
diff --git a/doc/source/user/jobs.rst b/doc/source/user/jobs.rst
index a367aa0..a024d61 100644
--- a/doc/source/user/jobs.rst
+++ b/doc/source/user/jobs.rst
@@ -147,6 +147,9 @@
**zuul.job**
The name of the job being run.
+**zuul.voting**
+ A boolean indicating whether the job is voting.
+
**zuul.project**
The item's project. This is a data structure with the following
fields:
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py
index e5730e3..6903a97 100755
--- a/tests/unit/test_scheduler.py
+++ b/tests/unit/test_scheduler.py
@@ -107,8 +107,8 @@
self.assertReportedStat(
'zuul.pipeline.gate.org.project.total_changes', value='1|c')
- for build in self.builds:
- self.assertEqual(build.parameters['ZUUL_VOTING'], '1')
+ for build in self.history:
+ self.assertTrue(build.parameters['zuul']['voting'])
def test_initial_pipeline_gauges(self):
"Test that each pipeline reported its length on start"
@@ -1392,8 +1392,12 @@
self.getJobFromHistory('nonvoting-project-test2').result,
'FAILURE')
- for build in self.builds:
- self.assertEqual(build.parameters['ZUUL_VOTING'], '0')
+ self.assertTrue(self.getJobFromHistory('nonvoting-project-merge').
+ parameters['zuul']['voting'])
+ self.assertTrue(self.getJobFromHistory('nonvoting-project-test1').
+ parameters['zuul']['voting'])
+ self.assertFalse(self.getJobFromHistory('nonvoting-project-test2').
+ parameters['zuul']['voting'])
def test_check_queue_success(self):
"Test successful check queue jobs."
diff --git a/zuul/executor/client.py b/zuul/executor/client.py
index 982ff3d..2ff4c65 100644
--- a/zuul/executor/client.py
+++ b/zuul/executor/client.py
@@ -160,6 +160,7 @@
ref=item.change.ref,
pipeline=pipeline.name,
job=job.name,
+ voting=job.voting,
project=project,
tenant=tenant.name,
jobtags=sorted(job.tags))
@@ -195,7 +196,6 @@
ZUUL_PROJECT=item.change.project.name)
params['ZUUL_PIPELINE'] = pipeline.name
params['ZUUL_URL'] = item.current_build_set.zuul_url
- params['ZUUL_VOTING'] = job.voting and '1' or '0'
params['job'] = job.name
params['timeout'] = job.timeout