Skip to content

Commit

Permalink
[ISV-4837] Incorrect behaviour of the operator pipelines when a PR af…
Browse files Browse the repository at this point in the history
…fects only ci.yaml. (#667)

* [ISV-4837] Skip the tekton tasks when there are no bundles are added or removed.

* Update the when condition for the tekton tasks.

* Update the when condition for the tekton tasks.

* Fix the lint tests.

* Fix the yaml anchor syntax.

* Fix the yaml anchor syntax.

* Fix up the yaml anchor syntax.

* Fix up the yaml anchor syntax.

* Fix up the yaml anchor syntax.

* Fix up the yaml anchor syntax.

* Update ansible/roles/operator-pipeline/templates/openshift/tasks/cert-project-check.yml

Co-authored-by: Maurizio Porrato <[email protected]>

---------

Co-authored-by: Maurizio Porrato <[email protected]>
  • Loading branch information
haripate and mporrato authored Jun 27, 2024
1 parent 209c34b commit 02d8e9f
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,9 @@ spec:
kind: Task
runAfter:
- build-fragment-images
when: &bundleAdded
- input: "$(tasks.detect-changes.results.added_bundle)"
when:
- &bundleAdded
input: "$(tasks.detect-changes.results.added_bundle)"
operator: notin
values: [""]
params:
Expand All @@ -465,6 +466,8 @@ spec:
name: content-hash
runAfter:
- apply-test-waivers
when:
- *bundleAdded
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
Expand All @@ -484,8 +487,8 @@ spec:
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
- name: bundle_path
value: "$(tasks.detect-changes.results.bundle_path)"
- name: operator_path
value: "$(tasks.detect-changes.results.operator_path)"
- name: cert_project_required
value: "$(params.cert_project_required)"
workspaces:
Expand Down Expand Up @@ -537,8 +540,9 @@ spec:
- get-pyxis-certification-data
taskRef:
name: verify-project
when: &certProjectExists
- input: "$(tasks.certification-project-check.results.certification_project_id)"
when:
- &certProjectExists
input: "$(tasks.certification-project-check.results.certification_project_id)"
operator: "notin"
values: [""]
params:
Expand All @@ -558,7 +562,8 @@ spec:
- verify-project
taskRef:
name: update-cert-project-status
when: *certProjectExists
when:
- *certProjectExists
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
Expand All @@ -583,7 +588,8 @@ spec:
- update-cert-project-status
taskRef:
name: reserve-operator-name
when: *certProjectExists
when:
- *certProjectExists
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
Expand Down Expand Up @@ -662,10 +668,12 @@ spec:
- static-tests-results
taskRef:
name: yaml-lint
when: &operatorOrBundleChange
- input: "$(tasks.detect-changes.results.affected_catalogs)"
when:
- &operatorOrBundleChange
input: "$(tasks.detect-changes.results.affected_catalogs)"
operator: in
values: [""]
- *bundleAdded
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
Expand Down Expand Up @@ -778,7 +786,8 @@ spec:
- name: make-bundle-repo-public
runAfter:
- build-bundle
when: *operatorOrBundleChange
when:
- *operatorOrBundleChange
taskRef:
name: set-quay-repo-visibility
params:
Expand Down Expand Up @@ -844,7 +853,8 @@ spec:
- name: add-bundle-to-index
runAfter:
- add-fbc-fragments-to-index
when: *operatorOrBundleChange
when:
- *operatorOrBundleChange
taskRef:
name: add-bundle-to-index
params:
Expand Down Expand Up @@ -878,7 +888,8 @@ spec:
- name: make-index-repo-public
runAfter:
- add-bundle-to-index
when: *operatorOrBundleChange
when:
- *operatorOrBundleChange
taskRef:
name: set-quay-repo-visibility
params:
Expand All @@ -898,6 +909,8 @@ spec:
- name: get-ci-results-attempt
runAfter:
- make-index-repo-public
when:
- *bundleAdded
taskRef:
name: get-ci-results-attempt
params:
Expand Down Expand Up @@ -983,6 +996,7 @@ spec:
- input: "$(tasks.detect-changes.results.affected_catalogs)"
operator: in
values: [""]
- *bundleAdded
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
Expand Down Expand Up @@ -1023,9 +1037,7 @@ spec:
kind: Task
name: evaluate-preflight-result
when:
- input: "$(tasks.detect-changes.results.added_bundle)"
operator: notin
values: [""]
- *bundleAdded
- input: "$(tasks.detect-changes.results.affected_catalogs)"
operator: in
values: [""]
Expand Down Expand Up @@ -1056,6 +1068,8 @@ spec:
- evaluate-preflight-result
taskRef:
name: get-ci-results
when:
- *bundleAdded
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
Expand Down Expand Up @@ -1201,7 +1215,9 @@ spec:
- name: upload-pipeline-logs
taskRef:
name: upload-pipeline-logs
when: *certProjectExists
when:
- *certProjectExists
- *bundleAdded
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
Expand Down Expand Up @@ -1265,7 +1281,8 @@ spec:
- name: github-add-connect-url-comment
taskRef:
name: github-add-comment
when: *certProjectExists
when:
- *certProjectExists
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ spec:
- name: content-hash
runAfter:
- read-config
when:
- &bundleAdded
input: "$(tasks.detect-changes.results.added_bundle)"
operator: notin
values: [""]
taskRef:
name: content-hash
params:
Expand All @@ -258,8 +263,8 @@ spec:
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
- name: bundle_path
value: "$(tasks.detect-changes.results.bundle_path)"
- name: operator_path
value: "$(tasks.detect-changes.results.operator_path)"
- name: cert_project_required
value: "$(params.cert_project_required)"
workspaces:
Expand Down Expand Up @@ -338,8 +343,9 @@ spec:
- copy-bundle-image-to-released-registry
taskRef:
name: publish-pyxis-data
when: &certProjectExists
- input: "$(tasks.certification-project-check.results.certification_project_id)"
when:
- &certProjectExists
input: "$(tasks.certification-project-check.results.certification_project_id)"
operator: "notin"
values: [""]
params:
Expand Down Expand Up @@ -662,7 +668,9 @@ spec:
- name: upload-pipeline-logs
taskRef:
name: upload-pipeline-logs
when: *certProjectExists
when:
- *certProjectExists
- *bundleAdded
params:
- name: pipeline_image
value: "$(params.pipeline_image)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ metadata:
spec:
params:
- name: pipeline_image
- name: bundle_path
description: path indicating the location of the certified bundle within the repository
- name: operator_path
description: path indicating the location of the certified operator within the repository
- name: cert_project_required
description: A flag determines whether a cert project ID needs to be present
default: "true"
Expand All @@ -31,9 +31,7 @@ spec:
exit 0
fi
PKG_PATH=$(dirname $(realpath $(params.bundle_path)))
CI_FILE_PATH="$PKG_PATH/ci.yaml"
CI_FILE_PATH="$(params.operator_path)/ci.yaml"
CERT_PROJECT_ID=$(cat $CI_FILE_PATH | yq -r '.cert_project_id | select (.!=null)')
Expand Down

0 comments on commit 02d8e9f

Please sign in to comment.