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 pipeline2 #231

Closed
wants to merge 395 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
395 commits
Select commit Hold shift + click to select a range
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
2e159cd
added throttle to build
Jan 29, 2024
e1f054f
remove prop from throttle
Jan 29, 2024
03b551f
moveed throttle inside options block of stage build
Jan 29, 2024
2329c4a
updated fixed label check code
Jan 29, 2024
fc7a3a6
ndded script block in post always
Jan 29, 2024
5c4d4a6
added confgired catigory to throttle
Jan 29, 2024
c0b386f
took out throttle option and added limit j to 2 on both concurrent bu…
Jan 29, 2024
e896a1c
made remove all labels with machine in post alwasy a conventional loop
Jan 29, 2024
ec432da
Update Jenkinsfile
TerrenceMcGuinness-NOAA Jan 29, 2024
e9a8e2c
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Jan 30, 2024
1890259
added to matrix builds to make it sequential and added yaml reads
Jan 30, 2024
f3be7f3
had extra values line in first matrix build
Jan 30, 2024
8a26393
had an extra pasted GFS build
Jan 30, 2024
cbf32bc
added build yaml file in cases yamls
Jan 30, 2024
bed6fa8
variable key had to be imutable
Jan 30, 2024
e4426fc
testing imuable key
Jan 30, 2024
d8bbea9
testing yaml output
Jan 30, 2024
4a03f87
traverse build args
Jan 30, 2024
51ab85f
missed } on iter
Jan 30, 2024
f2a018a
use get in yaml
Jan 30, 2024
59f7aee
try it key
Jan 30, 2024
2910b53
just system
Jan 30, 2024
cbc9e22
to string
Jan 30, 2024
b373865
to string
Jan 30, 2024
a0fd397
still trying
Jan 30, 2024
09d6eb8
still foo
Jan 30, 2024
01e09ba
finally
Jan 30, 2024
bb7ff25
finally then trim
Jan 30, 2024
0156747
finally then trim and nulls
Jan 30, 2024
e9a6b70
got args to work
Jan 30, 2024
c4dcbe6
put clone back in
Jan 31, 2024
ec6ba94
added back throttled build and removed second build block
Jan 31, 2024
85522b7
removed extra leftover values line in build matrix
Jan 31, 2024
1c77e99
removed non yaml lines from cases so snakeyaml could read it
Jan 31, 2024
773164a
added override in create experment and removed stubed scripts
Jan 31, 2024
9747d7a
moved scm after semephore test
Jan 31, 2024
6d439b6
Update Jenkinsfile
TerrenceMcGuinness-NOAA Jan 31, 2024
a7ff014
Update Jenkinsfile
TerrenceMcGuinness-NOAA Jan 31, 2024
c2e0f82
Update Jenkinsfile
TerrenceMcGuinness-NOAA Feb 1, 2024
da9f7cd
added pre checkout in TESTDIR added source of gwsetup and changed fir…
Feb 1, 2024
3662f07
added git to hera gw setup module load
Feb 1, 2024
5c2eb59
made shallow checkout a function call
Feb 1, 2024
be7b72e
misplaced bracket in source of gw_setup
Feb 1, 2024
aeaa5cf
cd into TESTDIR for shallow clone
Feb 1, 2024
8fa7868
moved git load on gwset hera because it is in the stack spac
Feb 1, 2024
76f13ed
use shallow checkout and git submoudle recussive update directly
Feb 1, 2024
2685a85
configured scm shallow and using git modules recursive from host
Feb 1, 2024
0944fd4
still had shallow call and removed it
Feb 1, 2024
a1ba03b
put dir back at attempt to use ws
Feb 1, 2024
de514d9
take out pre checkout and just use submodule update directly
Feb 1, 2024
e866d28
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Feb 2, 2024
a80666e
stub build all to just gdas
Feb 2, 2024
2e43230
added git which and version for debugging
Feb 2, 2024
5071db1
put buile lines back in build yaml
Feb 2, 2024
948992c
added a second Jenkins file to test dynamic parallel build stages
Feb 2, 2024
e7790ee
removed Jenkinsfile2 to put it into its own repo
Feb 2, 2024
65ad484
making repo with Jenkins2 that has dynamic builds
Feb 2, 2024
5fde011
needed to set HOMEgfs with loop var
Feb 2, 2024
947ba81
needed have unique yaml file var name
Feb 2, 2024
f5db186
Jenkins2 need a pre scm for getting build yaml info
Feb 2, 2024
d730104
needed full path to build.yaml in init scm
Feb 2, 2024
32ac42a
adding build stubs
Feb 2, 2024
6f72909
adding build stubs again
Feb 2, 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
185 changes: 185 additions & 0 deletions Jenkinsfile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
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 {
properties([parameters([[$class: 'NodeParameterDefinition', allowedSlaves: ['built-in','Hera-EMC','Orion-EMC'], defaultSlaves: ['built-in'], name: '', nodeEligibility: [$class: 'AllNodeEligibility'], triggerIfResult: 'allCases']])])
HOME = "${WORKSPACE}/TESTDIR"
checkout scm
sh( script: "mkdir -p ${HOME}", returnStatus: true)
pullRequest.addLabel("CI-${machine}-Building")
if ( pullRequest.labels.any{ value -> value.matches("CI-${machine}-Ready") } ) {
pullRequest.removeLabel("CI-${machine}-Ready")
}
}
}
}

stage('Build Systems') {
agent { label "${MACHINE}-emc" }
steps {
script {
def builds_systems_file = readYaml file: 'ci/cases/yamls/build.yaml'
def build_systems = builds_systems_file['builds'].collect { it.keySet()[0] }
def systemsMap = build_systems.collectEntries { ["${it}": {
stage("${it}") {
steps {
script {
HOMEgfs = "${HOME}/${it}"
dir(HOMEgfs) {
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 {
checkout scm
sh( script: "source workflow/gw_setup.sh;which git;git --version;git submodule update --init --recursive", returnStatus: true)
def builds_file = readYaml file: "ci/cases/yamls/build.yaml"
def build_args_list = builds_file['builds']
def build_args = build_args_list[system].join(" ").trim().replaceAll("null", "")
dir("${HOMEgfs}/sorc") {
sh( script: "${build_args}", returnStatus: false)
sh( script: "./link_workflow.sh", returnStatus: false)
sh( script: "echo ${HOMEgfs} > BUILT_semaphor", returnStatus: true)
}
}
}

}
}

} }]
}
parallel systemsMap
}
}
}


stage('Setup RUNTESTS') {
agent { label "${MACHINE}-emc" }
steps {
script {
sh( script: "mkdir -p ${HOME}/RUNTESTS", returnStatus: true)
if ( pullRequest.labels.any{ value -> value.matches("CI-${machine}-Building") } ) {
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 {
sh( script: "sed -n '/{.*}/!p' ${HOME}/gfs/ci/cases/pr/${Case}.yaml > ${HOME}/gfs/ci/cases/pr/${Case}.yaml.tmp", returnStatus: true)
def yaml_case = readYaml file: "${HOME}/gfs/ci/cases/pr/${Case}.yaml.tmp"
system = yaml_case.experiment.system
def HOMEgfs = "${HOME}/${system}"
env.RUNTESTS = "${HOME}/RUNTESTS"
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 {
always {
script {
for (label in pullRequest.labels) {
if (label.contains("${machine}")) {
pullRequest.removeLabel(label)
}
}
}
}
success {
script {
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}")
}
}
failure {
script {
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 ->
if( line.contains(".log")) {
archiveArtifacts artifacts: "${line}", fingerprint: true
}
}
}
}
}
}

}
5 changes: 5 additions & 0 deletions ci/cases/yamls/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
builds:
#- gefs: './build_all.sh -gu'
#- gfs: './build_all.sh -gu'
- gefs: 'echo "build stub gefs"'
- gfs: 'echo "build stub gfs"'
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
110 changes: 95 additions & 15 deletions ci/scripts/utils/ci_utils.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,104 @@
#!/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"

# system=$(grep "system:" "${yaml_config}" | cut -d":" -f2 | tr -d " ") || true

"${HOMEgfs}/${system}/workflow/create_experiment.py" --overwrite --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}"
1 change: 1 addition & 0 deletions modulefiles/module_gwsetup.hera.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ load(pathJoin("python", python_ver))
load("py-jinja2")
load("py-pyyaml")
load("py-numpy")
load(pathJoin("git","2.40.0"))

whatis("Description: GFS run setup environment")
Loading