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

BASH GitHub CLI version of High Resolution cases used for CI weekly tests #1869

Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
670bc5c
added updated weekly case files to forked develop for testing when cl…
Sep 14, 2023
0e2ae14
updated idate to 2023040200 to match files staged in ICSDIRS for both…
Sep 15, 2023
c522a7f
Merge branch 'NOAA-EMC:develop' into develop
TerrenceMcGuinness-NOAA Sep 18, 2023
dcebf4e
Merge branch 'develop' of github.com:TerrenceMcGuinness-NOAA/global-w…
Sep 19, 2023
686f28f
added PyGithub version of weekly tests
Sep 19, 2023
fd3f0a5
added bash pr based weekly script
Sep 19, 2023
d8af13d
added bash version of pr based weekly tests
Sep 19, 2023
2e4d335
updated bash linting for variable quoting
Sep 19, 2023
82fda49
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
fd3370d
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
2069b4c
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
b877a8b
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
0aa77e1
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
b3011a5
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
bb20a41
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
7cb02e5
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
8c39b6a
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
faaa6a6
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
459ef70
added more comments so show only needs to run on a single machine and…
Sep 20, 2023
5bc7047
Update driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
f76d654
Update ci/scripts/driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 20, 2023
0fc9173
removed HOMEgfs_PR and full paths for readablity
Sep 20, 2023
c53b070
Merge branch 'feature/bash_weekly_pr_CI' of github.com:TerrenceMcGuin…
Sep 20, 2023
d306944
Update driver_weekly.sh
TerrenceMcGuinness-NOAA Sep 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
2 changes: 1 addition & 1 deletion ci/cases/weekly/C384C192_hybatmda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ arguments:
resens: 192
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
icsdir: /scratch1/NCEPDEV/stmp2/Rahul.Mahajan/ICSDIR/IC_C384
icsdir: ${ICSDIR_ROOT}/C384C192
idate: 2023040118
edate: 2023040200
nens: 2
Expand Down
5 changes: 3 additions & 2 deletions ci/cases/weekly/C384_atm3DVar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ experiment:
arguments:
pslot: ${pslot}
app: ATM
resdet: C384
resdet: 384
resens: 192
comrot: ${RUNTESTS}/COMROT
expdir: ${RUNTESTS}/EXPDIR
icsdir: /scratch1/NCEPDEV/stmp2/Rahul.Mahajan/ICSDIR/IC_C384
icsdir: ${ICSDIR_ROOT}/C384C192
idate: 2023040118
edate: 2023040200
nens: 0
Expand Down
103 changes: 103 additions & 0 deletions ci/scripts/driver_weekly.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
#!/bin/bash
set -eux

##############################################################################################
TerrenceMcGuinness-NOAA marked this conversation as resolved.
Show resolved Hide resolved
#
# Script description: Top level driver script for running
# weekly CI regression tests
#
# Abstract:
#
# This script runs the high resolution cases found in $HOMEgfs/ci/cases/weekly
# from the develop branch for the global-workflow repo that are intended to run on a weekly basis
# from a cron job. When run it will clone and build a new branch from the EMC's global-workflow and
# and create a pr using GitHub CLI by moving and replacing the yaml case files in
# ${HOMEgfs}/ci/cases/weekly to {HOMEgfs}/ci/cases/pr. Then the requisite labels are added
# so that the current BASH CI framework can then run these cases. Since this script
# creates a PR with the CI-Ready labels, the BASH CI framework will automatically run these cases
# from that point so it is only required to run this script once from a single machine.
##############################################################################################

#################################################################
# TODO using static build for GitHub CLI until fixed in HPC-Stack
#################################################################
export GH=${HOME}/bin/gh
export REPO_URL=${REPO_URL:-"https://github.com/NOAA-EMC/global-workflow.git"}

################################################################
# Setup the relative paths to scripts and PS4 for better logging
################################################################
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[0]})[${LINENO}]'

#########################################################################
# Set up runtime environment variables for accounts on supported 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
aerorahul marked this conversation as resolved.
Show resolved Hide resolved

######################################################
# setup runtime env for correct python install and git
######################################################
set +x
source "${HOMEgfs}/ush/module-setup.sh"
module use "${HOMEgfs}/modulefiles"
module load "module_gwsetup.${MACHINE_ID}"
set -x

#########################################################
# Create a new branch from develop and move yaml files
#########################################################
branch="weekly_ci_$(date +%Y%m%d)"
develop_dir="${GFS_CI_ROOT}/develop_temp"
echo "Creating new branch ${branch} from develop on ${MACHINE_ID} in ${develop_dir}"
rm -Rf "${develop_dir}"
mkdir -p "${develop_dir}"
cd "${develop_dir}" || exit 1
git clone "${REPO_URL}"
cd global-workflow || exit 1
git checkout -b "${branch}"

######################################################
# move yaml files from ci/cases/weekly to ci/cases/pr
# and push new branch for PR weekly CI tests to GitHub

mv ci/cases/weekly ci/cases/pr
git add ci/cases
git commit -m "Moved weekly cases files into pr for high resolution testing"
git push --set-upstream origin "${branch}"

####################################################################
# Create Pull Request using GitHub CLI and add labels for CI testing
####################################################################

REPO_OWNER="TerrenceMcGuinness-NOAA"
TerrenceMcGuinness-NOAA marked this conversation as resolved.
Show resolved Hide resolved
#REPO_OWNER="NOAA-EMC"
REPO_NAME="global-workflow"
BASE_BRANCH="develop"
HEAD_BRANCH="${branch}"
PULL_REQUEST_TITLE="[DO NOT MERGE] Weekly High Resolution CI Tests $(date +'%A %b %d, %Y')"
PULL_REQUEST_BODY="${PULL_REQUEST_TITLE}"
PULL_REQUEST_LABELS=("CI-Orion-Ready" "CI-Hera-Ready")

"${GH}" repo set-default "${REPO_OWNER}/${REPO_NAME}"
"${GH}" pr create --title "${PULL_REQUEST_TITLE}" --body "${PULL_REQUEST_BODY}" --base "${BASE_BRANCH}" --head "${HEAD_BRANCH}"

# Add labels to the pull request
for label in "${PULL_REQUEST_LABELS[@]}"
do
"${GH}" pr edit --add-label "${label}"
done
TerrenceMcGuinness-NOAA marked this conversation as resolved.
Show resolved Hide resolved
rm -Rf "${develop_dir}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script may have trouble removing this directory as it is presently in that CWD/global-workflow.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, it should work because the shell quits on return, but yeah it's not a good idea.