Skip to content

Commit 2900f9e

Browse files
authored
fix(sdk) include finally tasks in placeholder indir (kubeflow#1035)
1 parent 8dbce39 commit 2900f9e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

sdk/python/kfp_tekton/compiler/_tekton_handler.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,16 @@ def _handle_tekton_pipeline_variables(pipeline_run):
7474
}
7575

7676
add_type = pipeline_run.get('kind') != 'PipelineRun'
77-
task_list = pipeline_run['spec']['pipelineSpec']['tasks']
78-
for task in task_list:
77+
78+
def handle_task(task):
7979
if task.get('taskRef', {}):
80-
continue
80+
return
8181
if 'taskSpec' in task and 'apiVersion' in task['taskSpec']:
8282
# recur for embedded pipeline resources
8383
if 'spec' in task['taskSpec'] and 'pipelineSpec' in task['taskSpec']['spec']:
8484
resource_spec = task['taskSpec']
8585
_handle_tekton_pipeline_variables(resource_spec)
86-
continue
86+
return
8787

8888
for key, val in pipeline_variables.items():
8989
task_str = json.dumps(task['taskSpec']['steps'])
@@ -108,6 +108,13 @@ def _handle_tekton_pipeline_variables(pipeline_run):
108108
param['type'] = 'string'
109109
task['taskSpec'].setdefault('params', []).append(param)
110110

111+
task_list = pipeline_run.get('spec', {}).get('pipelineSpec', {}).get('tasks', [])
112+
finally_task_list = pipeline_run.get('spec', {}).get('pipelineSpec', {}).get('finally', [])
113+
for task in task_list:
114+
handle_task(task)
115+
for task in finally_task_list:
116+
handle_task(task)
117+
111118
return pipeline_run
112119

113120

0 commit comments

Comments
 (0)