CI: handle_artifacts,image_diff: various fixes for pipeline in charge of preserving build artifacts
This MR addresses the first problem articulated in following JIRA post: https://secogroup.atlassian.net/browse/YT-54?focusedCommentId=45947 and problems from https://secogroup.atlassian.net/browse/YT-55?focusedCommentId=45999
In particular, the MR contains following fixes:
- got rid of duplicated code and moved particular classes to dedicated header files;
- fixed a failure when a previously launched pipeline is canceled. Just added a 10 sec delay before proceeding further, if pipeline was canceled;
- added a try-except block to ignore exceptions produced by job.keep_artifacts()/job.delete_artifacts() when artifacts for old pipelines are automatically removed;
- got rid of hard coded values. Reworked the script to parse machine, pipeline names and distro from .gitlab-ci.yml;
- fixed timeout checking.
Edited by Dmitry Petrov