Skip to content

Commit 95ac6eb

Browse files
committed
SRE-2932 Fix notifyBrokenBranch
vars/notifyBrokenBranch.grooy: This routine was doing a lookup of the enviroment Map which is not allowed in the pipeline-lib sandboxed operation. vars/DocOnlyChange.groovy: Missing a String declaration that was causing log noise. Signed-off-by: John E. Malmberg <[email protected]>
1 parent df95fda commit 95ac6eb

File tree

3 files changed

+42
-21
lines changed

3 files changed

+42
-21
lines changed

vars/docOnlyChange.groovy

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ boolean call(String target_branch) {
1717
if (cachedCommitPragma('Doc-only').toLowerCase() == 'false') {
1818
return false
1919
}
20+
String script
2021
if (fileExists('ci/doc_only_change.sh')) {
2122
script = 'CHANGE_ID=' + env.CHANGE_ID +
2223
' TARGET_BRANCH=' + target_branch +

vars/notifyBrokenBranch.groovy

+25-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// vars/notifyBrokenBranch.groovy
2+
/* groovylint-disable VariableName */
23

34
/**
45
* notifyBrokenBranch.groovy
@@ -12,37 +13,47 @@
1213

1314
def call(Map config = [:]) {
1415

16+
String branches
1517
if (config['branches']) {
1618
branches = config['branches'].split()
1719
} else {
1820
branches = ["master"]
1921
}
2022

21-
if (!branches.contains(env.GIT_BRANCH)) {
23+
// Needed this as a work around that env['GIT_BRANCH'] is blacklisted
24+
// inside of pipeline-lib
25+
String git_branch = env.GIT_BRANCH
26+
27+
if (!branches.contains(git_branch)) {
2228
return
2329
}
2430

25-
emailextDaos body: env.GIT_BRANCH + ' is broken and you are one of the people\n' +
31+
emailextDaos body: git_branch + ' is broken and you are one of the people\n' +
2632
'who have committed to it since it was last successful. Please\n' +
27-
'investigate if your recent patch(es) to ' + env.GIT_BRANCH + '\n' +
33+
'investigate if your recent patch(es) to ' + git_branch + '\n' +
2834
'are responsible for breaking it.\n\n' +
2935
'See ' + env.BUILD_URL + ' for more details.',
3036
recipientProviders: [
3137
[$class: 'DevelopersRecipientProvider'],
3238
[$class: 'RequesterRecipientProvider']
3339
],
34-
subject: 'Build broken on ' + env.GIT_BRANCH,
40+
subject: 'Build broken on ' + git_branch,
3541
onPR: config['onPR']
3642

37-
def branch = env['GIT_BRANCH'].toUpperCase().replaceAll("-", "_")
38-
def watchers = env["DAOS_STACK_${branch}_WATCHER"]
39-
40-
if (watchers != "null") {
41-
emailextDaos body: env.GIT_BRANCH + ' is broken.\n\n' +
42-
'See ' + env.BUILD_URL + ' for more details.',
43-
to: watchers,
44-
subject: 'Build broken on ' + env.GIT_BRANCH,
45-
onPR: config['onPR']
43+
String branch = git_branch.toUpperCase().replaceAll("-", "_")
44+
// This will need to be implemented in trusted-pipe-line lib eventually
45+
// as checking if environment variables exist is blacklisted in the
46+
// groovy sandbox.
47+
// for now we only have DAOS_STACK_MASTER_WATCHER
48+
// def watchers = env["DAOS_STACK_${branch}_WATCHER"]
49+
if (branch == 'MASTER') {
50+
String watchers = env.DAOS_STACK_MASTER_WATCHER
51+
if (watchers != "null") {
52+
emailextDaos body: git_branch + ' is broken.\n\n' +
53+
'See ' + env.BUILD_URL + ' for more details.',
54+
to: watchers,
55+
subject: 'Build broken on ' + git_branch,
56+
onPR: config['onPR']
57+
}
4658
}
47-
4859
}

vars/unitTest.groovy

+16-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* config['description'] Description to report for SCM status.
2727
* Default env.STAGE_NAME.
2828
*
29-
* config['failure_artifacts'] Failure aritfifacts to return.
29+
* config['failure_artifacts'] Failure artifacts to return.
3030
* Default env.STAGE_NAME.
3131
*
3232
* config['ignore_failure'] Ignore test failures. Default false.
@@ -43,10 +43,10 @@
4343
*
4444
* config['node_count'] Count of nodes that will actually be used
4545
* the test. Default will be based on the
46-
* enviroment variables for the stage.
46+
* environment variables for the stage.
4747
*
4848
* config['stashes'] List of stashes to use. Default will be
49-
* baed on the environment variables for the
49+
* based on the environment variables for the
5050
* stage.
5151
*
5252
* config['target'] Target distribution, such as 'centos7',
@@ -61,16 +61,16 @@
6161
* SSH_KEY_ARGS and NODELIST environment
6262
* variables set.
6363
*
64-
* config['timeout_time'] Timelimit for test run, not including
64+
* config['timeout_time'] Time limit for test run, not including
6565
* provisioning time.
6666
* Default is 120 Minutes.
6767
*
68-
* config['timeout_units'] Timelimit units. Default is minutes.
68+
* config['timeout_units'] Time limit units. Default is minutes.
6969
*
70-
* config['unstash_opt'] Unstash -opt-tar instead of -opt,
70+
* config['unstash_opt'] Un-stash -opt-tar instead of -opt,
7171
* default is false.
7272
*
73-
* config['unstash_tests'] Unstash -tests, default is true.
73+
* config['unstash_tests'] Un-stash -tests, default is true.
7474
*/
7575

7676
Map afterTest(Map config, Map testRunInfo) {
@@ -137,6 +137,15 @@ Map call(Map config = [:]) {
137137
}
138138
}
139139

140+
println("1 ###############################################")
141+
println(" unitTest - provisionNodes ")
142+
println("config = ${config}")
143+
println("nodelist = ${nodelist}")
144+
println("node_count = ${stage_info['node_count']}")
145+
println("ci_target = ${stage_info['ci_target']}")
146+
println("distro_version = ${stage_info['distro_version']}")
147+
println("inst_rpms = ${inst_rpms}")
148+
println("1 ###############################################")
140149
Map runData = provisionNodes(
141150
NODELIST: nodelist,
142151
node_count: stage_info['node_count'],

0 commit comments

Comments
 (0)