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

Avoid failed workflow if a pytest fails #47

Closed
3 tasks done
davidcr01 opened this issue Sep 3, 2024 · 4 comments · Fixed by #188
Closed
3 tasks done

Avoid failed workflow if a pytest fails #47

davidcr01 opened this issue Sep 3, 2024 · 4 comments · Fixed by #188
Assignees
Labels
level/task Task issue type/change Change performed in a resource or Wazuh Cloud environment

Comments

@davidcr01
Copy link
Contributor

davidcr01 commented Sep 3, 2024

Description

We want to modify the Python test migrated in #20. In the Python test, if a pytest function fails, the complete task fails. For example, in the following GHA, the workflow fails because of a failed pytest: wazuh/wazuh#25534

Although this behavior is correct, we want to make the workflow finish with other success, rather than fail in this kind of case. It seems that there are more options rather than success or failure in GitHub Actions, something like a warning exit code.

Tasks

  • Decide the workflow exit status when a pytest fails
  • Apply the change
  • Validate the new behavior
@davidcr01 davidcr01 added level/task Task issue type/change Change performed in a resource or Wazuh Cloud environment labels Sep 3, 2024
@wazuhci wazuhci moved this to Triage in Release 5.0.0 Sep 3, 2024
@wazuhci wazuhci moved this from Triage to Backlog in Release 5.0.0 Sep 3, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 5.0.0 Dec 26, 2024
@fcaffieri
Copy link
Member

Update report

After discussing the scope of the issue with the team, it was decided to generate 2 types of outputs:

  1. Warning: Failure in Wazuh tests
  2. Error: Failure in the installation wizard
    This is because what is being tested in the test is the installation wizard and not detecting bugs in Wazuh
    We will work on implementing these situations.

@fcaffieri
Copy link
Member

fcaffieri commented Dec 27, 2024

Update report

After implementing the error handler for workflows, it was detected that GitHub actions only support 2 output values:

  • 0: All steps were executed correctly and the action is marked as green
  • 1: Some steps failed, it is marked as red and the entire action failed.

Based on this premise, a solution was implemented where if the test of the Wazuh installation tools fails, the entire test is reported as failed. On the contrary, if only the test of the Wazuh components fails, the test is reported as successful (since the objective of the test is to validate the installation tools and not the functionality of Wazuh). Still, warnings are left in the component testing step, for later information to the responsible team.

Improvements

Additionally, bugs on the installation wizards were fixed, and the products of the migration to 5.0.0.
Finally, an improvement was incorporated where if a crucial step fails, the execution of the remaining steps is interrupted, since the test is considered failed.

Tests

Installation Wizard (Distributed)

https://github.com/wazuh/wazuh-installation-assistant/actions/runs/12518291928/job/34920498369
Image
Image

@fcaffieri fcaffieri reopened this Dec 27, 2024
@fcaffieri
Copy link
Member

Update report

Working on fixing the AIO install assistant:

Image

@fcaffieri
Copy link
Member

Image

@fcaffieri fcaffieri linked a pull request Dec 30, 2024 that will close this issue
@wazuhci wazuhci moved this from In progress to Pending review in Release 5.0.0 Dec 30, 2024
@wazuhci wazuhci moved this from Pending review to Done in Release 5.0.0 Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/change Change performed in a resource or Wazuh Cloud environment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants