Fix warnings spam
Task: PRODX-54485
Change-Id: Ic4868cc29435e4cd1533e737ce8eb8ca8fa27c13
diff --git a/src/com/mirantis/mcp/SlackNotification.groovy b/src/com/mirantis/mcp/SlackNotification.groovy
index 8aa0cfe..7f8ff75 100644
--- a/src/com/mirantis/mcp/SlackNotification.groovy
+++ b/src/com/mirantis/mcp/SlackNotification.groovy
@@ -42,8 +42,10 @@
def common = new com.mirantis.mk.Common()
- cred = common.getCredentialsById(credentialsId)
- hook_url_parsed = cred.getSecret().toString()
+ def cred = common.getCredentialsById(credentialsId)
+ def hook_url_parsed = cred.getSecret().toString()
+ String colorCode
+ String colorName
switch(buildStatusParam.toLowerCase()) {
case "success":
@@ -63,7 +65,7 @@
colorName = "grey"
}
- queryString = 'payload={' +
+ String queryString = 'payload={' +
"'text':'${buildStatusParam.toUpperCase()}: Job <${buildUrlParam}|${jobNameParam} [${buildNumberParam}]>\\n ${description}', " +
"'color':'${colorCode}'," +
"'pretext': '', " +
@@ -71,7 +73,6 @@
"'channel': '${channel}', " +
'}'
sendPostRequest(hook_url_parsed, queryString)
-
}
/*
diff --git a/src/com/mirantis/mk/Gerrit.groovy b/src/com/mirantis/mk/Gerrit.groovy
index cba856f..4627831 100644
--- a/src/com/mirantis/mk/Gerrit.groovy
+++ b/src/com/mirantis/mk/Gerrit.groovy
@@ -324,11 +324,12 @@
* '--current-patch-set' or '--comments' as a simple string
*/
def findGerritChange(credentialsId, LinkedHashMap gerritAuth, LinkedHashMap changeParams, String extraFlags = '', String sshOpts = '') {
- scriptText = """
+ def scriptText = """
ssh ${sshOpts} -p ${gerritAuth['PORT']} ${gerritAuth['USER']}@${gerritAuth['HOST']} \
gerrit query ${extraFlags} \
--format JSON \
"""
+ def jsonChange
changeParams.each {
scriptText += " ${it.key}:${it.value}"
}
diff --git a/src/com/mirantis/mk/Git.groovy b/src/com/mirantis/mk/Git.groovy
index eb08e7d..74571eb 100644
--- a/src/com/mirantis/mk/Git.groovy
+++ b/src/com/mirantis/mk/Git.groovy
@@ -64,6 +64,7 @@
* @param branch Branch desired to switch to
*/
def changeGitBranch(path, branch) {
+ def git_cmd
dir(path) {
git_cmd = sh (
script: "git checkout ${branch}",