Allow skipping child jobs from paused job again

The fix in https://review.opendev.org/#/c/698712/ introduced a
regression in that it doesn't allow skipping child jobs from a paused
job anymore.

Change-Id: I762597a24468f0745cea478485b2fc5d7f9ff6b7
This commit is contained in:
Simon Westphahl 2020-01-29 10:45:18 +01:00
parent 000f6ec21e
commit f225aeee8b
6 changed files with 44 additions and 3 deletions

View File

@ -0,0 +1,8 @@
- hosts: localhost
tasks:
- zuul_return:
data:
zuul:
child_jobs:
- data-return
pause: true

View File

@ -43,6 +43,11 @@
- playbooks/data-return-child-jobs.yaml
- playbooks/failure.yaml
- job:
name: paused-data-return-child-jobs
run:
- playbooks/paused-data-return-child-jobs.yaml
- job:
name: data-return-a
run: playbooks/data-return-a.yaml
@ -146,6 +151,20 @@
dependencies:
- data-return-child-jobs-failure
- project:
name: org/project6
check:
jobs:
- paused-data-return-child-jobs
- data-return:
dependencies:
- paused-data-return-child-jobs
- child:
dependencies:
- paused-data-return-child-jobs
- project:
name: org/project-soft
check:

View File

@ -0,0 +1 @@
test

View File

@ -11,4 +11,5 @@
- org/project3
- org/project4
- org/project5
- org/project6
- org/project-soft

View File

@ -3746,6 +3746,17 @@ class TestDataReturn(AnsibleZuulTestCase):
result='FAILURE', changes='1,1'),
])
def test_data_return_child_from_paused_job(self):
A = self.fake_gerrit.addFakeChange('org/project6', 'master', 'A')
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
self.waitUntilSettled()
self.assertHistory([
dict(name='data-return', result='SUCCESS', changes='1,1'),
dict(name='paused-data-return-child-jobs',
result='SUCCESS', changes='1,1'),
])
class TestDiskAccounting(AnsibleZuulTestCase):
config_file = 'zuul-disk-accounting.conf'

View File

@ -2616,10 +2616,11 @@ class QueueItem(object):
return
skipped = []
# NOTE(pabelanger): Check successful jobs to see if zuul_return
# includes zuul.child_jobs.
# NOTE(pabelanger): Check successful/paused jobs to see if
# zuul_return includes zuul.child_jobs.
build_result = build.result_data.get('zuul', {})
if build.result == 'SUCCESS' and 'child_jobs' in build_result:
if ((build.result == 'SUCCESS' or build.paused)
and 'child_jobs' in build_result):
zuul_return = build_result.get('child_jobs', [])
dependent_jobs = self.job_graph.getDirectDependentJobs(
build.job.name)