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 1 commit 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
@eshulman2 eshulman2 force-pushed the test_operator_stages branch 6 times, most recently from e78e568 to 3504fa0 Compare September 29, 2024 13:57
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've added a few comments. Upstream jobs need to be updated as well (at least the one in the test-operator repo) [1].

@lpiwowar AFAIK the hooks that are part of this project are here https://github.com/openstack-k8s-operators/ci-framework/tree/main/hooks but as the hook can call any playbook from any location/repo/playbook I don't think this is something we can monitor 100% as you said but even without this patch people can still work around it. Maybe we can suggest people having a specific dir for d/s as well.

Yes, it seems that we are not going to be able to have full control of this. If we could by default read from the directory (or another one located within the test-operator role dir) you mentioned I think it wouldn't hurt and give a hint to the users of this role that any hooks should be located there. We would just hit the issue of downstream vs upstream hooks. Ideally all the hooks would be moved to upstream but this would take extra time.

[1] here

* `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

Choose a reason for hiding this comment

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

What about test_vars_file or test_vars? The current name gives me a feeling that some actual testing is happening inside this file whereas it is a file with testing parameters.

Also, what about changing this interface so that the vars can be specified directly in the test_vars field?

cifmw_test_operator_stages:
 - name: "stage-1-tempest"
   type: "tempest"
   test_vars:
       cifmw_test_operator_abc: x
       cifmw_test_operator_def: y

Copy link
Contributor Author

@eshulman2 eshulman2 Sep 30, 2024

Choose a reason for hiding this comment

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

@lpiwowar the reason I wanted it to be a file was to be able to avoid having to specify all the parameters inside the stages structure which can make it very large and hard to manage. I can add an additional interface if you think appropriate but I would prefer to keep the test var file.

Copy link
Contributor

Choose a reason for hiding this comment

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

In the provided link most of the space of the stage definition is taken by the hooks. Looking at the stage definition I want to see what tests are being executed there and with what configuration. To me this starts to feel too nested. Job definition -> vars file -> tests file. This would mean that for each stage there will be with high probability a new test file. I'm not sure whether we want to go this way.

I would prefer to go with test_vars. I guess we need somebody to decide what is best.

But one way or the other I would rename the var to test_vars or test_vars_file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lpiwowar please note that assuming you want to run several tempest stages you would have to specify ALL (different) variables in the stages definition. maybe it wasn't clear in the reference I shared but it runs completely different tempest stages 3 times having to specify all the vars in the stage definition would make it hard to manage. I believe having test variables in different files should simplify it and make it easier to manage and review. I don't mint having both but not having the file one would complicate things for some jobs IMHO.

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

- name: "Call runner {{ _stage_vars.type }}"
vars:
file_vars: "{{ _stage_var_file | default({}) }}"
test_vars: "{{ _stage_vars.test_vars | default({}) }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Suggested change
test_vars: "{{ _stage_vars.test_vars | default({}) }}"
test_vars: "{{ _stage_vars.test_vars | default({}) }}"

@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.

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.

5 participants