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

Jenkins pipeline #223

Closed
wants to merge 332 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
332 commits
Select commit Hold shift + click to select a range
6e5d972
echo of cases needs to be in script block
Dec 28, 2023
21af399
put case each back into script block
Dec 28, 2023
b62e71c
put missing bracket back over stages
Dec 28, 2023
9041ac4
last bracket over pipeline missing
Dec 28, 2023
2b05635
Update stage name and need to comment out build
Dec 28, 2023
28bd6ec
removed echo of HOMEgfs in get_pr_case_list
Dec 28, 2023
a4206f4
abstracted env setup of experment creatation
Dec 28, 2023
009a048
forgot to add updated ci_utils.sh
Dec 28, 2023
ceb9db5
triing to add delcrative steps in creating experiments again
Dec 28, 2023
29492b3
try stage stage
Dec 28, 2023
4f48ed4
add parallel
Dec 28, 2023
7c78852
missed bracker over all staages
Dec 28, 2023
ce4fa1e
added parllel over cases
Dec 28, 2023
994f0c6
replace node with agent
Dec 28, 2023
d1ae8d3
removed agent block
Dec 28, 2023
c1fb336
try global mapp
Dec 28, 2023
e1902ca
added steps
Dec 28, 2023
b0f75b3
revert to what had worked
Dec 28, 2023
56ee98b
remove steps
Dec 28, 2023
7302721
try parallel
Dec 28, 2023
e1abb2d
try parallel run cases again
Dec 28, 2023
a793bb8
try parallel run cases again still
Dec 28, 2023
ef8ee86
try parallel run cases again still 2
Dec 28, 2023
0b7313c
move parallel
Dec 28, 2023
27bf591
move parallel yet again
Dec 28, 2023
41f00a9
move parallel yet again
Dec 28, 2023
3a4c9be
agent node
Dec 28, 2023
6b11fc5
agent node
Dec 28, 2023
1b18b81
working version
Dec 28, 2023
07ff62c
added get pslot list
Dec 28, 2023
8c1cd31
added (sequential) run experments
Dec 28, 2023
deb4372
added build all script in build all for real
Dec 28, 2023
6409a33
forgot path for pslot list
Dec 28, 2023
5c2d107
clear logs on controler by renaming Jenkinsfile
Dec 29, 2023
04913f5
added case in create experiment
Dec 29, 2023
184045b
add Jenkisfile back for new log
Dec 29, 2023
fd1c747
typo bug with pslot in get_pslot_list and uncomment build
Dec 29, 2023
208117d
bug misspelled ci run script
Dec 29, 2023
ef880c8
added rm RUNTESTS dir before createing experminets at the pipeline level
Dec 29, 2023
dcc97f2
removed global RUNTESTS, was getting wrong WORKSPACE dir
Dec 29, 2023
3a63a90
removed RUNTEST var in one more place
Dec 29, 2023
b367a1c
SPELLED WORKSPACE WRONG
Dec 30, 2023
360a353
Merge branch 'NOAA-EMC:develop' into jenkis_demo
TerrenceMcGuinness-NOAA Jan 3, 2024
b9c50ed
working with matrix construct test case
Jan 3, 2024
d4219d9
added correct node name for agent
Jan 3, 2024
56bd357
added correct node name for agent in outer loop too
Jan 3, 2024
7e8d366
move to working version
Jan 3, 2024
1d81eba
back to testing matrix locally
Jan 3, 2024
56e50bd
removed inner agent and two platforms for testing
Jan 3, 2024
707336e
removed inner agent and two platforms for testing still
Jan 3, 2024
b39af61
added sample pipeline for arch opt
Jan 3, 2024
f74ee47
missed bracket
Jan 3, 2024
eeb94e7
basic parallel matrix
Jan 3, 2024
95d100e
double quotes in label for platform
Jan 3, 2024
b78045c
added label based agents in matrix
Jan 3, 2024
7946fad
removed PLATFORM replaced by CHOICE_NODE
Jan 3, 2024
639b4f6
added build and create experments steps
Jan 4, 2024
4df67d8
spelled clean wrong
Jan 4, 2024
cdf2cb1
added MACHINE and updated PR Labels so next platform can run
Jan 4, 2024
5ed8d5d
tried to get Uppercase in MACHINE to work
Jan 4, 2024
93ae7ba
removed var in stage name
Jan 4, 2024
99c23d1
missed quote in echo
Jan 4, 2024
51c1d75
removed wipe
Jan 4, 2024
32cd5d7
echo label
Jan 4, 2024
362b48c
echo labels
Jan 4, 2024
b79c13e
echo machine in post
Jan 4, 2024
eba6261
echo no op in post
Jan 4, 2024
4d3a872
moved MACHINE out from env
Jan 4, 2024
52e20cd
deleted and echo
Jan 4, 2024
38713d6
removed fail label in post
Jan 4, 2024
cb1240a
missed and env on Macine
Jan 4, 2024
f8ebd72
do not do else and make MACHINE none
Jan 4, 2024
943e504
add Machine ID
Jan 4, 2024
62b10b2
can not remove twice
Jan 4, 2024
fd9f6b2
needed quotes around create Cases
Jan 4, 2024
c952ef0
removed rm RUNTESTS duh
Jan 4, 2024
009f897
removed hybatmDA
Jan 4, 2024
2688bf9
label change
Jan 4, 2024
370d328
braclets
Jan 4, 2024
46274bc
added yes to create experemnt
Jan 4, 2024
3cfe7f9
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Jan 9, 2024
0583ee1
moved build step outside of Matrix block so that all cases run agains…
Jan 9, 2024
55f7103
Add machine selection based on labels in Jenkinsfile
Jan 9, 2024
502ee8e
Add agent label for build stage and global master
Jan 9, 2024
404259f
moved main stages block to top
Jan 9, 2024
a40a55a
none agent on top and buit-in before assinged remote agent
Jan 9, 2024
c0b8c4f
build in to buit in type fix
Jan 9, 2024
34be579
still typed buid-in wrong git add Jenkinsfile ! grrr
Jan 9, 2024
3ef2866
OMG I typed built-in yet one more time
Jan 9, 2024
e22f334
moved MACHINE out of env scpope and make global to Jenkins
Jan 9, 2024
632f8f7
left env on last global MACHINE var in creating the experments
Jan 9, 2024
89e4dc7
skip actual buiding for testing
Jan 9, 2024
b64f457
skipDefaultCheckout may had wrong syntax, also removed yes pip to cre…
Jan 9, 2024
82b69ff
updated to abortPrevious
Jan 9, 2024
a7826e6
spelled buildDiscarder wrong and fixed
Jan 9, 2024
599ad70
remove the workspace path and leave it to the common sc area
Jan 9, 2024
c6a9f84
trying to force HOMEgfs from scm WORKSPACE
Jan 9, 2024
264363a
moved assignment of Jenkins HOMEgfs into sript block
Jan 9, 2024
d07c1ab
moved common mkdir for RUNCASES dir and hope matrix is resetting env.…
Jan 9, 2024
5819228
degugging Case control variable in shell
Jan 9, 2024
74eae6d
Cases does work in shell
Jan 9, 2024
678e018
issue with HOMEgfs in env
Jan 9, 2024
a9de618
move HOMEgfs to HOME
Jan 9, 2024
d5304ed
left an extra HOMEgfs in place for mkdir
Jan 9, 2024
66e5072
seemed to loose HOME
Jan 9, 2024
bbef554
need RUNTESTS in shell env
Jan 9, 2024
fbcec52
missed a bracket on setting local env
Jan 9, 2024
43d4f88
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Jan 10, 2024
01267ed
uncommented out the actual build
Jan 10, 2024
e2fe2b2
added Jeinkins code for running experiments within the matrix block
Jan 10, 2024
26d8c32
type in bash assign statment for check_case
Jan 10, 2024
90be03e
added lables for Running and Pass/Fail
Jan 10, 2024
cd11a82
missed a bracket placment for stages block to seperate from post
Jan 10, 2024
2ef9039
needed steps in Run stage
Jan 10, 2024
71e3c00
removed labels to debug
Jan 11, 2024
2cf68f5
Need to rethink Labeling because of the parallel nature of the matrix…
Jan 11, 2024
c399753
Need to rethink Labeling because of the parallel nature of the matrix…
Jan 11, 2024
fcf0e28
Trying to figure out Run Experiments block is complaining about not h…
Jan 11, 2024
c7b69da
moved agent back and coslidated script lines still get weird message …
Jan 11, 2024
2ce0078
changed Cases to Case and fixed one that was a mismatch
Jan 11, 2024
aa20993
replaced WORKSPACE holdover to HOME
Jan 11, 2024
29ee450
clean workspace
Jan 11, 2024
943a33e
Added PR Label setting for Running in non matrixed build block and ad…
Jan 11, 2024
95c2431
remove old referencd Jenkinsfiles
Jan 11, 2024
75d1db4
removed another Jenkins reference file
Jan 11, 2024
8a34f42
updated cancel_slurm to a generlized cancel_batch for pbs on wcoss
Jan 12, 2024
97ec15e
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Jan 16, 2024
1d74f24
added some post clean up and messaging
Jan 16, 2024
143c196
needed Case to be in shell env as well as in Jenkins script environme…
Jan 16, 2024
d7d6a79
still not getting the correct pslot in the matrix, remove shell refer…
Jan 16, 2024
fcf18d1
still not getting the correct pslot in the matrix, moved shell sh int…
Jan 16, 2024
cc39052
finally getting pslot in the shell, checking if env statements are ne…
Jan 16, 2024
fc4dcb2
remove env assignment statements since all shell commands to the work…
Jan 16, 2024
0d535d2
consolodated all the bash shells into Jenkins scripts with the sh met…
Jan 16, 2024
07ffbf4
moved ws under steps
Jan 16, 2024
d70b7ac
moved HOME and ws around
Jan 17, 2024
e15b033
added HOME for common build into full paths of scripts
Jan 17, 2024
2d0c500
added global envirment trying to track down where decltartive fails
Jan 17, 2024
7e17063
removed glogal environment and when blocks
Jan 17, 2024
f30c678
added HOMEgfs in shell (not sh) because it was picking up /home/tmcgu…
Jan 17, 2024
b62fac7
oops had a misspelling of gfsHOME
Jan 17, 2024
129c135
put the actual build back in
Jan 17, 2024
77d20dd
commented out sm and build
TerrenceMcGuinness-NOAA Jan 17, 2024
c9c3722
put back in scm and checkout to prime script locations on restart
TerrenceMcGuinness-NOAA Jan 17, 2024
cc57449
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Jan 17, 2024
64a37db
made two shared values between stages global in attempts to make pipe…
Jan 17, 2024
2e69d59
Merge branch 'jenkins-pipeline' of github.com:TerrenceMcGuinness-NOAA…
Jan 17, 2024
a7ac197
Update ci_utils.sh
TerrenceMcGuinness-NOAA Jan 18, 2024
154dd05
working on state added BUILD semaphore file in sorc dir
Jan 18, 2024
8262741
reversed logic for BUILT file semaphore
Jan 18, 2024
5a0c52a
added chmod x to sub scripts
Jan 18, 2024
bf8896b
needed to set HOMEgfs in run stub
Jan 18, 2024
7e60d23
needed to set HOMEgfs in run stub and looking at pullRequest.labels.c…
Jan 18, 2024
12e3126
typoed pslot in run check stub script
Jan 18, 2024
8f8e892
hard coded node name
Jan 18, 2024
94f8417
hard coded node names typo capped
Jan 18, 2024
0489383
returnStdout on cat BUIT semaphore didnt save
Jan 19, 2024
68d245b
added node properties
Jan 19, 2024
0834c3f
restored configurable node
Jan 19, 2024
d76e1f1
moved parameters into options block
Jan 19, 2024
5471c46
added just parameters section
Jan 19, 2024
8d7d4b2
moved parameters into options
Jan 19, 2024
abb7470
parameters can not be in options
Jan 19, 2024
c46fdd6
removed class in parameters
Jan 19, 2024
52bd973
added class in bracketrs
Jan 19, 2024
6d0eb3a
removed double bracket
Jan 19, 2024
b6f7212
not sure how to hadd class
Jan 19, 2024
a94f2ce
still can not get syntax for parameters
Jan 19, 2024
9ccf7bc
still not finding class
Jan 19, 2024
f4edcce
just removed class line
Jan 19, 2024
bd4d49c
moved properties into stage
Jan 19, 2024
45a8a4d
moved properties into script in Run Seection
Jan 19, 2024
5d29ceb
had machine instead of MACIHNE in node name
Jan 19, 2024
734d4fc
added properties for epic nodes
Jan 19, 2024
39529e5
needed to remove RUNTESTS dir on rebuild
Jan 19, 2024
9d5ab04
added exit 1 to run stub
Jan 19, 2024
4da660f
removed returnstatus flag on run stub
Jan 19, 2024
9206156
Updated properties to my controler
Jan 19, 2024
8715f57
Can not get parameteres to sork again
Jan 19, 2024
859d7cb
added defaut slave as running one
Jan 19, 2024
450bcab
added prop in create
Jan 19, 2024
fbbe569
added prop in create still brokek
Jan 19, 2024
a2226e2
still broken
Jan 19, 2024
48a34d0
moved prop under get machine script
Jan 19, 2024
2b7e941
made machine global
Jan 19, 2024
38ad4b4
Label issue
Jan 19, 2024
9e5dacf
removed Configuiration class
Jan 19, 2024
2ef5a62
added stub logic
Jan 19, 2024
a2cef59
remove exit 0 on create exper wrapper because once worked
Jan 19, 2024
8879946
two orion fake local adds
Jan 19, 2024
bf18bc8
added my spak python 3
Jan 20, 2024
26a3512
got =~ backwards
Jan 20, 2024
77af83d
explitly remove existing experment before re-running create
Jan 20, 2024
b6ffee9
hard coded HOMEgfs for testing
Jan 20, 2024
7c7fbbe
testing on node hera not orion
Jan 20, 2024
0638b6d
dump remove label constraint for now
Jan 20, 2024
6fc3581
RUNTESTS was wrong and yes works
Jan 20, 2024
35943ad
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Jan 22, 2024
4e807cc
removed hardcoded machine label on nodes
Jan 22, 2024
b66b9bc
restore away from local build cludges
Jan 22, 2024
29d790c
some linting
Jan 22, 2024
1b47f78
some eols
Jan 22, 2024
a30a555
wrong MACHINE in node label
Jan 22, 2024
ad1c71f
removed y pipe and added rm case in pipeline
Jan 22, 2024
65cc185
removed DefaultSlave in parameters
Jan 22, 2024
30dea74
added rm COMROOT line in pipeline
Jan 22, 2024
8657be5
try var in param
Jan 22, 2024
995b437
trying to add more choices
Jan 22, 2024
c2a9c86
add back real build run
Jan 22, 2024
49a7f71
revert
Jan 22, 2024
bfb1ef4
ready to start testing stub pipeline with system build
Jan 22, 2024
a2e8f07
wrap a stages around build matrix stage
Jan 22, 2024
d1e2359
wrap matrix around build stage
Jan 22, 2024
54baf54
needed axis not two axes
Jan 22, 2024
04288ce
put matrix wrap in buid stage
Jan 22, 2024
b8b8070
still trying to get matrix hierachey to work
Jan 22, 2024
dcf7a87
system literal literal
Jan 22, 2024
686be11
ws needed body
Jan 22, 2024
81380a8
remove workspaces
Jan 22, 2024
e0a420f
WORKSPACE git just outside of build matrix in node
Jan 22, 2024
d9303a2
Added TESTDIR
Jan 22, 2024
9b28ba3
deleted old script line
Jan 22, 2024
a6e0839
dir step needed bodey
Jan 22, 2024
6687bd5
created dedicated stage for getting global workspace for the PR
Jan 22, 2024
118d43d
made HOMEgfs local in matrix and removed from global
Jan 23, 2024
e601257
global HOME TESTDIR
Jan 23, 2024
c422f61
added local HOMEgfs and global HOME in Run Experiments
Jan 23, 2024
86f2c90
updated TESTDIR to global HOME
Jan 23, 2024
45601f5
remved stubs to run on Orion
Jan 23, 2024
3146a39
need updated buid all args for gefs
Jan 23, 2024
343020c
use old build all args for both systems
Jan 23, 2024
508e354
removed stubs add all nodes with restart selector and put back label rm
Jan 23, 2024
2b684c2
remove Running label without check
Jan 23, 2024
d80907a
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Jan 23, 2024
6775d49
add dir into sorc
Jan 23, 2024
7856081
moved mkdir on RUNTESTS into top stage in Create Experments
Jan 23, 2024
75bccbd
added entire stage to mkdir TESTDIR and update labels
Jan 23, 2024
b2b5243
added full path for dir() into sorc
Jan 23, 2024
5965d86
reduced save to three
Jan 23, 2024
e22dffa
can not figure out why dir() is not working
Jan 23, 2024
b394c3a
added a few more degubs and . for pwd path
Jan 23, 2024
9b02f36
added an explicit cd into the gfs/sorc dir to run build_all
Jan 25, 2024
c7053d1
fixed quote on echo PWD on script sh command line
Jan 25, 2024
457b3d7
added explicit git command for updating submoules recursivly, scm was…
Jan 25, 2024
e9fbf93
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Jan 26, 2024
6acc918
added max jobs on build all to 4
Jan 26, 2024
258e9c7
updated pipline with node on setup RUNDIR and removed system in run e…
Jan 26, 2024
960e0fe
updated path of HOMEgfs in run check scripts using gfs as default
Jan 26, 2024
0d09e5c
use HOME to point to RUNDIRS for run-check
Jan 26, 2024
4eb89e2
add label updates back move archive to post
Jan 27, 2024
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
183 changes: 183 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
def MACHINE = 'none'
def machine = 'none'
def HOME = 'none'

pipeline {
agent { label 'built-in' }

options {
disableConcurrentBuilds(abortPrevious: true)
skipDefaultCheckout(true)
buildDiscarder(logRotator(numToKeepStr: '3'))
}

stages {

stage('Get Machine') {
agent { label 'built-in' }
steps {
script {
MACHINE = 'none'
for (label in pullRequest.labels) {
echo "Label: ${label}"
if ((label.matches("CI-Hera-Ready"))) {
MACHINE = 'hera'
} else if ((label.matches("CI-Orion-Ready"))) {
MACHINE = 'orion'
} else if ((label.matches("CI-Hercules-Ready"))) {
MACHINE = 'hercules'
}
}
machine = MACHINE[0].toUpperCase() + MACHINE.substring(1)
}
}
}

stage('Get Common Workspace') {
agent { label "${MACHINE}-emc" }
steps ( timeout(time: 1, unit: 'HOURS') ) {
script {
HOME = "${WORKSPACE}/TESTDIR"
pullRequest.addLabel("CI-${machine}-Building")
if (pullRequest.labels.contains("CI-${machine}-Ready")) {
pullRequest.removeLabel("CI-${machine}-Ready")
}
}
}
}

stage('Build') {
matrix {
agent { label "${MACHINE}-emc" }
axes {
axis {
name "system"
values "gfs", "gefs"
}
}
stages {
stage("build system") {
steps {
script {
def HOMEgfs = "${HOME}/${system}"
properties([parameters([[$class: 'NodeParameterDefinition', allowedSlaves: ['built-in','Hera-EMC','Orion-EMC'], defaultSlaves: ['built-in'], name: '', nodeEligibility: [$class: 'AllNodeEligibility'], triggerIfResult: 'allCases']])])
sh( script: "mkdir -p ${HOMEgfs}", returnStatus: true)
dir(HOMEgfs) {
checkout scm
env.MACHINE_ID = MACHINE
if (fileExists("sorc/BUILT_semaphor")) {
sh( script: "cat sorc/BUILT_semaphor", returnStdout: true).trim()
pullRequest.comment("Cloned PR already built (or build skipped) on ${machine} in directory ${HOMEgfs}")
} else {
sh( script: "git submodule update --init --recursive", returnStatus: true)
if (system == "gfs") {
dir("${HOMEgfs}/sorc") {
sh( script: "./build_all.sh -gu -j 4", returnStatus: false)
sh( script: "./link_workflow.sh", returnStatus: false)
sh( script: "echo ${HOMEgfs} > BUILT_semaphor", returnStatus: true)
}
} else if (system == "gefs") {
// TODO: need to add gefs build arguments from a yaml file
dir("${HOMEgfs}/sorc") {
sh( script: "./build_all.sh -gu -j 4", returnStatus: false)
sh( script: "./link_workflow.sh", returnStatus: false)
sh( script: "echo ${HOMEgfs} > BUILT_semaphor", returnStatus: true)
}
}
}
}
}
}
}
}
}
}

stage('Setup RUNTESTS') {
agent { label "${MACHINE}-emc" }
steps {
script {
sh( script: "mkdir -p ${HOME}/RUNTESTS", returnStatus: true)
//TODO cannot get pullRequest.labels.contains("CI-${machine}-Building") to work
pullRequest.removeLabel("CI-${machine}-Building")
pullRequest.addLabel("CI-${machine}-Running")
}
}

}

stage('Run Tests') {
matrix {
agent { label "${MACHINE}-emc" }
axes {
axis {
name "Case"
values "C48_ATM", "C48_S2SWA_gefs", "C48_S2SW", "C96_atm3DVar"
}
}
stages {
stage('Create Experiment') {
steps {
script {
env.RUNTESTS = "${HOME}/RUNTESTS"
def HOMEgfs = "${HOME}/gfs"
env.HOME = HOMEgfs
sh( script: "rm -Rf ${RUNTESTS}/EXPDIR/${Case}_*" )
sh( script: "rm -Rf ${RUNTESTS}/COMROOT/${Case}_*" )
sh( script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${Case}.yaml", returnStatus: true)
}
}
}
stage('Run Experiments') {
steps {
script {
def HOMEgfs = "${HOME}/gfs"
pslot = sh( script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh get_pslot ${HOME}/RUNTESTS ${Case}", returnStdout: true ).trim()
pullRequest.comment("Running experiments: ${Case} with pslot ${pslot} on ${machine}")
try {
sh( script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${HOME} ${pslot}", returnStatus: false)
pullRequest.comment("SUCCESS running experiments: ${Case} on ${machine}")
} catch (Exception e) {
pullRequest.comment("FAILURE running experiments: ${Case} on ${machine}")
error("Failed to run experiments ${Case} on ${machine}")
}
}
}
}
}
}
}

}

post {
success {
script {
//if ( pullRequest.labels.contains( "CI-${machine}-Running" ) ) {
// pullRequest.removeLabel("CI-${machine}-Running")
//}
// TODO: contains mehthod does not work
pullRequest.removeLabel("CI-${machine}-Running")
pullRequest.addLabel("CI-${machine}-Passed")
def timestamp = new Date().format("MM dd HH:mm:ss", TimeZone.getTimeZone('America/New_York'))
pullRequest.comment("SUCCESSFULLY ran all CI Cases on ${machine} at ${timestamp}")
}
cleanWs()
}
failure {
script {
pullRequest.removeLabel("CI-${machine}-Running")
pullRequest.addLabel("CI-${machine}-Failed")
def timestamp = new Date().format("MM dd HH:mm:ss", TimeZone.getTimeZone('America/New_York'))
pullRequest.comment("CI FAILED ${machine} at ${timestamp}\n\nBuilt and ran in directory ${HOME}")
if (fileExists('${HOME}/RUNTESTS/ci.log')) {
def fileContent = readFile '${HOME}/RUNTESTS/ci.log'
fileContent.eachLine { line ->
archiveArtifacts artifacts: "${line}", fingerprint: true
}
}
}
}
}

}
4 changes: 3 additions & 1 deletion ci/scripts/run-check_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ pslot=${2:-${pslot:-?}} # Name of the experiment being tested by this scr
# │   └── ${pslot}
# └── EXPDIR
# └── ${pslot}
HOMEgfs="${TEST_DIR}/HOMEgfs"
# Two system build directories created at build time gfs, and gdas
# TODO: Make this configurable (for now all scripts run from gfs for CI at runtime)
HOMEgfs="${TEST_DIR}/gfs"
RUNTESTS="${TEST_DIR}/RUNTESTS"

# Source modules and setup logging
Expand Down
11 changes: 11 additions & 0 deletions ci/scripts/run-check_ci_stub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

set -eu

HOMEgfs=$1
pslot=$2

echo -e "HOMEgfs: ${HOMEgfs}\npslpot: ${pslot}\n in ${PWD}" >> "${HOMEgfs}/ci/scripts/run-check_ci_stub.log"
if [[ ${pslot} =~ "C48_S2SW" ]]; then
exit 1
fi
108 changes: 93 additions & 15 deletions ci/scripts/utils/ci_utils.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,102 @@
#!/bin/env bash

function cancel_slurm_jobs() {

# Usage: cancel_slurm_jobs <substring>
# Example: cancel_slurm_jobs "C48_ATM_3c4e7f74"
function cancel_batch_jobs() {
# Usage: cancel_batch_jobs <substring>
# Example: cancel_batch_jobs "C48_ATM_3c4e7f74"
#
# Cancel all Slurm jobs that have the given substring in their name
# Cancel all batch jobs that have the given substring in their name
# So like in the example all jobs with "C48_ATM_3c4e7f74"
# in their name will be canceled

local substring=$1
local job_ids
job_ids=$(squeue -u "${USER}" -h -o "%i")

for job_id in ${job_ids}; do
job_name=$(sacct -j "${job_id}" --format=JobName%100 | head -3 | tail -1 | sed -r 's/\s+//g') || true
if [[ "${job_name}" =~ ${substring} ]]; then
echo "Canceling Slurm Job ${job_name} with: scancel ${job_id}"
scancel "${job_id}"
continue
fi
done

# cancel pbs jobs <substring>
if [[ ${MACHINE_ID} == "wcoss2" ]]; then
job_ids=$(qstat -u "${USER}" | awk '{print $1}') || true

for job_id in ${job_ids}; do
job_name=$(qstat -f "${job_id}" | grep Job_Name | awk '{print $3}') || true
if [[ "${job_name}" =~ ${substring} ]]; then
echo "Canceling PBS Job ${job_name} with: qdel ${job_id}"
qdel "${job_id}"
continue
fi
done
# cancel slurm jobs <substring>
else
job_ids=$(squeue -u "${USER}" -h -o "%i")

for job_id in ${job_ids}; do
job_name=$(sacct -j "${job_id}" --format=JobName%100 | head -3 | tail -1 | sed -r 's/\s+//g') || true
if [[ "${job_name}" =~ ${substring} ]]; then
echo "Canceling Slurm Job ${job_name} with: scancel ${job_id}"
scancel "${job_id}"
continue
fi
done
fi
}


function get_pr_case_list () {

#############################################################
# loop over every yaml file in the PR's ci/cases
# and create an run directory for each one for this PR loop
#############################################################
for yaml_config in "${HOMEgfs}/ci/cases/pr/"*.yaml; do
case=$(basename "${yaml_config}" .yaml) || true
echo "${case}"
done
}

function get_pslot_list () {

local RUNTESTS="${1}"

#############################################################
# loop over expdir directories in RUNTESTS
# and create list of the directory names (pslot) with the hash tag
#############################################################
for pslot_dir in "${RUNTESTS}/EXPDIR/"*; do
pslot=$(basename "${pslot_dir}") || true
echo "${pslot}"
done

}

function get_pslot () {

local RUNTESTS="${1}"
local case="${2}"

#############################################################
# loop over expdir directories in RUNTESTS
# and return the name of the pslot with its tag that matches the case
#############################################################
for pslot_dir in "${RUNTESTS}/EXPDIR/"*; do
pslot=$(basename "${pslot_dir}")
check_case=$(echo "${pslot}" | rev | cut -d"_" -f2- | rev) || true
if [[ "${check_case}" == "${case}" ]]; then
echo "${pslot}"
break
fi
done

}

function create_experiment () {

local yaml_config="${1}"
cd "${HOMEgfs}" || exit 1
pr_sha=$(git rev-parse --short HEAD)
case=$(basename "${yaml_config}" .yaml) || true
export pslot=${case}_${pr_sha}

source "${HOMEgfs}/ci/platforms/config.${MACHINE_ID}"
source "${HOMEgfs}/workflow/gw_setup.sh"

"${HOME}/workflow/create_experiment.py" --yaml "${yaml_config}"

}
9 changes: 9 additions & 0 deletions ci/scripts/utils/ci_utils_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

HOMEgfs="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." >/dev/null 2>&1 && pwd )"
source "${HOMEgfs}/ush/detect_machine.sh"

utitilty_function="${1}"

source "${HOMEgfs}/ci/scripts/utils/ci_utils.sh"
${utitilty_function} "${@:2}"
5 changes: 5 additions & 0 deletions sorc/build_all_stub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

set -eu

echo "Ran build all stub in ${PWD}" > "BUILD_STUB_RAN_$(date +%d%H%M)"
Loading