@@ -550,11 +550,12 @@ def big_data_passing_tasks(prname: str, task: dict, pipelinerun_template: dict,
550
550
appended_taskrun_name = True
551
551
task ['taskSpec' ] = replace_big_data_placeholder (
552
552
task .get ("taskSpec" , {}), placeholder , workspaces_parameter )
553
- artifact_items = pipelinerun_template ['metadata' ]['annotations' ]['tekton.dev/artifact_items' ]
554
- artifact_items [task ['name' ]] = replace_big_data_placeholder (
555
- artifact_items [task ['name' ]], placeholder , workspaces_parameter )
556
- pipelinerun_template ['metadata' ]['annotations' ]['tekton.dev/artifact_items' ] = \
557
- artifact_items
553
+ artifact_items = pipelinerun_template ['metadata' ]['annotations' ].get ('tekton.dev/artifact_items' , '{}' )
554
+ if artifact_items != '{}' :
555
+ artifact_items [task ['name' ]] = replace_big_data_placeholder (
556
+ artifact_items [task ['name' ]], placeholder , workspaces_parameter )
557
+ pipelinerun_template ['metadata' ]['annotations' ]['tekton.dev/artifact_items' ] = \
558
+ artifact_items
558
559
if appended_taskrun_path_step :
559
560
task ['taskSpec' ]['steps' ].append (appended_taskrun_path_step )
560
561
_append_original_pr_name_env (task )
@@ -651,7 +652,7 @@ def append_taskrun_params(task_name_append: str, task_path_name: str):
651
652
task = input_artifacts_tasks_pr_params (task , task_artifact )
652
653
653
654
# If a task produces a result and artifact, add a step to copy artifact to results.
654
- artifact_items = pipelinerun_template ['metadata' ]['annotations' ][ 'tekton.dev/artifact_items' ]
655
+ artifact_items = pipelinerun_template ['metadata' ]['annotations' ]. get ( 'tekton.dev/artifact_items' , '{}' )
655
656
add_copy_results_artifacts_step = False
656
657
if task .get ("taskSpec" , {}):
657
658
if task_spec .get ('results' , []):
@@ -797,16 +798,18 @@ def clean_up_empty_workflow_structures(workflow: list):
797
798
798
799
799
800
def load_annotations (template : dict ):
800
- artifact_items = json .loads (
801
- str (template ['metadata' ]['annotations' ]['tekton.dev/artifact_items' ]))
802
- template ['metadata' ]['annotations' ]['tekton.dev/artifact_items' ] = \
803
- artifact_items
801
+ if env .get ('DISABLE_ARTIFACT_TRACKING' , 'false' ).lower () != 'true' :
802
+ artifact_items = json .loads (
803
+ str (template ['metadata' ]['annotations' ].get ('tekton.dev/artifact_items' , '{}' )))
804
+ template ['metadata' ]['annotations' ]['tekton.dev/artifact_items' ] = \
805
+ artifact_items
804
806
return template
805
807
806
808
807
809
def jsonify_annotations (template : dict ):
808
- template ['metadata' ]['annotations' ]['tekton.dev/artifact_items' ] = \
809
- json .dumps (template ['metadata' ]['annotations' ]['tekton.dev/artifact_items' ])
810
+ if env .get ('DISABLE_ARTIFACT_TRACKING' , 'false' ).lower () != 'true' :
811
+ template ['metadata' ]['annotations' ]['tekton.dev/artifact_items' ] = \
812
+ json .dumps (template ['metadata' ]['annotations' ].get ('tekton.dev/artifact_items' , '{}' ))
810
813
return template
811
814
812
815
0 commit comments