Skip to content

Commit fe756e1

Browse files
Merge branch 'develop' into feature/remove_waveGRD
2 parents d8a908b + e5d857b commit fe756e1

File tree

2 files changed

+44
-16
lines changed

2 files changed

+44
-16
lines changed

ci/Jenkinsfile

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,14 @@ pipeline {
138138
}
139139
}
140140
try {
141-
sh(script: "${HOMEgfs}/ci/scripts/utils/publish_logs.py --file ${error_logs} --repo PR_BUILD_${env.CHANGE_ID}")
142-
gist_url=sh(script: "${HOMEgfs}/ci/scripts/utils/publish_logs.py --file ${error_logs} --gist PR_BUILD_${env.CHANGE_ID}", returnStdout: true).trim()
141+
sh(script: """
142+
source ${HOMEgfs}/workflow/gw_setup.sh
143+
${HOMEgfs}/ci/scripts/utils/publish_logs.py --file ${error_logs} --repo PR_BUILD_${env.CHANGE_ID}
144+
""")
145+
gist_url=sh(script: """
146+
source ${HOMEgfs}/workflow/gw_setup.sh
147+
${HOMEgfs}/ci/scripts/utils/publish_logs.py --file ${error_logs} --gist PR_BUILD_${env.CHANGE_ID}
148+
""", returnStdout: true).trim()
143149
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "Build **FAILED** on **${Machine}** in Build# ${env.BUILD_NUMBER} with error logs:\n\\`\\`\\`\n${error_logs_message}\\`\\`\\`\n\nFollow link here to view the contents of the above file(s): [(link)](${gist_url})" """)
144150
} catch (Exception error_comment) {
145151
echo "Failed to comment on PR: ${error_comment.getMessage()}"
@@ -158,7 +164,10 @@ pipeline {
158164
}
159165
}
160166
// Get a list of CI cases to run
161-
CI_CASES = sh(script: "${HOMEgfs}/ci/scripts/utils/get_host_case_list.py ${machine}", returnStdout: true).trim().split()
167+
CI_CASES = sh(script: """
168+
source ${HOMEgfs}/workflow/gw_setup.sh
169+
${HOMEgfs}/ci/scripts/utils/get_host_case_list.py ${machine}
170+
""", returnStdout: true).trim().split()
162171
echo "Cases to run: ${CI_CASES}"
163172
}
164173
}
@@ -179,7 +188,10 @@ pipeline {
179188
script {
180189
env.RUNTESTS = "${CUSTOM_WORKSPACE}/RUNTESTS"
181190
try {
182-
error_output = sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${caseName}.yaml", returnStdout: true).trim()
191+
error_output = sh(script: """
192+
source ${HOMEgfs}/workflow/gw_setup.sh
193+
${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${caseName}.yaml
194+
""", returnStdout: true).trim()
183195
} catch (Exception error_create) {
184196
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "${Case} **FAILED** to create experiment on ${Machine} in BUILD# ${env.BUILD_NUMBER}\n with the error:\n\\`\\`\\`\n${error_output}\\`\\`\\`" """)
185197
error("Case ${caseName} failed to create experiment directory")
@@ -194,10 +206,19 @@ pipeline {
194206
def error_file = "${CUSTOM_WORKSPACE}/RUNTESTS/${pslot}_error.logs"
195207
sh(script: " rm -f ${error_file}")
196208
try {
197-
sh(script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${CUSTOM_WORKSPACE} ${pslot} 'global-workflow'")
198-
sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh cleanup_experiment ${CUSTOM_WORKSPACE}/RUNTESTS/EXPDIR/${pslot}")
209+
sh(script: """
210+
source ${HOMEgfs}/workflow/gw_setup.sh
211+
${HOMEgfs}/ci/scripts/run-check_ci.sh ${CUSTOM_WORKSPACE} ${pslot} 'global-workflow'
212+
""")
213+
sh(script: """
214+
source ${HOMEgfs}/workflow/gw_setup.sh
215+
${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh cleanup_experiment ${CUSTOM_WORKSPACE}/RUNTESTS/EXPDIR/${pslot}
216+
""")
199217
} catch (Exception error_experment) {
200-
sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh cancel_batch_jobs ${pslot}")
218+
sh(script: """
219+
source ${HOMEgfs}/workflow/gw_setup.sh
220+
${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh cancel_batch_jobs ${pslot}
221+
""")
201222
ws(CUSTOM_WORKSPACE) {
202223
def error_logs = ""
203224
def error_logs_message = ""
@@ -217,9 +238,15 @@ pipeline {
217238
}
218239
}
219240
try {
220-
gist_url = sh(script: "${HOMEgfs}/ci/scripts/utils/publish_logs.py --file ${error_logs} --gist PR_${env.CHANGE_ID}", returnStdout: true).trim()
241+
gist_url = sh(script: """
242+
source ${HOMEgfs}/workflow/gw_setup.sh
243+
${HOMEgfs}/ci/scripts/utils/publish_logs.py --file ${error_logs} --gist PR_${env.CHANGE_ID}
244+
""", returnStdout: true).trim()
221245
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "Experiment ${caseName} **FAILED** on ${Machine} in Build# ${env.BUILD_NUMBER} with error logs:\n\\`\\`\\`\n${error_logs_message}\\`\\`\\`\n\nFollow link here to view the contents of the above file(s): [(link)](${gist_url})" """)
222-
sh(script: "${HOMEgfs}/ci/scripts/utils/publish_logs.py --file ${error_logs} --repo PR_${env.CHANGE_ID}")
246+
sh(script: """
247+
source ${HOMEgfs}/workflow/gw_setup.sh
248+
${HOMEgfs}/ci/scripts/utils/publish_logs.py --file ${error_logs} --repo PR_${env.CHANGE_ID}
249+
""")
223250
} catch (Exception error_comment) {
224251
echo "Failed to comment on PR: ${error_comment.getMessage()}"
225252
}

ci/scripts/utils/launch_java_agent.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ controller_url="https://jenkins.epic.oarcloud.noaa.gov"
6565
controller_user=${controller_user:-"terry.mcguinness"}
6666
controller_user_auth_token="jenkins_token"
6767

68-
HOMEgfs="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." >/dev/null 2>&1 && pwd )"
68+
HOMEGFS_="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." >/dev/null 2>&1 && pwd )"
6969
host=$(hostname)
7070

7171
#########################################################################
7272
# Set up runtime environment varibles for accounts on supproted machines
7373
#########################################################################
7474

75-
source "${HOMEgfs}/ush/detect_machine.sh"
75+
source "${HOMEGFS_}/ush/detect_machine.sh"
7676
case ${MACHINE_ID} in
7777
hera | orion | hercules | wcoss2 | gaea)
7878
echo "Launch Jenkins Java Controler on ${MACHINE_ID}";;
@@ -84,10 +84,10 @@ esac
8484
LOG=lanuched_agent-$(date +%Y%m%d%M).log
8585
rm -f "${LOG}"
8686

87-
source "${HOMEgfs}/ush/module-setup.sh"
88-
module use "${HOMEgfs}/modulefiles"
87+
source "${HOMEGFS_}/ush/module-setup.sh"
88+
module use "${HOMEGFS_}/modulefiles"
8989
module load "module_gwsetup.${MACHINE_ID}"
90-
source "${HOMEgfs}/ci/platforms/config.${MACHINE_ID}"
90+
source "${HOMEGFS_}/ci/platforms/config.${MACHINE_ID}"
9191

9292
JAVA_HOME="${JENKINS_AGENT_LANUCH_DIR}/JAVA/jdk-17.0.10"
9393
if [[ ! -d "${JAVA_HOME}" ]]; then
@@ -102,9 +102,10 @@ JAVA="${JAVA_HOME}/bin/java"
102102
echo "JAVA VERSION: "
103103
${JAVA} -version
104104

105-
export GH="${HOME}/bin/gh"
106-
[[ -f "${GH}" ]] || echo "gh is not installed in ${HOME}/bin"
105+
GH=$(command -v gh || echo "${HOME}/bin/gh")
106+
[[ -f "${GH}" ]] || ( echo "ERROR: GitHub CLI (gh) not found. (exiting with error)"; exit 1 )
107107
${GH} --version
108+
export GH
108109

109110
check_mark=$("${GH}" auth status -t 2>&1 | grep "Token:" | awk '{print $1}') || true
110111
if [[ "${check_mark}" != "" ]]; then

0 commit comments

Comments
 (0)