Fix warnings spam
Task: PRODX-54485
Change-Id: I85e65616c4f2d7d85ca44223510cd5ab8dec68f1
diff --git a/src/com/mirantis/mk/JenkinsUtils.groovy b/src/com/mirantis/mk/JenkinsUtils.groovy
index c993999..c4bebed 100644
--- a/src/com/mirantis/mk/JenkinsUtils.groovy
+++ b/src/com/mirantis/mk/JenkinsUtils.groovy
@@ -14,7 +14,7 @@
* @return list of groups [String]
*/
def userGroups(username) {
- res = []
+ def res = []
def authorities = Jenkins.instance.securityRealm.loadUserByUsername(username).getAuthorities()
authorities.each {
res.add(it.toString())
@@ -48,7 +48,7 @@
* @return username String
*/
def currentUsername() {
- username = ''
+ def username = ''
wrap([$class: 'BuildUser']) {
username = env.BUILD_USER_ID ?: 'jenkins'
}
@@ -65,7 +65,7 @@
* @return boolean result
*/
def currentUserInGroups(groups) {
- username = currentUsername()
+ def username = currentUsername()
return userInGroups(username, groups)
}
@@ -75,7 +75,7 @@
* @return boolean result
*/
def currentUserInGroup(group) {
- username = currentUsername()
+ def username = currentUsername()
return userInGroup(username, group)
}
@@ -250,18 +250,18 @@
acceptedStatuses.add('NOT_BUILT')
}
- depList = []
+ ArrayList depList = []
if (env.TRIGGER_DEPENDENCY_KEYS){
common.infoMsg('Job may depends on parent jobs, check if dependency jobs exist...')
- depKeys = env.TRIGGER_DEPENDENCY_KEYS.toString()
+ String depKeys = env.TRIGGER_DEPENDENCY_KEYS.toString()
depList = depKeys.split()
if (depList){
common.infoMsg("Here is dependency jobs-list: ${depList} , accepted job statuses are: ${acceptedStatuses}")
for (String item : depList) {
- prjName = item.replaceAll('[^a-zA-Z0-9]+', '_')
- triggerResult = 'TRIGGER_' + prjName.toUpperCase() + '_BUILD_RESULT'
- triggerJobName = 'TRIGGER_' + prjName.toUpperCase() + '_BUILD_NAME'
- triggerJobBuild = 'TRIGGER_' + prjName.toUpperCase() + '_BUILD_NUMBER'
+ String prjName = item.replaceAll('[^a-zA-Z0-9]+', '_')
+ String triggerResult = 'TRIGGER_' + prjName.toUpperCase() + '_BUILD_RESULT'
+ String triggerJobName = 'TRIGGER_' + prjName.toUpperCase() + '_BUILD_NAME'
+ String triggerJobBuild = 'TRIGGER_' + prjName.toUpperCase() + '_BUILD_NUMBER'
if (!acceptedStatuses.contains(env.getProperty(triggerResult))) {
msg = "Dependency job ${env.getProperty(triggerJobName)} #${env.getProperty(triggerJobBuild)} is ${env.getProperty(triggerResult)}"
common.warningMsg(msg)
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index d380675..fdf1040 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -1299,7 +1299,7 @@
// generate a map of nodes matching other criteria
for (node in freeNodes) {
// sameJobExecutors is the number of executors running the same job as the calling one
- sameJobExecutors = node.getExecutors() // get all executors
+ Integer sameJobExecutors = node.getExecutors() // get all executors
.collect { executor -> executor.getCurrentExecutable() } // get running "threads"
.collect { thread -> thread?.displayName } // filter job names from threads
.minus(null) // null = empty executors, remove them from the list
@@ -1307,7 +1307,7 @@
.size()
// calculate busy executors, we don't want to count "sameJobExecutors" twice
- totalBusyExecutors = node.countBusy() - sameJobExecutors
+ Integer totalBusyExecutors = node.countBusy() - sameJobExecutors
// generate the final map which contains nodes matching criteria with their load score
// builds of the same jobs have x10 score, all others x1
nodesMap += ["${node.getName()}" : sameJobExecutors * 10 + totalBusyExecutors]