Don't set child jobs to skipped on post failure
Only create fake build objects for child jobs if there aren't real ones. This avoids a situation where a child job of a paused parent completes, but then has its result retroactively changed to "SKIPPED" after the parent encounters a post-run failure. Change-Id: Ide180c0712434d9208ee053bdcf10af22fc3bfde
This commit is contained in:
parent
27c9729410
commit
abf7fe9767
|
@ -0,0 +1,17 @@
|
|||
- pipeline:
|
||||
name: check
|
||||
manager: independent
|
||||
post-review: true
|
||||
trigger:
|
||||
gerrit:
|
||||
- event: patchset-created
|
||||
success:
|
||||
gerrit:
|
||||
Verified: 1
|
||||
failure:
|
||||
gerrit:
|
||||
Verified: -1
|
||||
|
||||
- job:
|
||||
name: base
|
||||
parent: null
|
|
@ -0,0 +1 @@
|
|||
test
|
|
@ -0,0 +1,4 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- fail:
|
||||
msg: Fail in post
|
|
@ -0,0 +1,7 @@
|
|||
- hosts: all
|
||||
tasks:
|
||||
- name: Pause and let child run
|
||||
zuul_return:
|
||||
data:
|
||||
zuul:
|
||||
pause: true
|
|
@ -0,0 +1,2 @@
|
|||
- hosts: all
|
||||
tasks: []
|
|
@ -0,0 +1,16 @@
|
|||
- job:
|
||||
name: compile
|
||||
run: playbooks/compile.yaml
|
||||
post-run: playbooks/compile-post.yaml
|
||||
|
||||
- job:
|
||||
name: test
|
||||
run: playbooks/test.yaml
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- compile
|
||||
- test:
|
||||
dependencies:
|
||||
- compile
|
|
@ -0,0 +1,7 @@
|
|||
- tenant:
|
||||
name: tenant-one
|
||||
source:
|
||||
gerrit:
|
||||
config-projects:
|
||||
- common-config
|
||||
- org/project
|
|
@ -4592,6 +4592,15 @@ class TestJobPause(AnsibleZuulTestCase):
|
|||
return f.read()
|
||||
|
||||
def test_job_pause(self):
|
||||
"""
|
||||
compile1
|
||||
+--> compile2
|
||||
| +--> test-after-compile2
|
||||
+--> test1-after-compile1
|
||||
+--> test2-after-compile1
|
||||
test-good
|
||||
test-fail
|
||||
"""
|
||||
|
||||
self.wait_timeout = 120
|
||||
|
||||
|
@ -4721,6 +4730,34 @@ class TestJobPause(AnsibleZuulTestCase):
|
|||
self.assertIn('test : SKIPPED', A.messages[0])
|
||||
|
||||
|
||||
class TestJobPausePostFail(AnsibleZuulTestCase):
|
||||
tenant_config_file = 'config/job-pause2/main.yaml'
|
||||
|
||||
def _get_file(self, build, path):
|
||||
p = os.path.join(build.jobdir.root, path)
|
||||
with open(p) as f:
|
||||
return f.read()
|
||||
|
||||
def test_job_pause_post_fail(self):
|
||||
"""Tests that a parent job which has a post failure does not
|
||||
retroactively set its child job's result to SKIPPED.
|
||||
|
||||
compile
|
||||
+--> test
|
||||
|
||||
"""
|
||||
# Output extra ansible info so we might see errors.
|
||||
A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
|
||||
|
||||
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
|
||||
self.waitUntilSettled()
|
||||
|
||||
self.assertHistory([
|
||||
dict(name='test', result='SUCCESS', changes='1,1'),
|
||||
dict(name='compile', result='POST_FAILURE', changes='1,1'),
|
||||
])
|
||||
|
||||
|
||||
class TestContainerJobs(AnsibleZuulTestCase):
|
||||
tenant_config_file = "config/container-build-resources/main.yaml"
|
||||
|
||||
|
|
|
@ -2410,9 +2410,11 @@ class QueueItem(object):
|
|||
build.job.name)
|
||||
|
||||
for job in skipped:
|
||||
fakebuild = Build(job, None)
|
||||
fakebuild.result = 'SKIPPED'
|
||||
self.addBuild(fakebuild)
|
||||
child_build = self.current_build_set.getBuild(job.name)
|
||||
if not child_build:
|
||||
fakebuild = Build(job, None)
|
||||
fakebuild.result = 'SKIPPED'
|
||||
self.addBuild(fakebuild)
|
||||
|
||||
def setNodeRequestFailure(self, job):
|
||||
fakebuild = Build(job, None)
|
||||
|
|
Loading…
Reference in New Issue