Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CI cron jobs #1476

Merged
Show file tree
Hide file tree
Changes from 123 commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
a2faebc
disambiguated env vars for HOMEgfs and GFS_CI_ROOT and removed re-ass…
TerryMcGuinness-NOAA Mar 28, 2023
37b0c15
debugged updates to scripts (typos ect)
TerryMcGuinness-NOAA Mar 28, 2023
37cfedb
Update create_experiment.py
TerrenceMcGuinness-NOAA Mar 28, 2023
349a383
Update driver.sh
TerrenceMcGuinness-NOAA Mar 28, 2023
f111c47
Update clone-build_ci.sh
TerrenceMcGuinness-NOAA Mar 28, 2023
619bdce
added another layer in file structure for experments where each exper…
TerryMcGuinness-NOAA Mar 28, 2023
28a509b
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Mar 29, 2023
efd04aa
fixed bugs with tree restructure under ../PR/{PR#}/RUNTESTS
TerryMcGuinness-NOAA Mar 29, 2023
b7df0e7
spelling errors in create experiment
TerryMcGuinness-NOAA Mar 29, 2023
e2c211d
added run_ci.sh that is used in cron to run expirments
TerryMcGuinness-NOAA Mar 29, 2023
07c81e7
removed --login from shabang in bash scripts
TerryMcGuinness-NOAA Mar 30, 2023
7cca618
added environment for orion
Mar 30, 2023
b0fcb3d
fixed bug with needing updated git from module load on orion
Mar 30, 2023
801bbf3
added correct ICDIR to orion and module load module_ci for uniformall…
TerryMcGuinness-NOAA Mar 31, 2023
e76d66a
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Mar 31, 2023
def8455
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Apr 4, 2023
b067ed6
added old python compair GFS folders for development
TerryMcGuinness-NOAA Apr 4, 2023
7343b27
added Execute class for nccnp to comparitor
TerryMcGuinness-NOAA Apr 5, 2023
393d570
udpate logging level and fixed spelling errors
TerryMcGuinness-NOAA Apr 5, 2023
c2cb34d
added not none over len 0 for support Null return on Execute on nccmp
TerryMcGuinness-NOAA Apr 5, 2023
b7e51db
cleaned up and and made outout human readable for the comaritor code
TerryMcGuinness-NOAA Apr 5, 2023
96d8498
update GitHub labels to all start with CI
TerryMcGuinness-NOAA Apr 6, 2023
b905ef3
format output dropped f and added nccmp to orion env modufile
TerryMcGuinness-NOAA Apr 6, 2023
4abb87f
added grib file checker with corrlation checks in compare folders script
TerryMcGuinness-NOAA Apr 7, 2023
1d75a06
got wgrib2 checker to work
TerryMcGuinness-NOAA Apr 7, 2023
2eee604
added wgrib2 to ci module file for Hera
TerryMcGuinness-NOAA Apr 7, 2023
72a4bfd
had to add hpc 1.1.0 to module file to get wgrib2
TerryMcGuinness-NOAA Apr 7, 2023
a3324a6
fixed module load order for virtutal python environment
TerryMcGuinness-NOAA Apr 7, 2023
88a9185
started code cleanup, removed job switches for storing a yaml file of…
TerryMcGuinness-NOAA Apr 10, 2023
4fa9e3a
removed import collections
TerryMcGuinness-NOAA Apr 10, 2023
888a400
test git edit
TerrenceMcGuinness-NOAA Apr 10, 2023
3ecca64
pcode edits
TerrenceMcGuinness-NOAA Apr 10, 2023
3882cac
more pycode edits
TerrenceMcGuinness-NOAA Apr 10, 2023
227dad8
more pycode edits
TerrenceMcGuinness-NOAA Apr 10, 2023
a26d4af
more pycode edits
TerrenceMcGuinness-NOAA Apr 10, 2023
5f3535f
more pycode edits
TerrenceMcGuinness-NOAA Apr 10, 2023
bf3f5cc
more pycode edits
TerrenceMcGuinness-NOAA Apr 10, 2023
2f9b0a5
few more pycode edits
TerrenceMcGuinness-NOAA Apr 10, 2023
2f72f48
pycode edits
TerrenceMcGuinness-NOAA Apr 10, 2023
dd81b6e
two more pycode edits
TerrenceMcGuinness-NOAA Apr 10, 2023
2773f09
bash lint edit
TerrenceMcGuinness-NOAA Apr 10, 2023
44226f2
fixed some formatting issues from pycode updates
TerryMcGuinness-NOAA Apr 10, 2023
e127ed2
some more cleaning up format
TerryMcGuinness-NOAA Apr 10, 2023
ce362ea
moved module load in driver
TerryMcGuinness-NOAA Apr 11, 2023
eb7471b
added ignore list for wild cards
TerryMcGuinness-NOAA Apr 11, 2023
ec71918
removed module load in driver and added rm pr_list at the end if used…
TerryMcGuinness-NOAA Apr 11, 2023
1bc444f
fix syntax error with echo at end of clone-build
TerryMcGuinness-NOAA Apr 12, 2023
2ee5051
need to remove set -e from driver and build scripts to that CI system…
TerryMcGuinness-NOAA Apr 12, 2023
522aa27
added checks and output results for checkout in clone-build script
TerryMcGuinness-NOAA Apr 12, 2023
59c3226
moved message sent to GitHub on the status of each PR on pass or fail…
TerryMcGuinness-NOAA Apr 12, 2023
06f902e
added two seperate module loads for workflow and CI, fixed some messa…
TerryMcGuinness-NOAA Apr 12, 2023
aadb132
added gwci and gwsetup module files for orion
TerryMcGuinness-NOAA Apr 12, 2023
909a31b
update machine gwsetup module load in run_ci script
TerryMcGuinness-NOAA Apr 12, 2023
cb0ed72
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Apr 14, 2023
7333130
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Apr 17, 2023
adf6809
udpated gwci on orion for threaded version of nccmp, updated reportin…
TerryMcGuinness-NOAA Apr 17, 2023
1da08ab
Merge branch 'feature_1428_CI-cronjobs' of github.com:TerrenceMcGuinn…
TerryMcGuinness-NOAA Apr 17, 2023
8486d1d
cleaned up path reporting in compare folders and fixed dependacies in…
TerryMcGuinness-NOAA Apr 17, 2023
0a83799
updated verbose output and added ignore list in file count conformity…
TerryMcGuinness-NOAA Apr 17, 2023
8698f71
few pythoncode lint updates
TerryMcGuinness-NOAA Apr 17, 2023
ee50f86
more pycode linting (spaces and commas)
TerryMcGuinness-NOAA Apr 17, 2023
b0ad92c
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Apr 17, 2023
535721f
added || exit on cd (change directory) in clone-build BASH script
TerryMcGuinness-NOAA Apr 17, 2023
aae6072
Merge branch 'feature_1428_CI-cronjobs' of github.com:TerrenceMcGuinn…
TerryMcGuinness-NOAA Apr 17, 2023
2fc7b44
indentation for visual effect PIP8
TerryMcGuinness-NOAA Apr 17, 2023
126d435
indentation for visual effect PIP8 E127, again
TerryMcGuinness-NOAA Apr 17, 2023
74415b3
PIP8 E127 wanted alignment after continuation line to be a regular in…
TerryMcGuinness-NOAA Apr 17, 2023
a71a916
PEP8 black line had spaces
TerryMcGuinness-NOAA Apr 17, 2023
a3f05bb
type spelling error of directories
TerryMcGuinness-NOAA Apr 17, 2023
6d421e4
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Apr 18, 2023
c0287ba
Update ci/scripts/clone-build_ci.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
8009fb2
Update ci/scripts/run_ci.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
94f8c8a
Update ci/experiments/C96_atm3DVar.yaml
TerrenceMcGuinness-NOAA Apr 18, 2023
e6ffad4
Update ci/scripts/clone-build_ci.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
5080370
Update ci/scripts/run_ci.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
0b8f38d
Apply suggestions from code review
TerrenceMcGuinness-NOAA Apr 18, 2023
3e4e921
Update ci/scripts/clone-build_ci.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
22a9073
Update ci/scripts/driver.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
8f04d79
Update ci/scripts/run_ci.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
6889ee9
Update ci/scripts/run_ci.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
856bb2b
Update ci/scripts/run_ci.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
bb34e9c
added module-setup.sh in place of module purge
TerryMcGuinness-NOAA Apr 18, 2023
f990c9c
couple more suggestions, fix build_status off of link and more build …
TerryMcGuinness-NOAA Apr 18, 2023
86d6104
just moved an export to where it is more approprate
TerryMcGuinness-NOAA Apr 18, 2023
530882a
improved symantics by replacing environments with platform and experm…
TerryMcGuinness-NOAA Apr 18, 2023
969877b
Update diff_grib_files.py
TerrenceMcGuinness-NOAA Apr 18, 2023
dffadd3
Delete C96_atm3DVar_also.yaml
TerrenceMcGuinness-NOAA Apr 18, 2023
aa21ef7
added second case C96C48-hyb-ATM-DA
TerryMcGuinness-NOAA Apr 18, 2023
e68fa99
Update run_ci.sh
TerrenceMcGuinness-NOAA Apr 18, 2023
51a55d4
fixed fail logic in driver for setupexpt and bug with path in yaml fo…
TerryMcGuinness-NOAA Apr 19, 2023
5818dcb
Merge branch 'feature_1428_CI-cronjobs' of github.com:TerrenceMcGuinn…
TerryMcGuinness-NOAA Apr 19, 2023
1f27cd9
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Apr 19, 2023
e9036cf
fixed updated path to EXPDIR for staged test cases in run_ci script
TerryMcGuinness-NOAA Apr 19, 2023
c0ad448
Added additional script to check to see if experments have completed …
TerryMcGuinness-NOAA Apr 19, 2023
8afa313
added new label stage to include CI--Building before Running
TerryMcGuinness-NOAA Apr 19, 2023
5bec286
moved check for open PR after it is cloned
TerryMcGuinness-NOAA Apr 19, 2023
16a82f6
updated old repo_url varible name in check script
TerryMcGuinness-NOAA Apr 19, 2023
51700d4
added comment to GitHub when case completes
TerryMcGuinness-NOAA Apr 19, 2023
482fc31
added cool SHELLCHECK suggestiongs (amazing tool)
TerryMcGuinness-NOAA Apr 19, 2023
c1d677f
Merge branch 'feature_1428_CI-cronjobs' of github.com:TerrenceMcGuinn…
TerryMcGuinness-NOAA Apr 19, 2023
e850d6d
Update check_ci.sh
TerrenceMcGuinness-NOAA Apr 19, 2023
32396e7
Update check_ci.sh
TerrenceMcGuinness-NOAA Apr 19, 2023
54e9ebe
added a could of shellcheck suggestions for || true
TerryMcGuinness-NOAA Apr 19, 2023
3d0c07b
Merge branch 'feature_1428_CI-cronjobs' of github.com:TerrenceMcGuinn…
TerryMcGuinness-NOAA Apr 19, 2023
a51661c
Update module_gwci.orion.lua
TerrenceMcGuinness-NOAA Apr 19, 2023
9865a74
Update modulefiles/module_gwci.orion.lua
TerrenceMcGuinness-NOAA Apr 19, 2023
3404bff
Update modulefiles/module_gwci.orion.lua
TerrenceMcGuinness-NOAA Apr 19, 2023
3e7a9af
Update modulefiles/module_gwci.hera.lua
TerrenceMcGuinness-NOAA Apr 19, 2023
2d36572
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Apr 19, 2023
9851300
added set -e at top of BASH scripts and then only disabled it when we…
TerryMcGuinness-NOAA Apr 20, 2023
cdc57ce
fixed login of label update in check_ci script and added parallel ver…
TerryMcGuinness-NOAA Apr 20, 2023
07ddb49
improved login for success of PR with check_ci script
TerryMcGuinness-NOAA Apr 20, 2023
737483f
forgot to add removing of PR from list on successfully completing all…
TerryMcGuinness-NOAA Apr 20, 2023
8c6d13d
forgot to add removing of PR from list on successfully completing all…
TerryMcGuinness-NOAA Apr 20, 2023
a64d1ab
fixed bug with counting remaining cases
TerryMcGuinness-NOAA Apr 20, 2023
0423bb9
added || true to BASH command for shellnorms in check ci script
TerryMcGuinness-NOAA Apr 20, 2023
e6f4550
fixed race condition for check_ci script thinking success before expe…
TerryMcGuinness-NOAA Apr 20, 2023
daebe97
Upates to final success check with multiple cases in check_ci ie num_…
TerryMcGuinness-NOAA Apr 20, 2023
4b7a73a
Update check_ci.sh
TerrenceMcGuinness-NOAA Apr 20, 2023
458c5ea
Merge branch 'NOAA-EMC:develop' into feature_1428_CI-cronjobs
TerrenceMcGuinness-NOAA Apr 21, 2023
dc87c92
Update clone-build_ci.sh
TerrenceMcGuinness-NOAA Apr 21, 2023
0779ff6
couple of bug updates for check script when deleting successfull PRs,…
TerryMcGuinness-NOAA Apr 21, 2023
0140a17
Merge branch 'feature_1428_CI-cronjobs' of github.com:TerrenceMcGuinn…
TerryMcGuinness-NOAA Apr 21, 2023
ff73987
Update check_ci.sh
TerrenceMcGuinness-NOAA Apr 21, 2023
c183221
updated nccmp 1.8.7.0 and fixed a shellnorm typo to close quote
TerryMcGuinness-NOAA Apr 21, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ci/cases/C96C48_hybatmDA.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
experiment:
mode: cycled

arguments:
app: ATM
resdet: 96
resens: 48
comrot: ${RUNTESTS}/${pslot}/COMROT
expdir: ${RUNTESTS}/${pslot}/EXPDIR
icsdir: ${ICSDIR_ROOT}/C96C48
idate: 2021122018
edate: 2021122200
nens: 2
gfs_cyc: 1
start: cold
14 changes: 14 additions & 0 deletions ci/cases/C96_atm3DVar.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
experiment:
mode: cycled

arguments:
app: ATM
resdet: 96
comrot: ${RUNTESTS}/${pslot}/COMROT
expdir: ${RUNTESTS}/${pslot}/EXPDIR
icsdir: ${ICSDIR_ROOT}/C96C48
idate: 2021122018
edate: 2021122100
nens: 0
gfs_cyc: 1
start: cold
19 changes: 0 additions & 19 deletions ci/experiments/C96C48_hybatmDA.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions ci/experiments/C96C48_hybatmDA_also.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions ci/environments/hera.sh → ci/platforms/hera.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#!/usr/bin/bash
export GFS_CI_ROOT=/scratch1/NCEPDEV/global/Terry.McGuinness/GFS_CI_ROOT
export GFS_MODULE_USE="${GFS_CI_ROOT}/global-workflow/modulefiles"
export SLURM_ACCOUNT=fv3-cpu
export SALLOC_ACCOUNT="${SLURM_ACCOUNT}"
export SBATCH_ACCOUNT="${SLURM_ACCOUNT}"
export SLURM_QOS=debug
export repo_url="https://github.com/NOAA-EMC/global-workflow.git"
#export repo_url="https://github.com/TerrenceMcGuinness-NOAA/global-workflow.git"
export ICSDIR_ROOT="/scratch1/NCEPDEV/global/glopara/data/ICSDIR"
4 changes: 2 additions & 2 deletions ci/environments/orion.sh → ci/platforms/orion.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/bash

export GFS_CI_ROOT="TDB" #TODO
export GFS_MODULE_USE="${GFS_CI_ROOT}/global-workflow/modulefiles"
export GFS_CI_ROOT=/work2/noaa/global/mterry/GFS_CI_ROOT
export ICSDIR_ROOT=/work/noaa/global/glopara/data/ICSDIR
export SLURM_ACCOUNT=fv3-cpu
export SALLOC_ACCOUNT=${SLURM_ACCOUNT}
export SBATCH_ACCOUNT=${SLURM_ACCOUNT}
Expand Down
114 changes: 114 additions & 0 deletions ci/scripts/check_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
#!/bin/bash
set -eux
#####################################################################################
#
# Script description: BASH script for checking for cases in a given PR and
# running rocotostat on each to determine if the experiment has
# succeeded or faild. This script is intended
# to run from within a cron job in the CI Managers account
# Abstract TODO
#####################################################################################

HOMEgfs="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null 2>&1 && pwd )"
scriptname=$(basename "${BASH_SOURCE[0]}")
echo "Begin ${scriptname} at $(date -u)" || true
export PS4='+ $(basename ${BASH_SOURCE})[${LINENO}]'

GH=${HOME}/bin/gh
REPO_URL=${REPO_URL:-"https://github.com/NOAA-EMC/global-workflow.git"}

#########################################################################
# Set up runtime environment varibles for accounts on supproted machines
#########################################################################

source "${HOMEgfs}/ush/detect_machine.sh"
case ${MACHINE_ID} in
hera | orion)
echo "Running Automated Testing on ${MACHINE_ID}"
source "${HOMEgfs}/ci/platforms/${MACHINE_ID}.sh"
;;
*)
echo "Unsupported platform. Exiting with error."
exit 1
;;
esac
set +x
source "${HOMEgfs}/ush/module-setup.sh"
module use "${HOMEgfs}/modulefiles"
module load "module_gwsetup.${MACHINE_ID}"
module list
set -x
rocotostat=$(which rocotostat)
if [[ -z ${rocotostat+x} ]]; then
echo "rocotostat not found on system"
exit 1
else
echo "rocotostat being used from ${rocotostat}"
fi

pr_list_file="open_pr_list"

if [[ -s "${GFS_CI_ROOT}/${pr_list_file}" ]]; then
pr_list=$(cat "${GFS_CI_ROOT}/${pr_list_file}")
else
echo "no PRs to process .. exit"
exit 0
fi

#############################################################
# Loop throu all PRs in PR List and look for expirments in
# the RUNTESTS dir and for each one run runcotorun on them
#############################################################

for pr in ${pr_list}; do
id=$("${GH}" pr view "${pr}" --repo "${REPO_URL}" --json id --jq '.id')
echo "Processing Pull Request #${pr} and looking for cases"
pr_dir="${GFS_CI_ROOT}/PR/${pr}"

# If there is no RUNTESTS dir for this PR then cases have not been made yet
if [[ ! -d "${pr_dir}/RUNTESTS" ]]; then
continue
fi
num_cases=$(find "${pr_dir}/RUNTESTS" -mindepth 1 -maxdepth 1 -type d | wc -l) || true

#Check for PR success when ${pr_dir}/RUNTESTS is void of subfolders
# since all successfull ones where previously removed
if [[ "${num_cases}" -eq 0 ]] && [[ -d "${pr_dir}/RUNTESTS" ]]; then
"${GH}" pr edit --repo "${REPO_URL}" "${pr}" --remove-label "CI-${MACHINE_ID^}-Running" --add-label "CI-${MACHINE_ID^}-Passed"
sed -i "/${pr}/d" "${GFS_CI_ROOT}/${pr_list_file}"
# Completely remove the PR and its cloned repo on sucess of all cases
rm -Rf ${pr_dir}

Check notice

Code scanning / shellcheck

Double quote to prevent globbing and word splitting.

Double quote to prevent globbing and word splitting.
Fixed Show fixed Hide fixed
continue
fi

for cases in "${pr_dir}/RUNTESTS/"*; do
pslot=$(basename "${cases}")
xml="${pr_dir}/RUNTESTS/${pslot}/EXPDIR/${pslot}/${pslot}.xml"
db="${pr_dir}/RUNTESTS/${pslot}/EXPDIR/${pslot}/${pslot}.db"
rocoto_stat_output=$("${rocotostat}" -w "${xml}" -d "${db}" -s | grep -v CYCLE) || true
num_cycles=$(echo "${rocoto_stat_output}" | wc -l) || true
num_done=$(echo "${rocoto_stat_output}" | grep -c Done) || true
num_succeeded=$("${rocotostat}" -w "${xml}" -d "${db}" -a | grep -c SUCCEEDED) || true
echo "${pslot} Total Cycles: ${num_cycles} number done: ${num_done}" || true
num_failed=$("${rocotostat}" -w "${xml}" -d "${db}" -a | grep -c -E 'FAIL|DEAD') || true
if [[ ${num_failed} -ne 0 ]]; then
{
echo "Experiment ${pslot} Terminated: *FAILED*"
echo "Experiment ${pslot} Terminated with ${num_failed} tasks failed at $(date)" || true
} >> "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
"${GH}" pr edit --repo "${REPO_URL}" "${pr}" --remove-label "CI-${MACHINE_ID^}-Running" --add-label "CI-${MACHINE_ID^}-Failed"
"${GH}" pr comment "${pr}" --repo "${REPO_URL}" --body-file "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
sed -i "/${pr}/d" "${GFS_CI_ROOT}/${pr_list_file}"
fi
if [[ "${num_done}" -eq "${num_cycles}" ]]; then
{
echo "Experiment ${pslot} completed: *SUCCESS*"
echo "Experiment ${pslot} Completed at $(date)" || true
echo -n "with ${num_succeeded} successfully completed jobs" || true
} >> "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
"${GH}" pr comment "${pr}" --repo "${REPO_URL}" --body-file "${GFS_CI_ROOT}/PR/${pr}/output_${id}"
#Remove Experment cases that completed successfully
rm -Rf "${pr_dir}/RUNTESTS/${pslot}"
fi
done
done
89 changes: 51 additions & 38 deletions ci/scripts/clone-build_ci.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
#!/bin/bash
set -eux

#################################################################
# TODO using static build for GitHub CLI until fixed in HPC-Stack
#################################################################
GH=/home/Terry.McGuinness/bin/gh
repo_url=${repo_url:-"https://github.com/global-workflow.git"}
#####################################################################
# Usage and arguments for specfifying cloned directgory
#####################################################################
Expand Down Expand Up @@ -45,25 +40,14 @@ while getopts "p:d:o:h" opt; do
esac
done

####################################################################
# start output file
{
echo "Automated global-workflow Testing Results:"
echo "Machine: ${CI_HOST}"
echo '```'
echo "Start: $(date) on $(hostname)" || true
echo "---------------------------------------------------"
} >> "${outfile}"
######################################################################

cd "${repodir}"
cd "${repodir}" || exit 1
# clone copy of repo
if [[ -d global-workflow ]]; then
rm -Rf global-workflow
fi

git clone "${repo_url}"
cd global-workflow
git clone "${REPO_URL}"
cd global-workflow || exit 1

pr_state=$(gh pr view "${PR}" --json state --jq '.state')
if [[ "${pr_state}" != "OPEN" ]]; then
Expand All @@ -73,34 +57,63 @@ if [[ "${pr_state}" != "OPEN" ]]; then
fi

# checkout pull request
"${GH}" pr checkout "${PR}" --repo "${repo_url}"
"${GH}" pr checkout "${PR}" --repo "${REPO_URL}"
HOMEgfs="${PWD}"
source "${HOMEgfs}/ush/detect_machine.sh"

####################################################################
# start output file
{
echo "Automated global-workflow Testing Results:"
echo '```'
echo "Machine: ${MACHINE_ID^}"
echo "Start: $(date) on $(hostname)" || true
echo "---------------------------------------------------"
} >> "${outfile}"
######################################################################

# get commit hash
commit=$(git log --pretty=format:'%h' -n 1)
echo "${commit}" > "../commit"

# run build script
cd sorc
# run checkout script
cd sorc || exit 1
set +e
./checkout.sh -c -g -u &>> log.checkout
checkout_status=$?
if [[ ${checkout_status} != 0 ]]; then
{
echo "Checkout: *FAILED*"
echo "Checkout: Failed at $(date)" || true
echo "Checkout: see output at ${PWD}/log.checkout"
} >> "${outfile}"
exit "${checkout_status}"
else
{
echo "Checkout: *SUCCESS*"
echo "Checkout: Completed at $(date)" || true
} >> "${outfile}"
fi

# build full cycle
source "${HOMEgfs}/ush/module-setup.sh"
export BUILD_JOBS=8
rm -rf log.build
./checkout.sh -g -c
# build full cycle
./build_all.sh -g &>> log.build

# Validations
./build_all.sh &>> log.build
build_status=$?
if [[ ${build_status} -eq 0 ]]; then
{
echo "Build: *SUCCESS*"
echo "Build: Completed at $(date)" || true
} >> "${outfile}"

if [[ ${build_status} != 0 ]]; then
{
echo "Build: *FAILED*"
echo "Build: Failed at $(date)" || true
echo "Build: see output at ${PWD}/log.build"
} >> "${outfile}"
exit "${build_status}"
else
{
echo "Build: *FAILED*"
echo "Build: Failed at $(date)" || true
echo "Build: see output at ${PWD}/log.build"
}
echo '```' >> "${outfile}"
{
echo "Build: *SUCCESS*"
echo "Build: Completed at $(date)" || true
} >> "${outfile}"
fi

./link_workflow.sh
Expand Down
Loading