Skip to content

Commit

Permalink
fix(ci): ensure validator output is captured and displayed properly
Browse files Browse the repository at this point in the history
This commit addresses an issue where the validator's output was not
properly captured and printed on the CI

Signed-off-by: vprashar2929 <[email protected]>
  • Loading branch information
vprashar2929 committed Aug 26, 2024
1 parent e847847 commit 9e9f307
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions ansible/mock_acpi_playbook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,22 @@
('success' not in prometheus_metrics.stdout) or
('"result": []' in prometheus_metrics.stdout)
- name: Run mock-acpi validator
shell: |
cd {{ validator_dir }}
hatch run validator -f ./validator.mock-acpi.yaml validate-acpi -d 1m
when: prometheus_metrics is success
register: mock_acpi_validator
failed_when: |
('error' in mock_acpi_validator.stdout.lower()) or
('mse exceeded' in mock_acpi_validator.stdout.lower()) or
('mape exceeded' in mock_acpi_validator.stderr.lower())
- block:
- name: Run mock-acpi validator
shell: |
cd {{ validator_dir }}
hatch run validator -f ./validator.mock-acpi.yaml validate-acpi -d 1m
when: prometheus_metrics is success
register: mock_acpi_validator
always:
- name: Output the results of validator
debug:
var: mock_acpi_validator

- name: Check for errors in validator
fail:
msgg: "Mock-ACPI validator failed with the following errors: {{ mock_acpi_validator.stdout }} {{ mock_acpi_validator.stderr }}"
when: >
('error' in mock_acpi_validator.stdout.lower()) or
('mse exceeded' in mock_acpi_validator.stdout.lower()) or
('mape exceeded' in mock_acpi_validator.stderr.lower())

0 comments on commit 9e9f307

Please sign in to comment.