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

Add create xml results file to validations role #2456

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

drosenfe
Copy link

Add generation of xml results file to validations role. This will allow polarion status reporting for validations.

@github-actions github-actions bot marked this pull request as draft October 14, 2024 18:17
Copy link
Contributor

openshift-ci bot commented Oct 14, 2024

Hi @drosenfe. Thanks for your PR.

I'm waiting for a openstack-k8s-operators member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

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

✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 55s
cifmw-pod-pre-commit FAILURE in 7m 34s
✔️ build-push-container-cifmw-client SUCCESS in 37m 52s
✔️ cifmw-molecule-validations SUCCESS in 4m 41s

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

✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 24s
cifmw-pod-pre-commit FAILURE in 7m 20s
build-push-container-cifmw-client FAILURE in 15m 43s
✔️ cifmw-molecule-validations SUCCESS in 3m 56s

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/31370ac9596b472daa36cebad50d2757

✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 16s
cifmw-pod-pre-commit FAILURE in 7m 07s
build-push-container-cifmw-client FAILURE in 15m 48s
✔️ cifmw-molecule-validations SUCCESS in 4m 02s

@drosenfe
Copy link
Author

recheck

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

✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 54s
cifmw-pod-pre-commit FAILURE in 7m 32s
build-push-container-cifmw-client FAILURE in 15m 43s
✔️ cifmw-molecule-validations SUCCESS in 4m 11s

@lewisdenny
Copy link
Collaborator

/ok-to-test

Copy link
Contributor

@bshephar bshephar left a comment

Choose a reason for hiding this comment

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

If this is working to get the data you need into Polarion then it lgtm. Just some follow up tidying that we can do, but realistically it's orthogonal to this change anyway. I don't want to distract from the objective of the PR with that conversation here, this change just draws attention to that requirement for me.

roles/validations/tasks/main.yml Show resolved Hide resolved
Copy link
Collaborator

@lewisdenny lewisdenny left a comment

Choose a reason for hiding this comment

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

/approve

JFYI we have roles/polarion for uploading the polarion xml once ready.

Copy link
Contributor

openshift-ci bot commented Oct 22, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lewisdenny

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

The pull request process is described 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

@lewisdenny lewisdenny requested a review from a team October 23, 2024 01:03
@bshephar
Copy link
Contributor

/approve

JFYI we have roles/polarion for uploading the polarion xml once ready.

I think ultimately, what might be nice as a follow up to this PR is a new task file in the polarion role that will take some Ansible variable inputs, and use a jinja2 template to format those results into the required XML for polarion. Then instead of all the XML handling we're doing in this PR, we can simply call import tasks_from that new polarion file and it can handle to XML side of things.

But since this is only going to impact the EDPM validations, it's fairly limited impact if something were to stop working for some reason. I'm in favor of merging it to keep progress going, and maybe we can backlog a Epic to tidy up the XML side of things.

roles/validations/tasks/edpm/hotfix.yml Show resolved Hide resolved
roles/validations/tasks/xmlcreate.yml Outdated Show resolved Hide resolved
roles/validations/tasks/xmlcreate.yml Outdated Show resolved Hide resolved
roles/validations/tasks/xmlcreate.yml Outdated Show resolved Hide resolved
roles/validations/tasks/main.yml Outdated Show resolved Hide resolved
- name: Write first line of xml results file
ansible.builtin.shell: |
mkdir -p "{{ cifmw_validations_xml_status_file_dir }}"
echo "<testsuite errors=\"{{ validations_errors }}\" failures=\"{{ validations_failed }}\" name=\"\" tests=\"{{ validations_executed }}\" time=\"{{ validations_run_time }}\">" >> {{ cifmw_validations_xml_status_file_dir }}/validations_results.xml
Copy link
Collaborator

Choose a reason for hiding this comment

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

Generating XML with bash is asking for trouble. There's not nice way to generate XML in Ansible, but using jinja2 would be a step forward.

Copy link
Author

Choose a reason for hiding this comment

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

@pablintino Is this comment a goal or a requirement? Before I started this review I asked on the proj-create-integration-pipeline-jobs about creating xml files and the answer was: it could be even a simple set of echo "" , but if you want to use something easy and more structured you could use https://pypi.org/project/junitparser/

Copy link
Collaborator

Choose a reason for hiding this comment

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

@drosenfe It's a suggestion to improve the maintainability of the role, specially given that I don't see a molecule test that ensure the rendered XML matches the expectations. If you and all the ones involved in this role are fine I'm ok with the change.

Copy link
Author

@drosenfe drosenfe Nov 1, 2024

Choose a reason for hiding this comment

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

I looked quite a lot at junitparser. Doing a fake test from command line this is the output it gives:

<?xml version="1.0" encoding="utf-8"?>
<testsuites>
        <testsuite name="validations" tests="3" errors="0" failures="0" skipped="0" time="1.8">
                <testcase name="hugepages_and_reboot.yml" classname="validations.edpm" time="0.5"/>
                <testcase name="hotfix.yml" classname="validations.edpm" time="0.6"/>
                <testcase name="scaledown.yml" classname="validations.edpm" time="0.7"/>
        </testsuite>
</testsuites>

This different in a few ways from the current xml files generated by tempest

  • it uses tabs instead of spaces (could be changed with sed after creation)
  • it has an extra xml header (could be deleted after creation)
  • the test cases have order: name, classname, time while tempest xml files have order: classname, name, time
  • the testsuite order for tests, errors, failures, skipped is different

What does anyone think about using junitparser? There were some advantages. It sums the test cases, failures, and total time so that the validations roles does not need too track those.

block:
- name: Make new xml line list entry
ansible.builtin.set_fact:
new_xml_line_list_entry: [' <testcase classname="validations.{{item | dirname}}" name="{{item | basename}}" time="{{ individual_validator_run_time }}">']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Details like the indentation handling you do here is one of the reasons I added this comment:
https://github.com/openstack-k8s-operators/ci-framework/pull/2456/files#diff-745f651c7f88527b40991eca9fbe69b880b93734ee5a24b140a3fcac8becac2aR87

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/50249f51bb214b8a889635e7f9373b0d

✔️ noop SUCCESS in 0s
✔️ cifmw-pod-ansible-test SUCCESS in 7m 52s
cifmw-pod-pre-commit FAILURE in 8m 13s
✔️ build-push-container-cifmw-client SUCCESS in 37m 37s
✔️ cifmw-molecule-validations SUCCESS in 4m 43s

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