This is an automated email from the ASF dual-hosted git repository.

mapohl pushed a commit to branch release-1.18
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.18 by this push:
     new d40ddc38cac [FLINK-33906][ci] Makes debug_files_utils.sh agnostic to 
the CI backend
d40ddc38cac is described below

commit d40ddc38caca4549f8b67f813b8b7d6fd038a193
Author: Matthias Pohl <[email protected]>
AuthorDate: Wed Jan 10 11:44:34 2024 +0100

    [FLINK-33906][ci] Makes debug_files_utils.sh agnostic to the CI backend
---
 tools/azure-pipelines/debug_files_utils.sh | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/tools/azure-pipelines/debug_files_utils.sh 
b/tools/azure-pipelines/debug_files_utils.sh
index 35c51724158..6b74912e9fe 100755
--- a/tools/azure-pipelines/debug_files_utils.sh
+++ b/tools/azure-pipelines/debug_files_utils.sh
@@ -29,7 +29,29 @@ function prepare_debug_files {
 
        export DEBUG_FILES_OUTPUT_DIR="${parent_directory}/debug_files"
        export DEBUG_FILES_NAME="$(echo "${module}" | tr -c '[:alnum:]\n\r' 
'_')-$(date +%s)"
-       echo "##vso[task.setvariable 
variable=DEBUG_FILES_OUTPUT_DIR]$DEBUG_FILES_OUTPUT_DIR"
-       echo "##vso[task.setvariable 
variable=DEBUG_FILES_NAME]$DEBUG_FILES_NAME"
+
+  if [ -n "${TF_BUILD+x}" ]; then
+    echo "[INFO] Azure Pipelines environment detected: $0 will export the 
variables in the Azure-specific way."
+
+    echo "##vso[task.setvariable 
variable=DEBUG_FILES_OUTPUT_DIR]$DEBUG_FILES_OUTPUT_DIR"
+    echo "##vso[task.setvariable variable=DEBUG_FILES_NAME]$DEBUG_FILES_NAME"
+  elif [ -n "${GITHUB_ACTIONS+x}" ]; then
+    echo "[INFO] GitHub Actions environment detected: $0 will export the 
variables in the GHA-specific way."
+
+    if [ -z "${GITHUB_OUTPUT+x}" ]; then
+      echo "[ERROR] The GITHUB_OUTPUT variable is not set."
+      exit 1
+    elif [ ! -f "$GITHUB_OUTPUT" ]; then
+      echo "[ERROR] The GITHUB_OUTPUT variable doesn't refer to a file: 
$GITHUB_OUTPUT"
+      exit 1
+    fi
+
+    echo "debug-files-output-dir=${DEBUG_FILES_OUTPUT_DIR}" >> "$GITHUB_OUTPUT"
+    echo "debug-files-name=${DEBUG_FILES_NAME}" >> "$GITHUB_OUTPUT"
+  else
+    echo "[ERROR] No CI environment detected. Debug artifact-related variables 
couldn't be exported."
+    exit 1
+  fi
+
        mkdir -p $DEBUG_FILES_OUTPUT_DIR || { echo "FAILURE: cannot create 
debug files directory '${DEBUG_FILES_OUTPUT_DIR}'." ; exit 1; }
 }

Reply via email to