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

Allow setting order and hooks for test role #2374

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eshulman2
Copy link
Contributor

  • Allow passing hook list directly to hook role
  • Allow setting up stages and hooks for test operator role

Jira: https://issues.redhat.com/browse/OSPRH-10106

Copy link
Contributor

openshift-ci bot commented Sep 24, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cescgina for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

Thanks for the PR! ❤️
I'm marking it as a draft, once your happy with it merging and the PR is passing CI, click the "Ready for review" button below.

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/e1ceb9f2cf3d47658a3de25c1ed70de8

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 39m 16s
podified-multinode-edpm-deployment-crc FAILURE in 1h 03m 43s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 23m 33s
cifmw-multinode-tempest FAILURE in 1h 05m 28s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 35s
cifmw-pod-pre-commit FAILURE in 7m 04s
✔️ build-push-container-cifmw-client SUCCESS in 30m 49s
✔️ cifmw-molecule-run_hook SUCCESS in 3m 26s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 31s

@eshulman2 eshulman2 force-pushed the test_operator_stages branch 3 times, most recently from f24ddba to c4de17d Compare September 24, 2024 15:17
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/a25d6668f88443eeb5b2e354691eb8dc

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 39m 51s
podified-multinode-edpm-deployment-crc FAILURE in 1h 02m 18s
cifmw-crc-podified-edpm-baremetal RETRY_LIMIT in 22m 04s
cifmw-multinode-tempest FAILURE in 1h 02m 50s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 49s
cifmw-pod-pre-commit FAILURE in 8m 22s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 50s
✔️ cifmw-architecture-validate-hci SUCCESS in 4m 00s
✔️ build-push-container-cifmw-client SUCCESS in 31m 24s
✔️ cifmw-molecule-run_hook SUCCESS in 3m 25s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 16s

@eshulman2 eshulman2 force-pushed the test_operator_stages branch 2 times, most recently from c175381 to 5efbd8f Compare September 24, 2024 17:26
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/ea84a8ceb689406f85a63f9e9f8d1718

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 39m 40s
podified-multinode-edpm-deployment-crc FAILURE in 1h 00m 58s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 27m 32s
cifmw-multinode-tempest FAILURE in 1h 01m 56s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 29s
cifmw-pod-pre-commit FAILURE in 6m 57s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 18s
✔️ cifmw-architecture-validate-hci SUCCESS in 4m 47s
✔️ build-push-container-cifmw-client SUCCESS in 20m 55s
✔️ cifmw-molecule-run_hook SUCCESS in 4m 02s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 54s

@eshulman2 eshulman2 force-pushed the test_operator_stages branch 3 times, most recently from 1c61cd8 to 34ffac9 Compare September 25, 2024 08:19
@eshulman2 eshulman2 marked this pull request as ready for review September 25, 2024 08:24
@eshulman2 eshulman2 force-pushed the test_operator_stages branch 2 times, most recently from c00804c to e6b67aa Compare September 25, 2024 08:28
@eshulman2 eshulman2 requested review from lpiwowar, lewisdenny and cjeanner and removed request for lpiwowar and lewisdenny September 25, 2024 09:48
roles/test_operator/tasks/main.yml Outdated Show resolved Hide resolved
roles/test_operator/tasks/stages.yml Outdated Show resolved Hide resolved
scenarios/centos-9/multinode-ci.yml Outdated Show resolved Hide resolved
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/f3e535a33c0d4119ad58509c98bac5dd

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 10m 52s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 16m 09s
cifmw-crc-podified-edpm-baremetal RETRY_LIMIT in 13m 20s
✔️ cifmw-multinode-tempest SUCCESS in 1h 37m 13s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 51s
cifmw-pod-pre-commit FAILURE in 7m 46s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 15s
✔️ cifmw-architecture-validate-hci SUCCESS in 3m 47s
✔️ build-push-container-cifmw-client SUCCESS in 31m 54s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 08s

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/fd36ee025af1498aaf2f4438b661f2ff

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 08m 48s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 19m 23s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 33m 16s
cifmw-multinode-tempest FAILURE in 1h 26m 56s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 08s
cifmw-pod-pre-commit FAILURE in 7m 18s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 14s
✔️ cifmw-architecture-validate-hci SUCCESS in 3m 48s
✔️ build-push-container-cifmw-client SUCCESS in 35m 51s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 12s

roles/test_operator/tasks/stages.yml Outdated Show resolved Hide resolved
* `cifmw_test_operator_stages`: (List) List of dictionaries defining the stages that should be used in the test operator role. List items options are:
* `name`: (String) The name of the stage. The name must be unique.
* `type`: (String) The framework name you would like to call, currently the options are: tempest, ansibletest, horizontest, tobiko.
* `test_file`: (String) Path to the file used for testing, this file should contain the testing params for this stage. Default value: `{{ ansible_user_dir }}/ci-framework-data/artifacts/ansible-vars.yml`
Copy link
Contributor

@lpiwowar lpiwowar Oct 1, 2024

Choose a reason for hiding this comment

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

@eshulman2, ok, it make sense. In that case if everyone agrees, can we do these two things?

  • Add a parameter test_vars which can be used in cases when the test definition is not lengthy.
  • Rename the test_file parameter to test_vars_file.

roles/test_operator/README.md Outdated Show resolved Hide resolved
roles/test_operator/README.md Outdated Show resolved Hide resolved
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/d5cbb3aea2394f379e2d7c11fe085007

✔️ openstack-k8s-operators-content-provider SUCCESS in 2h 01m 51s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 16m 12s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 30m 05s
cifmw-multinode-tempest FAILURE in 1h 27m 35s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 29s
✔️ cifmw-pod-pre-commit SUCCESS in 7m 33s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 27s
✔️ cifmw-architecture-validate-hci SUCCESS in 3m 43s
✔️ build-push-container-cifmw-client SUCCESS in 30m 36s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 16s

lpiwowar added a commit to lpiwowar/test-operator that referenced this pull request Oct 2, 2024
The linked PR for the test-oprator role introduces the concept of
stages. This patch updates the job definition so that it is
consuming the newly defined interface. It is required because by
default only the tempest stage is enabled.

Depends-On: openstack-k8s-operators/ci-framework#2374
Copy link
Contributor

@lpiwowar lpiwowar left a comment

Choose a reason for hiding this comment

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

I have no major problems with the current state of this PR except for the one question raised in the README. Although, we should properly test it in downstream / upstream jobs and ensure smooth transition before we merge this.

I'm testing the PR here.

* `name`: (String) The name of the stage. The name must be unique.
* `type`: (String) The framework name you would like to call, currently the options are: tempest, ansibletest, horizontest, tobiko.
* `test_vars_file`: (String) Path to the file used for testing, this file should contain the testing params for this stage.
* `test_vars`: (String) Testing params for this specific stage if a `test_vars_file` is used the specified parameters would override the ones in the `test_vars_file`.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think overwriting is good 👍

What will happen if we have a job that has the following definition?

...
vars:
  cifmw_test_operator_tempest_include_list: test1
  cifmw_test_operator_stages:
    - name: tempest
      type: tempest
      test_vars:
         cifmw_test_operator_tempest_include_list: test2

If I am not mistaken, then test1 will be executed, right? This is IMO a little bit confusing. The precedence of the variables would be as follows:

global_vars > test_vars > file_vars

I would prefer the more "local" the variable is, the higher power of overwriting it has:

test_vars > file_vars > global_vars

Even if we omit test_vars then I think that test_vars_file should have higher precedence than global_vars (by global_vars I mean those defined in the first level of vars: section or those defined in a parent job). Am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes you are right I thought about it as well in the middle of my PTO, adding a fix patch. I don't love the way the fix patch is built but this is the best way I found for overriding the extra variables having that we are running the playbook with -e @path_to_var_file. I believe precedence should be fine now. Ideas for better ways to override would be appreciated (set_facts won't work) .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(created the patch in a separate to make it easier to revert and discuss)

roles/test_operator/tasks/stages.yml Outdated Show resolved Hide resolved
@lewisdenny
Copy link
Collaborator

I have no major problems with the current state of this PR except for the one question raised in the README. Although, we should properly test it in downstream / upstream jobs and ensure smooth transition before we merge this.

I'm testing the PR here.

+1 from my side, we have a thread open d/s to have this patch tested. Pending that I'm happy with the code.

@lpiwowar
Copy link
Contributor

lpiwowar commented Oct 3, 2024

It seems that the PR does not work as expected according to the job I used for testing -> here. I did not investigate much but the issue is most likely here. We set the _stage_test_vars but we do not pass all the values into the CR [1].

[1] here

Copy link

Merge Failed.

This change or one of its cross-repo dependencies was unable to be automatically merged with the current state of its repository. Please rebase the change and upload a new patchset.
Warning:
Error merging github.com/openstack-k8s-operators/ci-framework for 2374,5cde6b508c59586a4e2e27f6c77e1f077f18d36e

NOTE: this patch will require setting order for all jobs running not only
tempest

- Allow passing hook list directly to hook role
- Allow setting up stages and hooks for test operator role

Jira: https://issues.redhat.com/browse/OSPRH-10106
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/a3737f5ec48c45d7a4f1b7c585026a65

✔️ openstack-k8s-operators-content-provider SUCCESS in 1h 57m 56s
✔️ podified-multinode-edpm-deployment-crc SUCCESS in 1h 21m 05s
✔️ cifmw-crc-podified-edpm-baremetal SUCCESS in 1h 37m 05s
cifmw-multinode-tempest FAILURE in 1h 28m 49s
✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 8m 23s
✔️ cifmw-pod-pre-commit SUCCESS in 6m 57s
✔️ cifmw-pod-zuul-files SUCCESS in 4m 00s
✔️ cifmw-architecture-validate-hci SUCCESS in 3m 43s
✔️ build-push-container-cifmw-client SUCCESS in 20m 48s
✔️ cifmw-molecule-test_operator SUCCESS in 3m 54s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants