From a71e3ee4d25567aa6ebc48f88d68e99290e980db Mon Sep 17 00:00:00 2001 From: Terry McGuinness Date: Fri, 29 Sep 2023 18:35:47 -0500 Subject: [PATCH 1/9] driver_weekly bugfix deleting new branch if is already on repo --- ci/scripts/driver_weekly.sh | 7 ++++++- ci/scripts/run_ci.sh | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index c78a42d3be..7f00aec243 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -22,7 +22,7 @@ set -eux # 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"} +export REPO_URL="ssh://git@ssh.github.com:443/NOAA-EMC/global-workflow.git" ################################################################ # Setup the relative paths to scripts and PS4 for better logging @@ -68,6 +68,11 @@ mkdir -p "${develop_dir}" cd "${develop_dir}" || exit 1 git clone "${REPO_URL}" cd global-workflow || exit 1 +git ls-remote --exit-code origin "${branch}" +if [[ $? == '0' ]]; then + # Delete the branch if it exists + git push origin --delete "${branch}" +fi git checkout -b "${branch}" ###################################################### diff --git a/ci/scripts/run_ci.sh b/ci/scripts/run_ci.sh index 5740b2955a..0ff3725be9 100755 --- a/ci/scripts/run_ci.sh +++ b/ci/scripts/run_ci.sh @@ -22,7 +22,7 @@ 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" + source "${HOMEgfs}/ci/platforms/config.${MACHINE_ID}" ;; *) echo "Unsupported platform. Exiting with error." From 2cf4b21b98a42d6057394440cadd8554c1d0725e Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Fri, 29 Sep 2023 23:45:21 +0000 Subject: [PATCH 2/9] Update driver_weekly.sh remove testing directly on $? --- ci/scripts/driver_weekly.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index 7f00aec243..74969c988b 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -69,7 +69,8 @@ cd "${develop_dir}" || exit 1 git clone "${REPO_URL}" cd global-workflow || exit 1 git ls-remote --exit-code origin "${branch}" -if [[ $? == '0' ]]; then +ci_status=$? +if [[ "${ci_status}" == '0' ]]; then # Delete the branch if it exists git push origin --delete "${branch}" fi From d52ab838b9c8e015adbdda74efdab396ffbc8023 Mon Sep 17 00:00:00 2001 From: Terry McGuinness Date: Tue, 3 Oct 2023 10:25:14 -0500 Subject: [PATCH 3/9] changed REPO_OWNER away from NOAA-EMC so that intermediary branch does not get pushed to authoritative repo --- ci/scripts/driver_weekly.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index 74969c988b..406ca7b28b 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -90,7 +90,7 @@ git push --set-upstream origin "${branch}" # Create Pull Request using GitHub CLI and add labels for CI testing #################################################################### -REPO_OWNER="NOAA-EMC" +REPO_OWNER="TerrenceMcGuinness-NOAA" REPO_NAME="global-workflow" BASE_BRANCH="develop" HEAD_BRANCH="${branch}" From f8ecb12f9a758e2f4d321d5cd9dd19ea59eb8af1 Mon Sep 17 00:00:00 2001 From: Terry McGuinness Date: Tue, 3 Oct 2023 16:30:22 -0500 Subject: [PATCH 4/9] updated driver_weely so that intermediary branch is stored in emcbot --- ci/scripts/driver_weekly.sh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index 406ca7b28b..cb8b40a728 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -61,44 +61,50 @@ 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" +develop_dir="${GFS_CI_ROOT}/develop_weekly" 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 ls-remote --exit-code origin "${branch}" -ci_status=$? -if [[ "${ci_status}" == '0' ]]; then - # Delete the branch if it exists - git push origin --delete "${branch}" -fi 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 +REPO_OWNER="emcbot" +REPO_NAME="global-workflow" rm -Rf ci/cases/pr 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}" + +git remote add upstream "git@github.com:${REPO_OWNER}/${REPO_NAME}.git" + +set +e +# Delete the branch if it exists +git ls-remote --exit-code upstream "${branch}" +ci_status=$? +if [[ "${ci_status}" == '0' ]]; then + git push upstream --delete "${branch}" +fi +set -e + +git push --set-upstream upstream "${branch}" #################################################################### # Create Pull Request using GitHub CLI and add labels for CI testing #################################################################### -REPO_OWNER="TerrenceMcGuinness-NOAA" -REPO_NAME="global-workflow" +HEAD_BRANCH="${REPO_OWNER}:${branch}" 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/CD" "CI-Orion-Ready" "CI-Hera-Ready") -"${GH}" repo set-default "${REPO_OWNER}/${REPO_NAME}" +"${GH}" repo set-default "NOAA-EMC/global-workflow" "${GH}" pr create --title "${PULL_REQUEST_TITLE}" --body "${PULL_REQUEST_BODY}" --base "${BASE_BRANCH}" --head "${HEAD_BRANCH}" "${GH}" pr ready --undo From d51f1743752caf16b4e12d1cbffa51b6c8d868da Mon Sep 17 00:00:00 2001 From: Terry McGuinness Date: Wed, 4 Oct 2023 11:52:12 -0500 Subject: [PATCH 5/9] micro update for remote name for pushing weekly update brandh to emcbot repo --- ci/scripts/driver_weekly.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index cb8b40a728..e044932036 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -75,13 +75,14 @@ git checkout -b "${branch}" # and push new branch for PR weekly CI tests to GitHub REPO_OWNER="emcbot" REPO_NAME="global-workflow" +REMOTE_NAME="${REPO_OWNER}" rm -Rf ci/cases/pr 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 remote add upstream "git@github.com:${REPO_OWNER}/${REPO_NAME}.git" +git remote add "${REMOTE_NAME}" "git@github.com:${REPO_OWNER}/${REPO_NAME}.git" set +e # Delete the branch if it exists From 694a91bff65b2ba95b115b77b0e34234f8fe961a Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Wed, 4 Oct 2023 21:39:05 +0000 Subject: [PATCH 6/9] picked up two other name chages in remote stream for pushing the emcbot repo --- ci/scripts/driver_weekly.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index e044932036..d59b6bfd6a 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -89,11 +89,11 @@ set +e git ls-remote --exit-code upstream "${branch}" ci_status=$? if [[ "${ci_status}" == '0' ]]; then - git push upstream --delete "${branch}" + git push "${REMMOT_NAME}" --delete "${branch}" fi set -e -git push --set-upstream upstream "${branch}" +git push --set-upstream "${REMOTE_NAME}" "${branch}" #################################################################### # Create Pull Request using GitHub CLI and add labels for CI testing From aba1b145a881c4159444e706643f3629ad821f0a Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Wed, 4 Oct 2023 21:57:22 +0000 Subject: [PATCH 7/9] rats -- spelled REMOTE worng .. fixed --- ci/scripts/driver_weekly.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index d59b6bfd6a..6302cb1271 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -89,7 +89,7 @@ set +e git ls-remote --exit-code upstream "${branch}" ci_status=$? if [[ "${ci_status}" == '0' ]]; then - git push "${REMMOT_NAME}" --delete "${branch}" + git push "${REMOTE_NAME}" --delete "${branch}" fi set -e From 286993dbeb13b978d90ac8c09dcd8033b67152aa Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Wed, 4 Oct 2023 18:16:01 -0400 Subject: [PATCH 8/9] Update driver_weekly.sh Removed "High Resolution" from title to short the name to prevent the unsightly wrapping of the labels. --- ci/scripts/driver_weekly.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index 6302cb1271..5bca6b649a 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -101,7 +101,7 @@ git push --set-upstream "${REMOTE_NAME}" "${branch}" HEAD_BRANCH="${REPO_OWNER}:${branch}" BASE_BRANCH="develop" -PULL_REQUEST_TITLE="[DO NOT MERGE] Weekly High Resolution CI Tests $(date +'%A %b %d, %Y')" +PULL_REQUEST_TITLE="[DO NOT MERGE] Weekly CI Tests $(date +'%A %b %d, %Y')" PULL_REQUEST_BODY="${PULL_REQUEST_TITLE}" PULL_REQUEST_LABELS=("CI/CD" "CI-Orion-Ready" "CI-Hera-Ready") From e1939e08642435e81075bfdd5054c3253152e633 Mon Sep 17 00:00:00 2001 From: TerrenceMcGuinness-NOAA Date: Wed, 4 Oct 2023 18:25:25 -0400 Subject: [PATCH 9/9] Update driver_weekly.sh still had REMOTE_NAME not updated in checking if its already there --- ci/scripts/driver_weekly.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/scripts/driver_weekly.sh b/ci/scripts/driver_weekly.sh index 5bca6b649a..3650f75dfc 100755 --- a/ci/scripts/driver_weekly.sh +++ b/ci/scripts/driver_weekly.sh @@ -86,7 +86,7 @@ git remote add "${REMOTE_NAME}" "git@github.com:${REPO_OWNER}/${REPO_NAME}.git" set +e # Delete the branch if it exists -git ls-remote --exit-code upstream "${branch}" +git ls-remote --exit-code "${REMOTE_NAME}" "${branch}" ci_status=$? if [[ "${ci_status}" == '0' ]]; then git push "${REMOTE_NAME}" --delete "${branch}"