mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-19 09:51:29 +00:00
gha: export start_time to collect artifacts properly
The jobs running on garm will collect journal information. The data gathered is based on the time the tests started running. The $start_time is exported on run_tests() and used in collect_artifacts(). It happens that run_tests() and collect_artifacts() are called on different steps of the workflow and the environment variables aren't preserved between them, i.e, $start_time exported on the first step is not available on the subsequents. To solve that issue, let's save $start_time in the file pointed out by $GITHUB_ENV that Github actions uses to export variables. In case $GITHUB_ENV is empty then probably it is running locally outside of Github, so it won't save the start time value. Fixes #9217 Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
This commit is contained in:
parent
b761a80bd1
commit
9ba5e3d2a8
@ -209,7 +209,16 @@ function run_tests() {
|
||||
|
||||
pushd "${kubernetes_dir}"
|
||||
bash setup.sh
|
||||
export start_time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
# In case of running on Github workflow it needs to save the start time
|
||||
# on the environment variables file so that the variable is exported on
|
||||
# next workflow steps.
|
||||
if [ -n "$GITHUB_ENV" ]; then
|
||||
start_time=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
export start_time
|
||||
echo "start_time=${start_time}" >> "$GITHUB_ENV"
|
||||
fi
|
||||
|
||||
if [[ "${KATA_HYPERVISOR}" = "dragonball" ]] && [[ "${SNAPSHOTTER}" = "devmapper" ]] || [[ "${KATA_HYPERVISOR}" = "cloud-hypervisor" ]] && [[ "${SNAPSHOTTER}" = "devmapper" ]]; then
|
||||
# cloud-hypervisor runtime-rs issue is https://github.com/kata-containers/kata-containers/issues/9034
|
||||
echo "Skipping tests for $KATA_HYPERVISOR using devmapper"
|
||||
@ -220,6 +229,11 @@ function run_tests() {
|
||||
}
|
||||
|
||||
function collect_artifacts() {
|
||||
if [ -z "${start_time:-}" ]; then
|
||||
warn "tests start time is not defined. Cannot gather journal information"
|
||||
return
|
||||
fi
|
||||
|
||||
local artifacts_dir="/tmp/artifacts"
|
||||
if [ -d "${artifacts_dir}" ]; then
|
||||
rm -rf "${artifacts_dir}"
|
||||
|
Loading…
Reference in New Issue
Block a user