Skip to content

Commit bead7d4

Browse files
committed
WS-3330: Add post to teams and sonar cli upgrade.
1 parent 549ef52 commit bead7d4

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

CI.Jenkinsfile

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ node ("docker-light") {
2323

2424
nodeVersions.each { version ->
2525
if (version == "23") {
26+
sonarScannerVersion="6.2.1.4610-linux-x64"
2627
sonarExec="cd /root/ && \
27-
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.1.3023-linux.zip && \
28-
unzip -q sonar-scanner-cli-4.8.1.3023-linux.zip && \
29-
cd /source && \
30-
/root/sonar-scanner-4.8.1.3023-linux/bin/sonar-scanner ${mySonarOpts}"
28+
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${sonarScannerVersion}.zip && \
29+
unzip -q sonar-scanner-cli-${sonarScannerVersion}.zip && \
30+
cd /source && \
31+
/root/sonar-scanner-${sonarScannerVersion}/bin/sonar-scanner ${mySonarOpts}"
3132
} else {
3233
sonarExec="echo Skipping Sonar for this version."
3334
}
@@ -36,14 +37,26 @@ node ("docker-light") {
3637
--pull always \
3738
--volume ${sourceDir}:/source \
3839
node:${version} \
39-
sh -c \"cd /source && npm install && npx grunt && ${sonarExec} && chown -R 9960:9960 /source\""
40+
sh -c \"cd /source && \
41+
npm install && \
42+
npx grunt && \
43+
${sonarExec} && \
44+
chown -R 9960:9960 /source\""
4045
}
4146
}
4247
}
43-
}
44-
catch (e) {
48+
postToTeams(true)
49+
} catch (e) {
4550
currentBuild.result = "FAILED"
51+
postToTeams(false)
4652
throw e
4753
}
4854
}
49-
// todo post to teams
55+
56+
def postToTeams(boolean success) {
57+
def webhookUrl = "${env.TEAMS_PNC_JENKINS_WEBHOOK_URL}"
58+
def color = success ? "#00FF00" : "#FF0000"
59+
def status = success ? "SUCCESSFUL" : "FAILED"
60+
def message = "*" + status + ":* '${env.JOB_NAME}' - [${env.BUILD_NUMBER}] - ${env.BUILD_URL}"
61+
office365ConnectorSend(webhookUrl: webhookUrl, color: color, message: message, status: status)
62+
}

0 commit comments

Comments
 (0)