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 #242

Closed
wants to merge 465 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
465 commits
Select commit Hold shift + click to select a range
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
29f61f1
adding deleteDir to get scm to checkout again
Feb 2, 2024
74ff699
adding build stubs
Feb 2, 2024
2978c6c
adding build stubs again
Feb 2, 2024
af48ce8
forgot to add build.yaml updates
Feb 2, 2024
348c758
put throttle back and updated build args for gefs
Feb 2, 2024
a0386ed
use rsync to get clones before submodules
Feb 3, 2024
417688c
update rsync line
Feb 3, 2024
44b13e3
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Feb 3, 2024
240a262
revert to scm and comment out disable current builds
Feb 3, 2024
a185aa4
Merge branch 'jenkins-pipeline' of github.com:TerrenceMcGuinness-NOAA…
Feb 3, 2024
3799584
Update Jenkinsfile
TerrenceMcGuinness-NOAA Feb 4, 2024
afc6342
added checkoutsubdir
Feb 4, 2024
8e7e5b3
added checkoutsubdir
Feb 4, 2024
511ee95
extra bracket
Feb 4, 2024
3b3ebc0
moved options
Feb 4, 2024
600cd19
add no scm in exp
Feb 4, 2024
297a842
devult no scm others
Feb 5, 2024
a4174f5
put throuttle back in
Feb 5, 2024
74dbb16
try chaning workspace to get scm to checkout on second parallel matri…
Feb 5, 2024
881697f
added stubs for build all to test the Jenkins scm issue
Feb 5, 2024
b6f0129
removed throttle option for testing scm
Feb 5, 2024
213f6e4
Update ci/scripts/utils/ci_utils.sh
TerrenceMcGuinness-NOAA Feb 5, 2024
2d7e17b
Update ci/scripts/utils/ci_utils.sh
TerrenceMcGuinness-NOAA Feb 5, 2024
86722b0
Update ci/scripts/utils/ci_utils.sh
TerrenceMcGuinness-NOAA Feb 5, 2024
ef1112f
Update ci/scripts/utils/ci_utils.sh
TerrenceMcGuinness-NOAA Feb 5, 2024
0448492
Update modulefiles/module_gwsetup.hera.lua
TerrenceMcGuinness-NOAA Feb 5, 2024
62fe054
took out throuttle and put checkout subdir back
Feb 5, 2024
d305dda
Merge branch 'jenkins-pipeline' of github.com:TerrenceMcGuinness-NOAA…
Feb 5, 2024
45b87fa
update build args for faster buld tests
Feb 5, 2024
e7ecc8f
took stub to create tests and put the action back
Feb 5, 2024
d2a7b51
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Feb 5, 2024
a238eda
put throttle back and took out -j 2
Feb 5, 2024
fc3d5e8
Merge branch 'jenkins-pipeline' of github.com:TerrenceMcGuinness-NOAA…
Feb 5, 2024
7099e77
put concurrancy back in for the matrixed build stage because the scm …
Feb 5, 2024
25893ae
moved mkdir out of Setup RUNTESTS because it the agent options was no…
Feb 5, 2024
5ce3116
added explcit workspaces in create and using gfs as default for running
Feb 5, 2024
245a5fb
added explcit workspaces in create and using gfs as default for running
Feb 5, 2024
0bd51ed
took out case and put in if else in cancel_batch_jobs (for now)
Feb 5, 2024
cc6af42
missed bracket at end of cancel_batch_jobs in ci utils
Feb 5, 2024
5c5e860
add true to return status on run-check because it through that peski …
Feb 5, 2024
743e842
update all Jenkins script calls to returnStatus true and put full tes…
Feb 5, 2024
01298bb
adding with credentials
Feb 5, 2024
0a32c5b
stub create
Feb 5, 2024
5bf9d34
add short list for exper
Feb 5, 2024
b74d982
added withCredntials in all three post sections
Feb 5, 2024
04b3ed8
took out create experments stub
Feb 5, 2024
0f96056
put back in full test list for overnight run
Feb 5, 2024
9f67ef0
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Feb 5, 2024
271a453
Update Jenkinsfile
TerrenceMcGuinness-NOAA Feb 6, 2024
9bd850b
add agent to post block
Feb 6, 2024
343c8df
move post into Run Tests block
Feb 6, 2024
a57e4af
stubbed out create expermentens again
Feb 6, 2024
967bb6d
took out sub for create and made case short list
Feb 6, 2024
0ec0b6f
removed setup block
Feb 6, 2024
5914683
just do one test
Feb 6, 2024
9b83735
added back buildDiscarder
Feb 6, 2024
970e73b
commented out remove label in build
Feb 7, 2024
23fad4c
removed redundent checkout in subdir and commentout gitHub access aft…
Feb 7, 2024
4b8bec7
added ws with github creditials
Feb 7, 2024
db37fe0
misspelled WORKSPACE
Feb 7, 2024
682186d
missed a MACIHNE left in
Feb 7, 2024
8aa8b02
took timer out of Get Common
Feb 7, 2024
ed0562b
updated machine names to Machine in labels missed
Feb 7, 2024
d94a873
added commonworkspace in build update labels
Feb 7, 2024
5c04148
updated workspace in post to be the same in the matrix that ran the s…
Feb 7, 2024
8cf8a2a
remove local varible scope on HOMEgfs in Run experments in hopes it w…
Feb 7, 2024
68503b7
Merge branch 'NOAA-EMC:develop' into jenkins-pipeline
TerrenceMcGuinness-NOAA Feb 7, 2024
1964247
updated Machine in a label and in PR comments
Feb 7, 2024
8d66bcb
Merge branch 'jenkins-pipeline' of https://github.com/TerrenceMcGuinn…
Feb 7, 2024
b2c3c31
only replaced commonworkspace with HOMEgfs workspace in build matrix
Feb 7, 2024
12ec362
added info in Running message to use in GitHub PR
Feb 7, 2024
eb9e48f
put missing values line back in experments matrix
Feb 7, 2024
b0dab47
added u to gfs build and put all tests back in
Feb 7, 2024
9bb5c97
added a stubbed version of the Jenkinsfiel for testing
Feb 7, 2024
44947e0
put a try around removelabel in all
Feb 8, 2024
0f0df62
took pslot out for stubbing
Feb 8, 2024
5629890
added back just build to stub
Feb 8, 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
187 changes: 187 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
def Machine = 'none'
def machine = 'none'
def HOME = 'none'
def localworkspace = 'none'
def commonworkspace = 'none'

pipeline {
agent { label 'built-in' }

options {
skipDefaultCheckout()
buildDiscarder(logRotator(numToKeepStr: '2'))
}

stages {

stage('Get Machine') {
agent { label 'built-in' }
steps {
script {
localworkspace = env.WORKSPACE
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 {
script {
properties([parameters([[$class: 'NodeParameterDefinition', allowedSlaves: ['built-in','Hera-EMC','Orion-EMC'], defaultSlaves: ['built-in'], name: '', nodeEligibility: [$class: 'AllNodeEligibility'], triggerIfResult: 'allCases']])])
HOME = "${WORKSPACE}/TESTDIR"
commonworkspace = "${WORKSPACE}"
sh( script: "mkdir -p ${HOME}/RUNTESTS", returnStatus: true)
pullRequest.addLabel("CI-${Machine}-Building")
if ( pullRequest.labels.any{ value -> value.matches("CI-${Machine}-Ready") } ) {
pullRequest.removeLabel("CI-${Machine}-Ready")
}
}
}
}

stage('Build System') {
matrix {
agent { label "${machine}-emc" }
//options {
// throttle(['global_matrix_build'])
//}
axes {
axis {
name "system"
values "gfs", "gefs"
}
}
stages {
stage("build system") {
steps {
script {
def HOMEgfs = "${HOME}/${system}"
sh( script: "mkdir -p ${HOMEgfs}", returnStatus: true)
ws(HOMEgfs) {
env.MACHINE_ID = machine
if (fileExists("${HOMEgfs}/sorc/BUILT_semaphor")) {
sh( script: "cat ${HOMEgfs}/sorc/BUILT_semaphor", returnStdout: true).trim()
ws(commonworkspace) { 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: true)
sh( script: "./link_workflow.sh", returnStatus: true)
sh( script: "echo ${HOMEgfs} > BUILT_semaphor", returnStatus: true)
}
}
ws(HOMEgfs) {
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}" // local HOMEgfs is used to populate the XML on per system basis
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 {
HOMEgfs = "${HOME}/gfs" // common HOMEgfs is used to launch the scripts that run the experiments
ws(HOMEgfs) {
pslot = sh( script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh get_pslot ${HOME}/RUNTESTS ${Case}", returnStdout: true ).trim()
pullRequest.comment("Running experiments: ${Case} on ${Machine} built against ${system} in directory ${HOMEgfs} with the experiment in directory ${HOME}/RUNTESTS/${pslot}")
try {
sh( script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${HOME} ${pslot}", returnStatus: true)
} catch (Exception e) {
pullRequest.comment("FAILURE running experiments: ${Case} on ${Machine}")
error("Failed to run experiments ${Case} on ${Machine}")
}
pullRequest.comment("SUCCESS running experiments: ${Case} on ${Machine}")
}
}
}
post {
always {
script {
ws (HOMEgfs) {
for (label in pullRequest.labels) {
if (label.contains("${Machine}")) {
pullRequest.removeLabel(label)
}
}
}
}
}
success {
script {
ws (HOMEgfs) {
pullRequest.addLabel("CI-${Machine}-Passed")
def timestamp = new Date().format("MM dd HH:mm:ss", TimeZone.getTimeZone('America/New_York'))
pullRequest.comment("CI SUCCESS ${Machine} at ${timestamp}\n\nBuilt and ran in directory ${HOME}")
}
}
}
failure {
script {
ws (HOMEgfs) {
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
}
}
}
}
}
}
}
}
}
}
}
}

}
192 changes: 192 additions & 0 deletions Jenkinsfile_stubbed
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
def Machine = 'none'
def machine = 'none'
def HOME = 'none'
def localworkspace = 'none'
def commonworkspace = 'none'

pipeline {
agent { label 'built-in' }

options {
skipDefaultCheckout()
buildDiscarder(logRotator(numToKeepStr: '2'))
}

stages {

stage('Get Machine') {
agent { label 'built-in' }
steps {
script {
localworkspace = env.WORKSPACE
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 {
script {
properties([parameters([[$class: 'NodeParameterDefinition', allowedSlaves: ['built-in','Hera-EMC','Orion-EMC'], defaultSlaves: ['built-in'], name: '', nodeEligibility: [$class: 'AllNodeEligibility'], triggerIfResult: 'allCases']])])
HOME = "${WORKSPACE}/TESTDIR"
commonworkspace = "${WORKSPACE}"
sh( script: "mkdir -p ${HOME}/RUNTESTS", returnStatus: true)
pullRequest.addLabel("CI-${Machine}-Building")
if ( pullRequest.labels.any{ value -> value.matches("CI-${Machine}-Ready") } ) {
pullRequest.removeLabel("CI-${Machine}-Ready")
}
}
}
}

stage('Build System') {
matrix {
agent { label "${machine}-emc" }
//options {
// throttle(['global_matrix_build'])
//}
axes {
axis {
name "system"
values "gfs", "gefs"
}
}
stages {
stage("build system") {
steps {
script {
def HOMEgfs = "${HOME}/${system}"
sh( script: "mkdir -p ${HOMEgfs}", returnStatus: true)
ws(HOMEgfs) {
env.MACHINE_ID = machine
//if (fileExists("${HOMEgfs}/sorc/BUILT_semaphor")) {
// sh( script: "cat ${HOMEgfs}/sorc/BUILT_semaphor", returnStdout: true).trim()
// ws(commonworkspace) { 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: true)
sh( script: "./link_workflow.sh", returnStatus: true)
sh( script: "echo ${HOMEgfs} > BUILT_semaphor", returnStatus: true)
}
//}
ws(HOMEgfs) {
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}" // local HOMEgfs is used to populate the XML on per system basis
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 {
HOMEgfs = "${HOME}/gfs" // common HOMEgfs is used to launch the scripts that run the experiments
ws(HOMEgfs) {
//pslot = sh( script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh get_pslot ${HOME}/RUNTESTS ${Case}", returnStdout: true ).trim()
pullRequest.comment("Running experiments: ${Case} on ${Machine} built against ${system} in directory ${HOMEgfs} with the experiment in directory ${HOME}/RUNTESTS")
try {
//sh( script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${HOME} ${pslot}", returnStatus: true)
sh( script: "echo 'subbed run-check'", returnStatus: true)
} catch (Exception e) {
pullRequest.comment("FAILURE running experiments: ${Case} on ${Machine}")
error("Failed to run experiments ${Case} on ${Machine}")
}
pullRequest.comment("SUCCESS running experiments: ${Case} on ${Machine}")
}
}
}
post {
always {
script {
ws (HOMEgfs) {
for (label in pullRequest.labels) {
if (label.contains("${Machine}")) {
try {
pullRequest.removeLabel(label)
} catch (Exception e) {
echo "Failed to remove label ${label}"
}
}
}
}
}
}
success {
script {
ws (HOMEgfs) {
pullRequest.addLabel("CI-${Machine}-Passed")
def timestamp = new Date().format("MM dd HH:mm:ss", TimeZone.getTimeZone('America/New_York'))
pullRequest.comment("CI SUCCESS ${Machine} at ${timestamp}\n\nBuilt and ran in directory ${HOME}")
}
}
}
failure {
script {
ws (HOMEgfs) {
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
}
}
}
}
}
}
}
}
}
}
}
}

}
3 changes: 3 additions & 0 deletions ci/cases/yamls/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
builds:
- gefs: './build_all.sh'
- gfs: './build_all.sh -gu'
Loading
Loading