TF Compare: Change script to only pull in the last 2 workflow runs (including the one that is in progress) and continue writing up bug reports when all artifacts can't be downloaded #221
Labels
refactor
An improvement to existing test/module code
Description
Issue
Currently the TF script was changed to pull in the last 10 runs to ensure that a run with the status 'success' was picked up, however this is not always the case. If a workflow run has been successful, generated an artifact file but then failed on the TF compare script for whatever reason then we still want to use this run as in essence it was successful.
Proposed change
Only pull in the last 2 runs, we know if the run gets to the point where the TF compare script is running then it's safe to say it was a successful run.
The next change would be where the script downloads the artifact files, currently if one of the artifact files doesn't download, the script exits with an error because it can't then go an compare results. However, what we can do is still have the script search GitHub for existing bug reports for the fails from the artifact it managed to download from the current run.
Get workflow runs current code
Current code for pulling down the last 10 runs and filtering runs with a status if 'success' and 'in_progress'
Refactored code
This will only pull down the previous 2 runs regardless of status
Current code for getting each .json file from the artifact zip
This is fine if the artifact exists, if it doesn't, the script will crash out
Refactored code
Adding in a new line to check if the file actually exists eliminates the script from crashing and allows the script to continue
Conclusion
The script should never fall over, the only time it should exit and not complete is if an artifact in the current run hasn't been created, however, if that is the case, the TF compare script will never start to run in the first place because the workflow would have already failed before reaching the TF compare script.
If in the last 2 runs (current run included) have 2 valid artifact files, they will be downloaded and compared, if the previous run doesn't have an artifact file because maybe the run crashed then the script will continue to download the artifact file from the current run and report the fails as bug reports as usual.
Script Name
tf_compare.py
Steps To The Task
The text was updated successfully, but these errors were encountered: