Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stf-run-ci: get operator info from CSV instead of image metadata #643

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

compi-migui
Copy link
Contributor

OLM cares about CSV contents, not image metadata. Getting operator package information directly from the CSV guarantees that the index image we generate will actually work with the operator-bundles we're trying to test.

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/3da555601dd94072ab1fdcac4ac39fa1

stf-crc-ocp_414-local_build RETRY_LIMIT in 23m 22s
✔️ stf-crc-ocp_416-local_build SUCCESS in 37m 21s
stf-crc-ocp_414-local_build-index_deploy RETRY_LIMIT in 25m 13s
stf-crc-ocp_416-local_build-index_deploy FAILURE in 33m 24s
stf-crc-ocp_414-nightly_bundles-index_deploy RETRY_LIMIT in 26m 54s
stf-crc-ocp_416-nightly_bundles-index_deploy FAILURE in 24m 00s

@compi-migui compi-migui force-pushed the migarcia-ci-bundle-info-from-csv-files branch from cb39036 to 3d35351 Compare November 7, 2024 13:05
@compi-migui compi-migui marked this pull request as ready for review November 7, 2024 13:11
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/30230ee2acf2449ea7fc72079b45380b

stf-crc-ocp_414-local_build RETRY_LIMIT in 28m 22s
✔️ stf-crc-ocp_416-local_build SUCCESS in 39m 20s
stf-crc-ocp_414-local_build-index_deploy FAILURE in 34m 11s
stf-crc-ocp_416-local_build-index_deploy FAILURE in 35m 58s
stf-crc-ocp_414-nightly_bundles-index_deploy RETRY_LIMIT in 24m 45s
stf-crc-ocp_416-nightly_bundles-index_deploy FAILURE in 23m 45s

@elfiesmelfie
Copy link
Collaborator

recheck

@compi-migui compi-migui force-pushed the migarcia-ci-bundle-info-from-csv-files branch from 3d35351 to a3cfcab Compare November 7, 2024 16:16
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/e854741365df4eb1b18d96cd99341240

stf-crc-ocp_414-local_build RETRY_LIMIT in 27m 01s
✔️ stf-crc-ocp_416-local_build SUCCESS in 41m 21s
stf-crc-ocp_414-local_build-index_deploy RETRY_LIMIT in 26m 39s
stf-crc-ocp_416-local_build-index_deploy FAILURE in 35m 43s
stf-crc-ocp_414-nightly_bundles-index_deploy RETRY_LIMIT in 26m 57s
stf-crc-ocp_416-nightly_bundles-index_deploy FAILURE in 23m 10s

OLM cares about CSV contents, not image metadata. Getting operator
package information directly from the CSV guarantees that the index
image we generate will actually work with the operator-bundles we're
trying to test.
@compi-migui compi-migui force-pushed the migarcia-ci-bundle-info-from-csv-files branch from a3cfcab to d706ed2 Compare November 7, 2024 17:11
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/c6639d353cd84230a85c674ee439810b

stf-crc-ocp_414-local_build RETRY_LIMIT in 27m 12s
✔️ stf-crc-ocp_416-local_build SUCCESS in 41m 08s
stf-crc-ocp_414-local_build-index_deploy RETRY_LIMIT in 25m 46s
stf-crc-ocp_416-local_build-index_deploy FAILURE in 47m 17s
stf-crc-ocp_414-nightly_bundles-index_deploy RETRY_LIMIT in 26m 04s
stf-crc-ocp_416-nightly_bundles-index_deploy FAILURE in 23m 48s

ansible.builtin.command: oc image extract {{ __smart_gateway_bundle_image_path }} --file /manifests/*clusterserviceversion.yaml
args:
chdir: "{{ base_dir }}/working/service-telemetry-framework-index/"

Copy link
Collaborator

@elfiesmelfie elfiesmelfie Nov 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add in a fetch between the oc image extract and the include_vars.

You will have a different dir on the executor, which is accessible through the zuul.executor.work_root var.

https://logserver.rdoproject.org/43/643/3d353512a7e5bf574ca453b42a771b99df896dd7/github-check/stf-crc-ocp_416-nightly_bundles-index_deploy/3ac2688/zuul-info/inventory.yaml

For the fetch module, the src is the target node for this play, the dest is on the ansible controller

Suggested change
- name: Set the csv_dest based on whether zuul is used or not
ansible.builtin.set_fact:
csv_dest: "{{ zuul.executor.work_dir if zuul is defined else base_dir + '/working/service-telemetry-framework-index/' }}"
- name: "Put the CSV files onto the ansible controller, so we can include_vars"
ansible.builtin.fetch:
src: "{{ base_dir }}/working/service-telemetry-framework-index/service-telemetry-operator.clusterserviceversion.yaml"
dest: "{{ csv_dest }}/"
flat: yes
- name: "Put the CSV files onto the ansible controller, so we can include_vars"
ansible.builtin.fetch:
src: "{{ base_dir }}/working/service-telemetry-framework-index/smart-gateway-operator.clusterserviceversion.yaml"
dest: "{{ csv_dest }}/"
flat: yes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to update the filenames in the next two tasks to use this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining! Reading Ansible docs along with your hints has led me to the slurp module, which might work even better here: https://docs.ansible.com/ansible/latest/collections/ansible/builtin/slurp_module.html

We're ultimately shoving the file contents into a variable anyway, so if this works it would save us from the zuul vs not divergence and having to keep track of where the file is.

I'm giving it a try, if it doesn't work then I'll go with the way you suggested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize now you already pushed a fix so I'll leave it as is. Thank you.

Copy link
Collaborator

@elfiesmelfie elfiesmelfie Nov 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You made a good point with the zuul vs not divergence. I don't particularly like having to account for zuul in this, since it starts looking complicated.

With the slurp module, you need to do something like:

- slurp:
      file: ...
  register: slurped_file
 
- set_fact:
      my_var: "{{ slurped_file.content | b64decode | from_yaml }}"

I can provide some playbook for testing that, if you want to play with it for learning.
I can also consider adding the replacement later, I trust that the CI job has coverage for this, since one of our test scenarios is bundle+index deploy

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/e939de954a0d4ec4bfe15c2484928b13

✔️ stf-crc-ocp_414-local_build SUCCESS in 40m 04s
✔️ stf-crc-ocp_416-local_build SUCCESS in 34m 28s
stf-crc-ocp_414-local_build-index_deploy FAILURE in 44m 19s
stf-crc-ocp_416-local_build-index_deploy FAILURE in 46m 00s
stf-crc-ocp_414-nightly_bundles-index_deploy RETRY_LIMIT in 26m 41s
stf-crc-ocp_416-nightly_bundles-index_deploy FAILURE in 24m 30s

@@ -13,35 +13,76 @@
sto_bundle_info: "{{ generate_bundle_sto.stdout_lines[-1] | from_json }}"
sgo_bundle_info: "{{ generate_bundle_sgo.stdout_lines[-1] | from_json }}"

- name: Generate default package names if not present
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this step inside the "Create info variables from provided pre-built bundles (deploy from bundles)" group of steps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's the opposite problem: the "deploy from bundles" group gets the package_name from the CSV, so this shouldn't run in that case at all. Changing the when: to __local_build_enabled | bool and not __deploy_from_bundles_enabled | bool so it only runs for local builds

Local builds get the default package name, non-local ones will get it
from the actual bundle's CSV.
Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/f2ef8b3429304b859bf677d197ab1056

stf-crc-ocp_414-local_build RETRY_LIMIT in 25m 20s
✔️ stf-crc-ocp_416-local_build SUCCESS in 36m 57s
stf-crc-ocp_414-local_build-index_deploy RETRY_LIMIT in 26m 39s
stf-crc-ocp_416-local_build-index_deploy FAILURE in 48m 21s
stf-crc-ocp_414-nightly_bundles-index_deploy RETRY_LIMIT in 26m 38s
stf-crc-ocp_416-nightly_bundles-index_deploy FAILURE in 24m 15s

Copy link

Build failed (check pipeline). Post recheck (without leading slash)
to rerun all jobs. Make sure the failure cause has been resolved before
you rerun jobs.

https://softwarefactory-project.io/zuul/t/rdoproject.org/buildset/4c61c418fdab4df09d6e4841839e3ff1

stf-crc-ocp_414-local_build RETRY_LIMIT in 25m 18s
✔️ stf-crc-ocp_416-local_build SUCCESS in 37m 03s
stf-crc-ocp_414-local_build-index_deploy RETRY_LIMIT in 26m 13s
✔️ stf-crc-ocp_416-local_build-index_deploy SUCCESS in 38m 20s
stf-crc-ocp_414-nightly_bundles-index_deploy RETRY_LIMIT in 25m 24s
✔️ stf-crc-ocp_416-nightly_bundles-index_deploy SUCCESS in 29m 35s

@vkmc vkmc merged commit e67d43b into master Nov 8, 2024
9 of 10 checks passed
@vkmc vkmc deleted the migarcia-ci-bundle-info-from-csv-files branch November 8, 2024 11:58
compi-migui added a commit that referenced this pull request Nov 8, 2024
* stf-run-ci: get operator info from CSV instead of image metadata

OLM cares about CSV contents, not image metadata. Getting operator
package information directly from the CSV guarantees that the index
image we generate will actually work with the operator-bundles we're
trying to test.

* [stf-run-ci][create_catalog] Fetch files to ansible controller before trying to load vars

* [stf-run-ci][create_catalog] Default package name in local build only

Local builds get the default package name, non-local ones will get it
from the actual bundle's CSV.

* [stf-run-ci][create_catalog] Fixup Zuul workdir reference

* [stf-run-ci][create_catalog] Fixup SGO bundle local build package name

---------

Co-authored-by: Emma Foley <[email protected]>
(cherry picked from commit e67d43b)
vkmc added a commit that referenced this pull request Nov 8, 2024
…adata"

Backport of #643

Downstream CVP uses the stable-1.5 branch and breaks without this.

(cherry picked from commit e67d43b)
vkmc pushed a commit that referenced this pull request Nov 8, 2024
… (#644)

* stf-run-ci: get operator info from CSV instead of image metadata

OLM cares about CSV contents, not image metadata. Getting operator
package information directly from the CSV guarantees that the index
image we generate will actually work with the operator-bundles we're
trying to test.

* [stf-run-ci][create_catalog] Fetch files to ansible controller before trying to load vars

* [stf-run-ci][create_catalog] Default package name in local build only

Local builds get the default package name, non-local ones will get it
from the actual bundle's CSV.

* [stf-run-ci][create_catalog] Fixup Zuul workdir reference

* [stf-run-ci][create_catalog] Fixup SGO bundle local build package name

---------

Co-authored-by: Emma Foley <[email protected]>
(cherry picked from commit e67d43b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants