Skip to content

Extract file writer module to write to output files

David Dieulivol requested to merge ddieulivol-extract_file_writer_behavior into master

Context

One of the many prerequisites of #390346 (closed).

In the detect-tests CI job, we have many shell scripts that are writing to output files.

Some scripts are overwriting the output file, and some are appending to the output.

Some scripts assume that the file needs to be there beforehand, and others don't.

What does this MR do and why?

This MR adds a file_handler.rb helper with two methods:

  1. A read_array_from_file method to have a standard way to read from input files (e.g. create the file if doesn't exist, and read data)
  2. A write_array_to_file method to have a standard way to write to output files for all the scripts we call in the detect-tests job.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by David Dieulivol

Merge request reports

Loading