Redirecting to `/dev/stderr` or `/dev/stdout` can have a normally
unintended side-effect when the caller wishes to send either of those
elsewhere (like an actual file). Namely, it will truncate the file
before writing. This is almost never the expected behavior. Update all
redirects to magic devices to append instead.
N/B: These scripts are used far and wide. On the off-chance some
downstream caller has previously depended on this side-effect, I'm
marking this commit as 'breaking' accordingly.
Signed-off-by: Chris Evich <cevich@redhat.com>
This function is otherwise duplicated in both buildah and podman CI,
along with it's associated env. vars. Provide it here to help limit
duplication and cover it with testing.
Signed-off-by: Chris Evich <cevich@redhat.com>
This is esp. used during CI VM image builds where only a user account is
available for some stages. It's important to block `sudo apt-get` calls
from asking for user input during update/install.
Signed-off-by: Chris Evich <cevich@redhat.com>
It was an unfortunate mistake to name this variable as such. It was
observed to collide with other non-conforming usages in downstream.
This was esp. leading to some difficult to debug situations, such as
https://github.com/containers/podman/issues/13932 The common
automation library is used far/wide by many environments, which
unfortunately may also rely on a generic `$DEBUG`. Fix the issue here,
by renaming the variable.
Let this serve as a warning to all downstream, everywhere: ***Avoid all
use of similar generic variable names, make them context-specific!***
Signed-off-by: Chris Evich <cevich@redhat.com>
Previously due to practical reasons, the unit-tests did a very poor
jobs checking the code-context information shown by functions like
`die()`. Prior to this commit, the stack-level used was too great,
resulting in unhelpful output such as:
`ERROR: blah blah blah (<stdin>:0 in ())`
Fix the stack-level and context output. Add a helper-script
and new unit-test to confirm it does not break again in the future.
Signed-off-by: Chris Evich <cevich@redhat.com>
One internal, and several external users of this library don't bother
sourcing individual `common/lib/*.sh` files. Instead they iterate
over all of them by name, which is messy and inconvenient. Add a
short-cut script which callers can source to load all common libraries.
Signed-off-by: Chris Evich <cevich@redhat.com>
For some input line values, escape-characters were being eaten. Fix this by
not interpreting the input line in any way, simply prefix each line with
spaces.
Signed-off-by: Chris Evich <cevich@redhat.com>
Some users of the common library are not operating under a github
actions environment. To support installation under a github actions
environment while retaining that characteristic, new installer behavior
is required to allow subdirectory installers to modify the environment
file before "installation finished" (version file) is put in place.
Add a github action common lib installer which adds it's installation
directory into the system-wide environment file.
Update cirrus-ci_retrospective to utilize the new github action common
lib for some operations.
Update unit-tests.
Fix bug installing system-wide environment in Ubuntu vs Fedora
Signed-off-by: Chris Evich <cevich@redhat.com>
Did not add unit tests for these, since they would be quite complex.
Both functions were manually tested.
Also, added use of `realpath` in a few places to prevent changing
direcories from breaking debugging messages.
Signed-off-by: Chris Evich <cevich@redhat.com>