Commit graph

4 commits

Author SHA1 Message Date
Alexander Todorov
85ce42570d Refactor how the 'trap' command is used to avoid double calls
in many files there was a secondary call to `trap` for the sole purpose
of killing jornalctl (watching worker logs) so that GitLab CI doesn't
hang.

The issue with this is that sometimes the cleared the trap which invokes
the cleanup() function without reinstating it again (not everywhere).

Instead of doing this back-and-forth just make sure we don't leave any
journalctl processes dangling in the background!

NOTES:

- for some scripts, mainly ostree- ones there was no cleanup trap
  present, but instead `trap` was configured inside the build_image() function.
  The trouble is that this function is executed multiple times and
  $WORKER_JOURNAL_PID changes value between these multiple executions.
  That's why these scripts introduce the cleanup_on_exit() function where
  we make sure to kill any possible dangling journalctl processes.
- The name `cleanup_on_exit()` is chosed because these same scripts
  often have a helper function named clean_up() which is sometimes used to remove
  virtual machines and other artifacts between calls of build_image().
2024-04-19 13:16:11 +03:00
Alexander Todorov
8f28da5214 Check for unbound variables in cleanup() 2024-03-04 12:49:56 +01:00
Alexander Todorov
e4b514ca3a Don't trap the EXIT signal twice
killing the worker journal via EXIT signal prevents the cleanup()
function from executing!

NOTE: this is a problem in other scripts as well and needs to be
refactored there too!
2024-03-04 12:49:56 +01:00
Alexander Todorov
97c0c21513 Test images in OpenShift Virtualization 2024-03-04 12:49:56 +01:00