From b76eaeb0b00b3df20a8cfc16064d9c47cf583bcd Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 18 Mar 2019 11:34:53 -0700 Subject: [PATCH] Fail jobs when requirements not met When Zuul identifies a job which should receive required artifacts but can not find them (because the preceding jobs did not supply them, perhaps due to error), treat the requiring job as having failed rather than being skipped so that errors don't go unnoticed. Change-Id: Ib9dd9e6a870d2af46ee11aa99812abf53ea1c5a2 --- ...ail-jobs-when-requirement-not-met-5e37516c241020f3.yaml | 7 +++++++ tests/unit/test_v3.py | 2 +- zuul/model.py | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/fail-jobs-when-requirement-not-met-5e37516c241020f3.yaml diff --git a/releasenotes/notes/fail-jobs-when-requirement-not-met-5e37516c241020f3.yaml b/releasenotes/notes/fail-jobs-when-requirement-not-met-5e37516c241020f3.yaml new file mode 100644 index 0000000000..41296d6f79 --- /dev/null +++ b/releasenotes/notes/fail-jobs-when-requirement-not-met-5e37516c241020f3.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Jobs which use the :attr:`job.requires` attribute and fail to have + their requirements met are now recorded as "FAILED" rather than + "SKIPPED". This can happen if an earlier job which is expected to + produce artifacts fails to do so due to an error. diff --git a/tests/unit/test_v3.py b/tests/unit/test_v3.py index 84a8c13a3b..12d8110b0f 100644 --- a/tests/unit/test_v3.py +++ b/tests/unit/test_v3.py @@ -5391,7 +5391,7 @@ class TestProvidesRequires(ZuulDBTestCase): dict(name='hold', result='SUCCESS', changes='1,1'), dict(name='hold', result='SUCCESS', changes='1,1 2,1'), ], ordered=False) - self.assertIn('image-user : SKIPPED', B.messages[0]) + self.assertIn('image-user : FAILED', B.messages[0]) self.assertIn('not met by build', B.messages[0]) diff --git a/zuul/model.py b/zuul/model.py index b5def079f7..ca26bb7662 100644 --- a/zuul/model.py +++ b/zuul/model.py @@ -2352,7 +2352,7 @@ class QueueItem(object): except RequirementsError as e: self.warning(str(e)) fakebuild = Build(job, None) - fakebuild.result = 'SKIPPED' + fakebuild.result = 'FAILED' self.addBuild(fakebuild) ret = True return ret