Skip to content

Commit c3186a7

Browse files
committed
Parallelize hosted pipeline
A subset of tasks in the hosted pipeline can run in parallel to speedup the pipelinerun execution time. I identified several tasks and updated pipeline dependency graph. There are more tasks that could be also parallelized but it makes the graph readability more difficult. This solution is compromise between speed and maintainability. Signed-off-by: Ales Raszka <araszka@redhat.com>
1 parent 8541212 commit c3186a7

1 file changed

Lines changed: 54 additions & 46 deletions

File tree

ansible/roles/operator-pipeline/templates/openshift/pipelines/operator-hosted-pipeline.yml

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ spec:
336336
name: check-permissions
337337
kind: Task
338338
runAfter:
339-
- yaml-lint
339+
- detect-changes
340340
params:
341341
- name: pipeline_image
342342
value: "$(params.pipeline_image)"
@@ -372,7 +372,7 @@ spec:
372372
name: set-github-pr-title
373373
kind: Task
374374
runAfter:
375-
- check-permissions
375+
- detect-changes
376376
params:
377377
- name: pipeline_image
378378
value: "$(params.pipeline_image)"
@@ -396,7 +396,7 @@ spec:
396396
name: read-config
397397
kind: Task
398398
runAfter:
399-
- set-github-pr-title
399+
- detect-changes
400400
params:
401401
- name: pipeline_image
402402
value: "$(params.pipeline_image)"
@@ -415,7 +415,7 @@ spec:
415415
name: validate-catalog-format
416416
kind: Task
417417
runAfter:
418-
- read-config
418+
- get-pyxis-certification-data
419419
when:
420420
- input: "$(tasks.detect-changes.results.added_or_modified_catalogs)"
421421
operator: notin
@@ -462,7 +462,7 @@ spec:
462462
name: apply-test-waivers
463463
kind: Task
464464
runAfter:
465-
- build-fragment-images
465+
- detect-changes
466466
when:
467467
- &bundleAdded
468468
input: "$(tasks.detect-changes.results.added_bundle)"
@@ -484,11 +484,44 @@ spec:
484484
workspace: repository
485485
subPath: base
486486

487+
- name: static-tests
488+
taskRef:
489+
name: run-static-tests
490+
kind: Task
491+
runAfter:
492+
- apply-test-waivers
493+
params:
494+
- name: pipeline_image
495+
value: "$(params.pipeline_image)"
496+
- name: pull_request_url
497+
value: "$(params.git_pr_url)"
498+
- name: bundle_path
499+
value: "$(tasks.detect-changes.results.bundle_path)"
500+
- name: operator_name
501+
value: "$(tasks.detect-changes.results.added_operator)"
502+
- name: bundle_version
503+
value: "$(tasks.detect-changes.results.added_bundle)"
504+
- name: affected_catalog_operators
505+
value: "$(tasks.detect-changes.results.affected_catalog_operators)"
506+
- name: github_token_secret_name
507+
value: "$(params.github_token_secret_name)"
508+
- name: github_token_secret_key
509+
value: "$(params.github_token_secret_key)"
510+
- name: test_suites
511+
value: "$(params.static_test_suites)"
512+
workspaces:
513+
- name: source
514+
workspace: repository
515+
subPath: src
516+
- name: output
517+
workspace: results
518+
subPath: summary
519+
487520
- name: content-hash
488521
taskRef:
489522
name: content-hash
490523
runAfter:
491-
- apply-test-waivers
524+
- detect-changes
492525
params:
493526
- name: pipeline_image
494527
value: "$(params.pipeline_image)"
@@ -502,7 +535,7 @@ spec:
502535
# Get cert project id
503536
- name: certification-project-check
504537
runAfter:
505-
- content-hash
538+
- detect-changes
506539
taskRef:
507540
name: certification-project-check
508541
params:
@@ -521,7 +554,7 @@ spec:
521554

522555
- name: get-organization
523556
runAfter:
524-
- certification-project-check
557+
- detect-changes
525558
taskRef:
526559
name: get-organization
527560
params:
@@ -535,7 +568,13 @@ spec:
535568
# Get cert project related data
536569
- name: get-pyxis-certification-data
537570
runAfter:
538-
- get-organization
571+
- certification-project-check
572+
- read-config
573+
- yaml-lint
574+
- check-permissions
575+
- set-github-pr-title
576+
- static-tests
577+
- content-hash
539578
taskRef:
540579
name: get-pyxis-certification-data
541580
params:
@@ -561,6 +600,7 @@ spec:
561600
- name: verify-project
562601
runAfter:
563602
- get-pyxis-certification-data
603+
- get-organization
564604
taskRef:
565605
name: verify-project
566606
when:
@@ -632,40 +672,6 @@ spec:
632672
- name: source
633673
value: "$(tasks.get-organization.results.organization)"
634674

635-
- name: static-tests
636-
taskRef:
637-
name: run-static-tests
638-
kind: Task
639-
runAfter:
640-
- reserve-operator-name
641-
params:
642-
- name: pipeline_image
643-
value: "$(params.pipeline_image)"
644-
- name: pull_request_url
645-
value: "$(params.git_pr_url)"
646-
- name: bundle_path
647-
value: "$(tasks.detect-changes.results.bundle_path)"
648-
- name: operator_name
649-
value: "$(tasks.detect-changes.results.added_operator)"
650-
- name: bundle_version
651-
value: "$(tasks.detect-changes.results.added_bundle)"
652-
- name: affected_catalog_operators
653-
value: "$(tasks.detect-changes.results.affected_catalog_operators)"
654-
- name: github_token_secret_name
655-
value: "$(params.github_token_secret_name)"
656-
- name: github_token_secret_key
657-
value: "$(params.github_token_secret_key)"
658-
- name: test_suites
659-
value: "$(params.static_test_suites)"
660-
workspaces:
661-
- name: source
662-
workspace: repository
663-
subPath: src
664-
- name: output
665-
workspace: results
666-
subPath: summary
667-
668-
669675
# Merge user's registry tokens with service account credentials
670676
# used elsewhere by this pipeline.
671677
#
@@ -675,7 +681,7 @@ spec:
675681
# our credentials for that registry will be omitted.
676682
- name: merge-registry-credentials
677683
runAfter:
678-
- static-tests
684+
- reserve-operator-name
679685
taskRef:
680686
name: merge-registry-credentials
681687
when:
@@ -825,6 +831,7 @@ spec:
825831
- name: build-fbc-index-images
826832
runAfter:
827833
- get-supported-versions
834+
- build-fragment-images
828835
when:
829836
- *catalogFileChange
830837
taskRef:
@@ -858,7 +865,7 @@ spec:
858865
# Build new temporary index using IIB
859866
- name: add-bundle-to-index
860867
runAfter:
861-
- build-fbc-index-images
868+
- get-supported-versions
862869
when:
863870
# Run only when a bundle is added and it doesn't use FBC
864871
- *bundleAdded
@@ -898,7 +905,7 @@ spec:
898905

899906
- name: build-fbc-scratch-catalog
900907
runAfter:
901-
- build-fbc-index-images
908+
- get-supported-versions
902909
when:
903910
# Run only when a bundle is added and it uses FBC
904911
- *bundleAdded
@@ -1245,6 +1252,7 @@ spec:
12451252
- name: merge-pr
12461253
runAfter:
12471254
- add-bundle-to-fbc-dryrun
1255+
- build-fbc-index-images
12481256
taskRef:
12491257
name: merge-pr
12501258
params:

0 commit comments

Comments
 (0)