From 12961dd04a57ed3f8ee31abf0437cc5b292ab445 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Wed, 20 May 2020 13:13:36 -0700 Subject: Include extra, host, and group variables in job serialization This serialization is used by the REST API as well as configuration change detection. Including these variables allows API users to see a more complete picture of the job as well as corrects a malfunction in the job config change detection (a change to a job with file matcher's host-vars, for example, would not trigger running the job). Change-Id: I27b5fd81fc0c90bd13ead6ecdef0a5d3dbcc2e57 --- tests/unit/test_web.py | 24 ++++++++++++++++++++++++ zuul/model.py | 3 +++ 2 files changed, 27 insertions(+) diff --git a/tests/unit/test_web.py b/tests/unit/test_web.py index af968b1bc..ad24ba073 100644 --- a/tests/unit/test_web.py +++ b/tests/unit/test_web.py @@ -365,6 +365,9 @@ class TestWeb(BaseTestWeb): 'tags': [], 'timeout': None, 'variables': {}, + 'extra_variables': {}, + 'group_variables': {}, + 'host_variables': {}, 'variant_description': '', 'voting': True }, { @@ -406,6 +409,9 @@ class TestWeb(BaseTestWeb): 'tags': [], 'timeout': None, 'variables': {}, + 'extra_variables': {}, + 'group_variables': {}, + 'host_variables': {}, 'variant_description': 'stable', 'voting': True }], data) @@ -445,6 +451,9 @@ class TestWeb(BaseTestWeb): 'tags': [], 'timeout': None, 'variables': {}, + 'extra_variables': {}, + 'group_variables': {}, + 'host_variables': {}, 'variant_description': '', 'voting': True }], data) @@ -563,6 +572,9 @@ class TestWeb(BaseTestWeb): 'tags': [], 'timeout': None, 'variables': {}, + 'extra_variables': {}, + 'group_variables': {}, + 'host_variables': {}, 'variant_description': '', 'voting': True}], [{'abstract': False, @@ -597,6 +609,9 @@ class TestWeb(BaseTestWeb): 'tags': [], 'timeout': None, 'variables': {}, + 'extra_variables': {}, + 'group_variables': {}, + 'host_variables': {}, 'variant_description': '', 'voting': True}], [{'abstract': False, @@ -631,6 +646,9 @@ class TestWeb(BaseTestWeb): 'tags': [], 'timeout': None, 'variables': {}, + 'extra_variables': {}, + 'group_variables': {}, + 'host_variables': {}, 'variant_description': '', 'voting': True}], [{'abstract': False, @@ -665,6 +683,9 @@ class TestWeb(BaseTestWeb): 'tags': [], 'timeout': None, 'variables': {}, + 'extra_variables': {}, + 'group_variables': {}, + 'host_variables': {}, 'variant_description': '', 'voting': True}]] @@ -718,6 +739,9 @@ class TestWeb(BaseTestWeb): 'tags': [], 'timeout': None, 'variables': {}, + 'extra_variables': {}, + 'group_variables': {}, + 'host_variables': {}, 'variant_description': '', 'voting': True} ]], diff --git a/zuul/model.py b/zuul/model.py index a1e3d3dc4..377b4ba40 100644 --- a/zuul/model.py +++ b/zuul/model.py @@ -1261,6 +1261,9 @@ class Job(ConfigObject): else: d['semaphore'] = None d['variables'] = self.variables + d['extra_variables'] = self.extra_variables + d['host_variables'] = self.host_variables + d['group_variables'] = self.group_variables d['final'] = self.final d['abstract'] = self.abstract d['protected'] = self.protected -- cgit v1.2.1