[JIRA] (JENKINS-50194) Anonymous and child builds
Title: Message Title Matvey Kondratev updated an issue Jenkins / JENKINS-50194 Anonymous and child builds Change By: Matvey Kondratev i have job1 with Jenkinsfile (example):{code:java}#!groovynode('master') {try {stage('prepare') {}stage('check playbook') {}stage('deploy') {}stage('cleanup') {currentBuild.result = 'SUCCESS'deleteDir()build job: 'job2', wait: false}} catch(exc) {currentBuild.result = 'FAILURE'deleteDir()throw(exc)} finally {}}{code}and job2 with Jenkinsfile:{code:java}#!groovynode('master') {...stage('jira update') {withEnv(['JIRA_SITE=LOCAL']) {version = [:]lastComment.eachMatch("(TEST)-[0-9]+") {a -> version[a[1]] = '';}version.each {projectKey, y -> println "project - $projectKey"def testVersion = [ name: nextTag, released: false, description: "${nextTag}", project: projectKey ]def result = jiraNewVersion version: testVersionversion[projectKey] = result.data}lastComment.eachMatch("(TEST)-[0-9]+") {a -> issueKey=a[0]; projectKey=a[1];try {def newVersion = version[projectKey]def testIssue = [fields: [fixVersions: [newVersion] ]]def editRes = jiraEditIssue idOrKey: issueKey, issue: testIssueprintln "version - $editRes"} catch(err) {echo "version error - $err"}try {def transitionInput = [transition: [id: 751]]def transRes = jiraTransitionIssue idOrKey: issueKey, input: transitionInputprintln "transition - $transRes"} catch(err) {echo "transition error - $err"}try {jiraAddComment idOrKey: issueKey, comment: "Success"} catch(err) {echo "comment error - $err"...}{code}If i start job2 manual (Build now) in JIRA issue:{code:java}Automatically created by: Matvey Kondratev from Build URL{code}If job1-> job2:{code:java}Automatically created by: [~anonymous] from Build URL{code} Maybe bug?{code:java}/*** Return the current build user.** @param causes build causes.* @return user name.*/protected static String prepareBuildUser(List causes) {String buildUser = "anonymous";if (causes != null && causes.size() > 0) {if (causes.get(0) instanceof UserIdCause) {buildUser = ((UserIdCause) causes.get(0)).getUserId();} else if (causes.get(0) instanceof UpstreamCause) {List upstreamCauses = ((UpstreamCause) causes.get(0)).getUpstreamCauses();prepareBuildUser(upstreamCauses);}}return Util.fixEmpty(buildUser) == null ? "anonymous" : buildUser;}{code}
[JIRA] (JENKINS-50194) Anonymous and child builds
Title: Message Title Matvey Kondratev updated an issue Jenkins / JENKINS-50194 Anonymous and child builds Change By: Matvey Kondratev i have job1 with Jenkinsfile (example):{code:java}#!groovynode('master') {try {stage('prepare') {}stage('check playbook') {}stage('deploy') {}stage('cleanup') {currentBuild.result = 'SUCCESS'deleteDir()build job: 'job2', wait: false}} catch(exc) {currentBuild.result = 'FAILURE'deleteDir()throw(exc)} finally {}}{code}and job2 with Jenkinsfile:{code:java}#!groovynode('master') {...stage('jira update') {withEnv(['JIRA_SITE=LOCAL']) {version = [:]lastComment.eachMatch("(TEST)-[0-9]+") {a -> version[a[1]] = '';}version.each {projectKey, y -> println "project - $projectKey"def testVersion = [ name: nextTag, released: false, description: "${nextTag}", project: projectKey ]def result = jiraNewVersion version: testVersionversion[projectKey] = result.data}lastComment.eachMatch("(TEST)-[0-9]+") {a -> issueKey=a[0]; projectKey=a[1];try {def newVersion = version[projectKey]def testIssue = [fields: [fixVersions: [newVersion] ]]def editRes = jiraEditIssue idOrKey: issueKey, issue: testIssueprintln "version - $editRes"} catch(err) {echo "version error - $err"}try {def transitionInput = [transition: [id: 751]]def transRes = jiraTransitionIssue idOrKey: issueKey, input: transitionInputprintln "transition - $transRes"} catch(err) {echo "transition error - $err"}try {jiraAddComment idOrKey: issueKey, comment: "Success"} catch(err) {echo "comment error - $err"...}{code} When If i start job2 manual (Build now) in JIRA issue:{code:java}Automatically created by: Matvey Kondratev from Build URL{code} When If job1 start -> job2:{code:java}Automatically created by: [~anonymous] from Build URL{code} Add Comment
[JIRA] (JENKINS-50194) Anonymous and child builds
Title: Message Title Matvey Kondratev updated an issue Jenkins / JENKINS-50194 Anonymous and child builds Change By: Matvey Kondratev i have job1 with Jenkinsfile (example):{code:java}#!groovynode('master') {try {stage('prepare') {}stage('check playbook') {}stage('deploy') {}stage('cleanup') {currentBuild.result = 'SUCCESS'deleteDir()build job: 'job2', wait: false}} catch(exc) {currentBuild.result = 'FAILURE'deleteDir()throw(exc)} finally {}}{code}and job2 with Jenkinsfile:{code:java}#!groovynode('master') {...stage('jira update') {withEnv(['JIRA_SITE=LOCAL']) {version = [:]lastComment.eachMatch("(TEST)-[0-9]+") {a -> version[a[1]] = '';}version.each {projectKey, y -> println "project - $projectKey"def testVersion = [ name: nextTag, released: false, description: "${nextTag}", project: projectKey ]def result = jiraNewVersion version: testVersionversion[projectKey] = result.data}lastComment.eachMatch("(TEST)-[0-9]+") {a -> issueKey=a[0]; projectKey=a[1];try {def newVersion = version[projectKey]def testIssue = [fields: [fixVersions: [newVersion] ]]def editRes = jiraEditIssue idOrKey: issueKey, issue: testIssueprintln "version - $editRes"} catch(err) {echo "version error - $err"}try {def transitionInput = [transition: [id: 751]]def transRes = jiraTransitionIssue idOrKey: issueKey, input: transitionInputprintln "transition - $transRes"} catch(err) {echo "transition error - $err"}try {jiraAddComment idOrKey: issueKey, comment: "Success"} catch(err) {echo "comment error - $err"...}{code}When job2 i start job2 manual (Build now) in JIRA issue:{code:java}Automatically created by: Matvey Kondratev from Build URL{code}When job1 start job2:{code:java}Automatically created by: [~anonymous] from Build URL{code} Add Comment
[JIRA] (JENKINS-50194) Anonymous and child builds
Title: Message Title Matvey Kondratev updated an issue Jenkins / JENKINS-50194 Anonymous and child builds Change By: Matvey Kondratev i have job1 with Jenkinsfile (example):{code:java}#!groovynode('master') {try {stage('prepare') {}stage('check playbook') {}stage('deploy') {}stage('cleanup') {currentBuild.result = 'SUCCESS'deleteDir()build job: ' regress job2 ', wait: false}} catch(exc) {currentBuild.result = 'FAILURE'deleteDir()throw(exc)} finally {}}{code}and job2 with Jenkinsfile:{code:java}stage('jira update') {withEnv(['JIRA_SITE=LOCAL']) {version = [:]lastComment.eachMatch("(TEST)-[0-9]+") {a -> version[a[1]] = '';}version.each {projectKey, y -> println "project - $projectKey"def testVersion = [ name: nextTag, released: false, description: "${nextTag}", project: projectKey ]def result = jiraNewVersion version: testVersionversion[projectKey] = result.data}lastComment.eachMatch("(TEST)-[0-9]+") {a -> issueKey=a[0]; projectKey=a[1];try {def newVersion = version[projectKey]def testIssue = [fields: [fixVersions: [newVersion] ]]def editRes = jiraEditIssue idOrKey: issueKey, issue: testIssueprintln "version - $editRes"} catch(err) {echo "version error - $err"}try {def transitionInput = [transition: [id: 751]]def transRes = jiraTransitionIssue idOrKey: issueKey, input: transitionInputprintln "transition - $transRes"} catch(err) {echo "transition error - $err"}try {jiraAddComment idOrKey: issueKey, comment: "Success"} catch(err) {echo "comment error - $err"{code}When job2 start manual (Build now) in JIRA issue:{code:java}Automatically created by: Matvey Kondratev from Build URL{code}When job1 start job2:{code:java}Automatically created by: [~anonymous] from Build URL{code} Add Comment
[JIRA] (JENKINS-50194) Anonymous and child builds
Title: Message Title Matvey Kondratev updated an issue Jenkins / JENKINS-50194 Anonymous and child builds Change By: Matvey Kondratev i have job1 with Jenkinsfile (example):{code:java}#!groovynode('master') {try {stage('prepare') {}stage('check playbook') {}stage('deploy') {}stage('cleanup') {currentBuild.result = 'SUCCESS'deleteDir()build job: 'job2', wait: false}} catch(exc) {currentBuild.result = 'FAILURE'deleteDir()throw(exc)} finally {}}{code}and job2 with Jenkinsfile:{code:java} #!groovynode('master') {... stage('jira update') {withEnv(['JIRA_SITE=LOCAL']) {version = [:]lastComment.eachMatch("(TEST)-[0-9]+") {a -> version[a[1]] = '';}version.each {projectKey, y -> println "project - $projectKey"def testVersion = [ name: nextTag, released: false, description: "${nextTag}", project: projectKey ]def result = jiraNewVersion version: testVersionversion[projectKey] = result.data}lastComment.eachMatch("(TEST)-[0-9]+") {a -> issueKey=a[0]; projectKey=a[1];try {def newVersion = version[projectKey]def testIssue = [fields: [fixVersions: [newVersion] ]]def editRes = jiraEditIssue idOrKey: issueKey, issue: testIssueprintln "version - $editRes"} catch(err) {echo "version error - $err"}try {def transitionInput = [transition: [id: 751]]def transRes = jiraTransitionIssue idOrKey: issueKey, input: transitionInputprintln "transition - $transRes"} catch(err) {echo "transition error - $err"}try {jiraAddComment idOrKey: issueKey, comment: "Success"} catch(err) {echo "comment error - $err" ...} {code}When job2 start manual (Build now) in JIRA issue:{code:java}Automatically created by: Matvey Kondratev from Build URL{code}When job1 start job2:{code:java}Automatically created by: [~anonymous] from Build URL{code} Add Comment
[JIRA] (JENKINS-50194) Anonymous and child builds
Title: Message Title Matvey Kondratev updated an issue Jenkins / JENKINS-50194 Anonymous and child builds Change By: Matvey Kondratev i have job1 with Jenkinsfile (example):{code:java}#!groovynode('master') {try {stage('prepare') {}stage('check playbook') {}stage('deploy') {}stage('cleanup') {currentBuild.result = 'SUCCESS'deleteDir()build job: 'regress', wait: false}} catch(exc) {currentBuild.result = 'FAILURE'deleteDir()throw(exc)} finally {}}{code}and job2 with Jenkinsfile:{code:java}stage('jira update') {withEnv(['JIRA_SITE=LOCAL']) {version = [:]lastComment.eachMatch("(TEST)-[0-9]+") {a -> version[a[1]] = '';}version.each {projectKey, y -> println "project - $projectKey"def testVersion = [ name: nextTag, released: false, description: "${nextTag}", project: projectKey ]def result = jiraNewVersion version: testVersionversion[projectKey] = result.data}lastComment.eachMatch("(TEST)-[0-9]+") {a -> issueKey=a[0]; projectKey=a[1];try {def newVersion = version[projectKey]def testIssue = [fields: [fixVersions: [newVersion] ]]def editRes = jiraEditIssue idOrKey: issueKey, issue: testIssueprintln "version - $editRes"} catch(err) {echo "version error - $err"}try {def transitionInput = [transition: [id: 751]]def transRes = jiraTransitionIssue idOrKey: issueKey, input: transitionInputprintln "transition - $transRes"} catch(err) {echo "transition error - $err"}try {jiraAddComment idOrKey: issueKey, comment: "Success"} catch(err) {echo "comment error - $err"{code}When job2 start manual (Build now) in JIRA issue: {code:java}Automatically created by: Matvey Kondratev from Build URL{code}When job1 start job2:{code:java}Automatically created by: [~anonymous] from Build URL{code} Add Comment
[JIRA] (JENKINS-50194) Anonymous and child builds
Title: Message Title Matvey Kondratev updated an issue Jenkins / JENKINS-50194 Anonymous and child builds Change By: Matvey Kondratev i have job1 with Jenkinsfile (example):{code:java}#!groovynode('master') {try {stage('prepare') {}stage('check playbook') {}stage('deploy') {}stage('cleanup') {currentBuild.result = 'SUCCESS'deleteDir()build job: 'regress', wait: false}} catch(exc) {currentBuild.result = 'FAILURE'deleteDir()throw(exc)} finally {}}{code}and job2 with Jenkinsfile:{code:java}stage('jira update') {withEnv(['JIRA_SITE=LOCAL']) {version = [:]lastComment.eachMatch("(TEST)-[0-9]+") {a -> version[a[1]] = '';}version.each {projectKey, y -> println "project - $projectKey"def testVersion = [ name: nextTag, released: false, description: "${nextTag}", project: projectKey ]def result = jiraNewVersion version: testVersionversion[projectKey] = result.data}lastComment.eachMatch("(TEST)-[0-9]+") {a -> issueKey=a[0]; projectKey=a[1];try {def newVersion = version[projectKey]def testIssue = [fields: [fixVersions: [newVersion] ]]def editRes = jiraEditIssue idOrKey: issueKey, issue: testIssueprintln "version - $editRes"} catch(err) {echo "version error - $err"}try {def transitionInput = [transition: [id: 751]]def transRes = jiraTransitionIssue idOrKey: issueKey, input: transitionInputprintln "transition - $transRes"} catch(err) {echo "transition error - $err"}try {jiraAddComment idOrKey: issueKey, comment: "Success"} catch(err) {echo "comment error - $err"{code} When job2 start manual (Build now) in JIRA issue: Add Comment
[JIRA] (JENKINS-50194) Anonymous and child builds
Title: Message Title Matvey Kondratev created an issue Jenkins / JENKINS-50194 Anonymous and child builds Issue Type: Bug Assignee: Naresh Rayapati Components: jira-steps-plugin Created: 2018-03-15 13:19 Priority: Minor Reporter: Matvey Kondratev i have job1 with Jenkinsfile (example): #!groovy node('master') { try { stage('prepare') { } stage('check playbook') { } stage('deploy') { } stage('cleanup') { currentBuild.result = 'SUCCESS' deleteDir() build job: 'regress', wait: false } } catch(exc) { currentBuild.result = 'FAILURE' deleteDir() throw(exc) } finally { } } and job2 with Jenkinsfile: stage('jira update') { withEnv(['JIRA_SITE=LOCAL']) { version = [:] lastComment.eachMatch("(TEST)-[0-9]+") { a -> version[a[1]] = ''; } version.each { projectKey, y -> println "project - $projectKey" def testVersion = [ name: nextTag, released: false, description: "${nextTag}", project: projectKey ] def result = jiraNewVersion version: testVersion version[projectKey] = result.data } lastComment.eachMatch("(TEST)-[0-9]+") { a -> issueKey=a[0]; projectKey=a[1]; try { def newVersion = version[projectKey] def testIssue = [fields: [fixVersions: [newVersion] ]] def editRes = jiraEditIssue idOrKey: issueKey, issue: testIssue println "version - $editRes" } catch(err) { echo "version error - $err" } try { def transitionInput = [transition: [id: 751]] def transRes = jiraTransitionIssue idOrKey: issueKey, input: transitionInput println "transition - $transRes" } catch(err) { echo "transition error - $err" }