Commits

Lilian Y-Nhi Dinh authored 0d7e85acc43
SD-2011: SCES Jenkinsfile ret
No tags

cucumber/jenkins/Jenkinsfile.SCES

Modified
68 68
69 69 if (fileExists("cucumber/target/report.json")) {
70 70 step([$class: 'XrayImportBuilder',
71 71 serverInstance: '89d8e9d1-8aff-4f28-8830-5d1217f0d789',
72 72 projectKey: 'NRT',
73 73 endpointName: '/cucumber',
74 74 importFilePath: 'cucumber/target/report.json',
75 75 importToSameExecution: 'true',
76 76 testImportInfo: 'cucumber/jenkins/summary.json'
77 77 ])
78 -
79 - def log = currentBuild.rawBuild.getLog(2000000) //maxlines is the max of integers
80 - def pattern = /"testExecIssue":\{"id":"(\d+)","key":"[^"]+","self":"([^"]+)"\}/ //Looks for this pattern in the logs
81 -
78 + def log = currentBuild.rawBuild.getLog(2000000)
79 + def pattern = /"testExecIssue":\{"id":"(\d+)","key":"[^"]+","self":"([^"]+)"\}/
82 80
83 81 def testExecIssueSelfLink
84 82 for (String line : log) {
85 83 def matcher = (line =~ pattern)
86 84 if (matcher.find()) {
87 85 testExecIssueSelfLink = matcher.group(2)
88 86 println(testExecIssueSelfLink)
89 87 break
90 88 }
91 89 }
92 -
93 - //Curl to change summary
94 90 if(testExecIssueSelfLink != null){
95 91 withCredentials([[$class: 'UsernamePasswordMultiBinding',
96 92 credentialsId: "bb69c5ba-a22f-44e7-99fa-07f1975fa9a2",
97 93 usernameVariable: 'USER',
98 94 passwordVariable: 'PASSWORD']]) {
99 -
100 - def now = new Date().format("dd/MM/yyyy HH:mm", TimeZone.getTimeZone('CET'))
101 - sh(script: """curl -X PUT "${testExecIssueSelfLink}" -H "Content-Type: application/json" -u "${USER}:${PASSWORD}" -d '{"fields": {"summary": "${env.JOB_NAME} - ${now}"}}'""", returnStdout: true)
102 - }
95 +
96 + def now = new Date().format("dd/MM/yyyy HH:mm", TimeZone.getTimeZone('CET'))
97 +
98 + sh(script: """curl -X PUT "${testExecIssueSelfLink}" -H "Content-Type: application/json" -u "${USER}:${PASSWORD}" -d '{"fields": {"summary": "${env.JOB_NAME} - ${now}"}}'""", returnStdout: true)
99 + }
103 100 }
104 101 }
105 102 }
106 103 stage ('Clean') {
107 104 deleteDir()
108 105 }
109 106 }
110 107 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut