From 981f95df55bba706772a55146c3a74a53fe6c7e2 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Wed, 13 Mar 2024 14:53:53 -0300 Subject: [PATCH] tests: fix nounset error with $GITHUB_ENV Initialize $GITHUB_ENV to avoid nounset error when running the scripts locally out of Github Actions. Fixed commit 9ba5e3d2a8aeab8d1d868a1b6f8f1b2836cbfd0a Fixes #9217 Signed-off-by: Wainer dos Santos Moschetta --- tests/integration/kubernetes/gha-run.sh | 2 +- tests/integration/nerdctl/gha-run.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/kubernetes/gha-run.sh b/tests/integration/kubernetes/gha-run.sh index e91bf7b20cb1..5d2afbb34e72 100755 --- a/tests/integration/kubernetes/gha-run.sh +++ b/tests/integration/kubernetes/gha-run.sh @@ -213,7 +213,7 @@ function run_tests() { # 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 + if [ -n "${GITHUB_ENV:-}" ]; then start_time=$(date '+%Y-%m-%d %H:%M:%S') export start_time echo "start_time=${start_time}" >> "$GITHUB_ENV" diff --git a/tests/integration/nerdctl/gha-run.sh b/tests/integration/nerdctl/gha-run.sh index e762b760d39f..7b3c42a36148 100644 --- a/tests/integration/nerdctl/gha-run.sh +++ b/tests/integration/nerdctl/gha-run.sh @@ -95,7 +95,7 @@ function run() { enabling_hypervisor - if [ -n "$GITHUB_ENV" ]; then + if [ -n "${GITHUB_ENV:-}" ]; then start_time=$(date '+%Y-%m-%d %H:%M:%S') export start_time echo "start_time=${start_time}" >> "$GITHUB_ENV"