From 7c3b2cbf06329e37cf6d3c7ab71d20db098a0ac7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Riette?= <sebastien.riette@meteo.fr>
Date: Wed, 20 Dec 2023 17:53:50 +0100
Subject: [PATCH] S. Riette 20 Dec 2023: host name choice for github status

---
 tools/testing.sh | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/testing.sh b/tools/testing.sh
index 92c4ccf52..4fb3e0805 100755
--- a/tools/testing.sh
+++ b/tools/testing.sh
@@ -7,7 +7,8 @@ set -o pipefail #abort if left command on a pipe fails
 function usage {
   echo "Usage: $0 [-h] [--repo-user USER] [--repo-protocol PROTOCOL] [--repo-repo REPO] [--no-update] [--no-compil]"
   echo "               [--no-exec] [--no-comp] [--no-remove] [--force] [--commit SHA] [--ref REF]"
-  echo "               [--only-model MODEL] [--no-enable-gh-pages] [--perf PERF] [--no-doc-gen] [MAIL]"
+  echo "               [--only-model MODEL] [--no-enable-gh-pages] [--perf PERF] [--no-doc-gen]"
+  echo "               [--hostname HOSTNAME] [MAIL]"
   echo "--repo-user USER"
   echo "                user hosting the PHYEX repository on github,"
   echo "                defaults to the env variable PHYEXREPOuser (=$PHYEXREPOuser)"
@@ -30,6 +31,9 @@ function usage {
   echo "                dont't try to enable the project pages on github"
   echo "--perf FILE     add performance statistics in file FILE"
   echo "--no-doc-gen    do not test the documentation generation"
+  echo "--hostname HOSTNAME"
+  echo "                the context is built using the provided hostname instead of the real hostname"
+  echo "                This can be usefull when running on a cluster node which can vary from run to run"
   echo "MAIL            comma-separated list of e-mail addresses (no spaces); if not provided, mail is not sent"
   echo ""
   echo "This script provides functionality for automated tests."
@@ -67,6 +71,7 @@ models=""
 enableghpages=1
 perfopt=""
 docgen=1
+contextHostname=${HOSTNAME}
 
 allargs="$@"
 while [ -n "$1" ]; do
@@ -87,6 +92,7 @@ while [ -n "$1" ]; do
     '--no-enable-gh-pages') enableghpages=0;;
     '--perf') perfopt="--perf $2"; shift;;
     '--no-doc-gen') docgen=0;;
+    '--hostname') contextHostname=$2; shift;;
     #--) shift; break ;;
      *) if [ -z "${MAIL-}" ]; then
           MAIL="$1"
@@ -109,7 +115,7 @@ fi
 exec > "${logfile}" 2>&1
 
 #context for statuses
-context="continuous-integration/${HOSTNAME}"
+context="continuous-integration/${contextHostname}"
 
 #Interactions with github
 if [ "${PHYEXREPOprotocol}" == 'ssh' ]; then
-- 
GitLab