ISISComputingGroup / IBEX

Top level repository for IBEX stories
5 stars 2 forks source link

repo_checks: add more details to message posted #8034

Closed FreddieAkeroyd closed 11 months ago

FreddieAkeroyd commented 1 year ago

The Jenkins repo checks job checks for various issues in our repository and then posts a message to teams. Currently it just says the build has failed, but it looks like the message is customisable and various "facts" can be added see "Pipeline post section" in https://plugins.jenkins.io/Office-365-Connector/#plugin-content-pipeline-post-section

acceptance criteria

better message e.g. which submodule if submodule problem, if it is an EOL issue etc

FreddieAkeroyd commented 11 months ago

@will2201 Thank you for the work. I created a separate jenkins job EPICS_repo_checks_test to run the new branch, and also merged current master (that passes all tests with old scripts) into this branch. There are a few errors reported that are not quite correct:

It mentions pycache / pyc errors, but these are in the check_scripts directory itself. They are not checked into git, but the act of running the tests creates them. You either need to exclude this directory from the checks, or use export PYTHONDONTWRITEBYTECODE=1 so it doesn't create these cache files.

there is a failed to open ../ioc/master/FINS/FINS-IOC-01App/Db/larmor-air.substitutions but the file looks to exist?

there is an ERROR: Submodule version not pushed but no module name is printed so I guess the check didn't find any but for some reason thinks this is a failure?

Some files like heliox.dbd, ISISDAE_01_positions.req fail the EOL test. These files are actually empty (size 0) which were ignored by the previous program, though i think it would be better to just print a warning for size 0 files and not fail the test

IOC naming format incorrect: ../ioc/master/RUNCTRL/RUNCTRL_01App, IOC naming format incorrect: ../ioc/master/SAMPOS/SAMPOSApp - this is a correct problem to report, but are like this for historical reasons and so shouldn't fail the test. Could an exception be added for just these?

will2201 commented 11 months ago

@FreddieAkeroyd Thank you for reviewing this. I believe I have now fixed all of these issues except:

there is a failed to open ../ioc/master/FINS/FINS-IOC-01App/Db/larmor-air.substitutions but the file looks to exist?

I am not able to reproduce the 'failed to open' error for the 3 files that Jenkins can't open on my machine. ( '../ioc/master/FINS/FINS-IOC-01App/Db/larmor-air.substitutions', '../support/asyn/master/documentation/RELEASE_NOTES.html', '../support/motor/master/docs/RELEASE.txt' ) Unsure how to get these opening, they don't appear to be in unsupported formats - can open them in VSCode/Notepad and view their content fine.

FreddieAkeroyd commented 11 months ago

Printing out the exception details may give some clues, it always seems to be the same files so doesn't feel like antivirus. All i can suggest pre exception details is to add encoding="utf-8" to the open() command. Note that this may not necessarily be a file open issue, your try/except has both the open() and read() within it so it could actually be the read() that is failing, which adding encoding might help with

will2201 commented 11 months ago

Exception was on file reading - non UTF-8 characters were throwing exceptions in these files. Have pushed a fix for this now and the jenkins test build is passing.

FreddieAkeroyd commented 11 months ago

looks good - we may want to investigate why we have a few files with strange characters later, but they don't seem to be causing any issues on Windows so may just be a linux issue. It might be the file is utf16 or some other windows encoding.