@@ -9,7 +9,7 @@ pipeline {
9
9
10
10
options {
11
11
skipDefaultCheckout()
12
- buildDiscarder(logRotator( numToKeepStr : ' 2 ' ) )
12
+ parallelsAlwaysFailFast( )
13
13
}
14
14
15
15
stages { // This initial stage is used to get the Machine name from the GitHub labels on the PR
@@ -45,14 +45,14 @@ pipeline {
45
45
properties([parameters([[$class : ' NodeParameterDefinition' , allowedSlaves : [' built-in' , ' Hera-EMC' , ' Orion-EMC' ], defaultSlaves : [' built-in' ], name : ' ' , nodeEligibility : [$class : ' AllNodeEligibility' ], triggerIfResult : ' allCases' ]])])
46
46
HOME = " ${ WORKSPACE} /TESTDIR"
47
47
commonworkspace = " ${ WORKSPACE} "
48
- sh(script : " mkdir -p ${ HOME} /RUNTESTS" , returnStatus : true )
48
+ sh(script : " mkdir -p ${ HOME} /RUNTESTS" )
49
49
pullRequest. addLabel(" CI-${ Machine} -Building" )
50
50
if (pullRequest. labels. any { value -> value. matches(" CI-${ Machine} -Ready" ) }) {
51
51
pullRequest. removeLabel(" CI-${ Machine} -Ready" )
52
+ }
52
53
}
53
54
}
54
55
}
55
- }
56
56
57
57
stage(' Build System' ) {
58
58
matrix {
@@ -71,35 +71,41 @@ pipeline {
71
71
steps {
72
72
script {
73
73
def HOMEgfs = " ${ HOME} /${ system} " // local HOMEgfs is used to build the system on per system basis under the common workspace HOME
74
- sh(script : " mkdir -p ${ HOMEgfs} " , returnStatus : true )
74
+ sh(script : " mkdir -p ${ HOMEgfs} " )
75
75
ws(HOMEgfs ) {
76
76
env. MACHINE_ID = machine // MACHINE_ID is used in the build scripts to determine the machine and is added to the shell environment
77
77
if (fileExists(" ${ HOMEgfs} /sorc/BUILT_semaphor" )) { // if the system is already built, skip the build in the case of re-runs
78
78
sh(script : " cat ${ HOMEgfs} /sorc/BUILT_semaphor" , returnStdout : true ). trim() // TODO: and user configurable control to manage build semphore
79
- ws(commonworkspace) { pullRequest. comment(" Cloned PR already built (or build skipped) on ${ machine} in directory ${ HOMEgfs} " ) }
79
+ pullRequest. comment(" Cloned PR already built (or build skipped) on ${ machine} in directory ${ HOMEgfs} <br>Still doing a checkout to get the latest changes" )
80
+ sh(script : ' source workflow/gw_setup.sh; git pull --recurse-submodules' )
81
+ dir(' sorc' ) {
82
+ sh(script : ' ./link_workflow.sh' )
83
+ }
80
84
} else {
81
85
checkout scm
82
- sh(script : ' source workflow/gw_setup.sh;which git;git --version;git submodule update --init --recursive' , returnStatus : true )
86
+ sh(script : ' source workflow/gw_setup.sh;which git;git --version;git submodule update --init --recursive' )
83
87
def builds_file = readYaml file : ' ci/cases/yamls/build.yaml'
84
88
def build_args_list = builds_file[' builds' ]
85
89
def build_args = build_args_list[system]. join(' ' ). trim(). replaceAll(' null' , ' ' )
86
90
dir(" ${ HOMEgfs} /sorc" ) {
87
- sh(script : " ${ build_args} " , returnStatus : true )
88
- sh(script : ' ./link_workflow.sh' , returnStatus : true )
89
- sh(script : " echo ${ HOMEgfs} > BUILT_semaphor" , returnStatus : true )
91
+ sh(script : " ${ build_args} " )
92
+ sh(script : ' ./link_workflow.sh' )
93
+ sh(script : " echo ${ HOMEgfs} > BUILT_semaphor" )
90
94
}
91
95
}
92
- if (pullRequest. labels. any { value -> value. matches(" CI-${ Machine} -Building" ) }) {
93
- pullRequest. removeLabel(" CI-${ Machine} -Building" )
94
- }
95
- pullRequest. addLabel(" CI-${ Machine} -Running" )
96
- }
96
+ if (env. CHANGE_ID && system == ' gfs' ) {
97
+ if (pullRequest. labels. any { value -> value. matches(" CI-${ Machine} -Building" ) }) {
98
+ pullRequest. removeLabel(" CI-${ Machine} -Building" )
99
+ }
100
+ pullRequest. addLabel(" CI-${ Machine} -Running" )
101
+ }
102
+ }
103
+ }
97
104
}
98
105
}
99
106
}
100
107
}
101
108
}
102
- }
103
109
104
110
stage(' Run Tests' ) {
105
111
matrix {
@@ -108,19 +114,19 @@ pipeline {
108
114
axis {
109
115
name ' Case'
110
116
// TODO add dynamic list of cases from env vars (needs addtional plugins)
111
- values ' C48_ATM' , ' C48_S2SWA_gefs' , ' C48_S2SW' , ' C96_atm3DVar' , ' C48mx500_3DVarAOWCDA ' , ' C96C48_hybatmDA ' , ' C96_atmsnowDA '
117
+ values ' C48_ATM' , ' C48_S2SWA_gefs' , ' C48_S2SW' , ' C96_atm3DVar' , ' C96C48_hybatmDA ' , ' C96_atmsnowDA ' // 'C48mx500_3DVarAOWCDA '
112
118
}
113
119
}
114
120
stages {
115
121
stage(' Create Experiment' ) {
116
122
steps {
117
123
script {
118
- sh(script : " sed -n '/{.*}/!p' ${ HOME} /gfs/ci/cases/pr/${ Case} .yaml > ${ HOME} /gfs/ci/cases/pr/${ Case} .yaml.tmp" , returnStatus : true )
124
+ sh(script : " sed -n '/{.*}/!p' ${ HOME} /gfs/ci/cases/pr/${ Case} .yaml > ${ HOME} /gfs/ci/cases/pr/${ Case} .yaml.tmp" )
119
125
def yaml_case = readYaml file : " ${ HOME} /gfs/ci/cases/pr/${ Case} .yaml.tmp"
120
126
system = yaml_case. experiment. system
121
127
def HOMEgfs = " ${ HOME} /${ system} " // local HOMEgfs is used to populate the XML on per system basis
122
128
env. RUNTESTS = " ${ HOME} /RUNTESTS"
123
- sh(script : " ${ HOMEgfs} /ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${ HOMEgfs} /ci/cases/pr/${ Case} .yaml" , returnStatus : true )
129
+ sh(script : " ${ HOMEgfs} /ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${ HOMEgfs} /ci/cases/pr/${ Case} .yaml" )
124
130
}
125
131
}
126
132
}
@@ -130,16 +136,27 @@ pipeline {
130
136
HOMEgfs = " ${ HOME} /gfs" // common HOMEgfs is used to launch the scripts that run the experiments
131
137
ws(HOMEgfs ) {
132
138
pslot = sh(script : " ${ HOMEgfs} /ci/scripts/utils/ci_utils_wrapper.sh get_pslot ${ HOME} /RUNTESTS ${ Case} " , returnStdout : true ). trim()
133
- pullRequest. comment(" **Running** experiment: ${ Case} on ${ Machine} <br>With the experiment in directory:<br>`${ HOME} /RUNTESTS/${ pslot} `" )
134
- try {
135
- sh(script : " ${ HOMEgfs} /ci/scripts/run-check_ci.sh ${ HOME} ${ pslot} " , returnStatus : true )
136
- } catch (Exception e) {
139
+ // pullRequest.comment("**Running** experiment: ${Case} on ${Machine}<br>With the experiment in directory:<br>`${HOME}/RUNTESTS/${pslot}`")
140
+ err = sh(script : " ${ HOMEgfs} /ci/scripts/run-check_ci.sh ${ HOME} ${ pslot} " )
141
+ if (err != 0 ) {
137
142
pullRequest. comment(" **FAILURE** running experiment: ${ Case} on ${ Machine} " )
143
+ sh(script : " ${ HOMEgfs} /ci/scripts/utils/ci_utils_wrapper.sh cancel_all_batch_jobs ${ HOME} /RUNTESTS" )
144
+ ws(HOME ) {
145
+ if (fileExists(' RUNTESTS/error.logs' )) {
146
+ def fileContent = readFile ' RUNTESTS/error.logs'
147
+ def lines = fileContent. readLines()
148
+ for (line in lines) {
149
+ echo " archiving: ${ line} "
150
+ archiveArtifacts artifacts : " ${ line} " , fingerprint : true
151
+ }
152
+ }
153
+ }
138
154
error(" Failed to run experiments ${ Case} on ${ Machine} " )
139
155
}
140
- pullRequest. comment(" **SUCCESS** running experiment: ${ Case} on ${ Machine} " )
156
+ // pullRequest.comment("**SUCCESS** running experiment: ${Case} on ${Machine}")
141
157
}
142
158
}
159
+
143
160
}
144
161
}
145
162
}
@@ -175,14 +192,6 @@ pipeline {
175
192
def timestamp = new Date (). format(' MM dd HH:mm:ss' , TimeZone . getTimeZone(' America/New_York' ))
176
193
pullRequest. comment(" **CI FAILED** ${ Machine} at ${ timestamp} <br>Built and ran in directory `${ HOME} `" )
177
194
}
178
- if (fileExists(' ${HOME}/RUNTESTS/ci.log' )) {
179
- def fileContent = readFile ' ${HOME}/RUNTESTS/ci.log'
180
- fileContent. eachLine { line ->
181
- if (line. contains(' .log' )) {
182
- archiveArtifacts artifacts : " ${ line} " , fingerprint : true
183
- }
184
- }
185
- }
186
195
}
187
196
}
188
197
}
0 commit comments