refresh jenkinsfile

This commit is contained in:
Samuele E. Locatelli
2017-11-08 09:41:46 +01:00
parent a5474d9715
commit 7cd193a041
Vendored
+49 -19
View File
@@ -257,16 +257,16 @@ pipeline {
writeFile file: 'MP-Tablet\\changeLog.log', text: "${getChangeString()}"
// bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\MP-Tablet\\ReleaseClienti\\Donati\" \"E:\\Staging\\byProd\\MP\\Donati\\MP-TAB\" "
// // bat "fart.exe IOB-WIN\\Resources\\ChangeLog.html {{LAST-CHANGES}} \"${getChangeString()}\" || EXIT /B 0"
// // copio ed esporto in IIS02 i vari files .xml, .html, .zip
// powershell '(Get-Content IOB-WIN\\Resources\\ChangeLog.html) | ForEach-Object { $_ -replace \"{{LAST-CHANGES}}\", \"${getChangeString()}\" } | Set-Content IOB-WIN\\Resources\\ChangeLog.html'
// bat "fart.exe MP-Tablet\\Resources\\ChangeLog.html {{LAST-CHANGES}} \"${getChangeString()}\" || EXIT /B 0"
// copio ed esporto in IIS02 i vari files .xml, .html, .zip
powershell '(Get-Content MP-Tablet\\Resources\\ChangeLog.html) | ForEach-Object { $_ -replace \"{{LAST-CHANGES}}\", \"${getChangeString()}\" } | Set-Content MP-Tablet\\Resources\\ChangeLog.html'
// bat "xcopy /y IOB-WIN\\Resources\\manifest.xml c:\\inetpub\\wwwroot\\SWS\\MAPO-IOB-WIN\\${env.BRANCH_NAME}\\ "
// bat "xcopy /y IOB-WIN\\Resources\\ChangeLog.html c:\\inetpub\\wwwroot\\SWS\\MAPO-IOB-WIN\\${env.BRANCH_NAME}\\ "
// bat "xcopy /y IOB-WIN\\Resources\\logoSteamware.png c:\\inetpub\\wwwroot\\SWS\\MAPO-IOB-WIN\\${env.BRANCH_NAME}\\ "
// bat "xcopy /y MP-Tablet\\Resources\\manifest.xml c:\\inetpub\\wwwroot\\SWS\\MAPO\TAB\\${env.BRANCH_NAME}\\ "
// bat "xcopy /y MP-Tablet\\Resources\\ChangeLog.html c:\\inetpub\\wwwroot\\SWS\\MAPO\TAB\\${env.BRANCH_NAME}\\ "
// bat "xcopy /y MP-Tablet\\Resources\\logoSteamware.png c:\\inetpub\\wwwroot\\SWS\\MAPO\TAB\\${env.BRANCH_NAME}\\ "
// // salvo copia della versione...
// bat "xcopy /y Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip E:\\Staging\\byProd\\MAPO-IOB-WIN\\${env.BRANCH_NAME}\\${env.versionNumber}\\ "
// bat "xcopy /y Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip E:\\Staging\\byProd\\MAPO\TAB\\${env.BRANCH_NAME}\\${env.versionNumber}\\ "
// // elimino files inutili di resources e pubblico
// bat "RD /S /Q IOB-WIN\\Resources"
@@ -283,17 +283,47 @@ pipeline {
}
}
post {
success {
mail to:"samuele@steamware.net", subject:"SUCCESS: ${currentBuild.fullDisplayName}", body: "Build passed."
}
failure {
mail to:"samuele@steamware.net", subject:"FAILURE: ${currentBuild.fullDisplayName}", body: "Build failed."
}
unstable {
mail to:"samuele@steamware.net", subject:"UNSTABLE: ${currentBuild.fullDisplayName}", body: "Build is unstable."
}
/*changed {
mail to:"samuele@steamware.net", subject:"CHANGED: ${currentBuild.fullDisplayName}", body: "Build status changed."
}*/
success {
// mail to:"samuele@steamware.net", subject:"SUCCESS: ${currentBuild.fullDisplayName}", body: "Build passed."
sendEmail("Successful")
}
failure {
// mail to:"samuele@steamware.net", subject:"FAILURE: ${currentBuild.fullDisplayName}", body: "Build failed."
sendEmail("Failed")
}
unstable {
// mail to:"samuele@steamware.net", subject:"UNSTABLE: ${currentBuild.fullDisplayName}", body: "Build is unstable."
sendEmail("Unstable")
}
}
}
@NonCPS
def getChangeString() {
MAX_MSG_LEN = 100
def changeString = ""
echo "Gathering SCM changes"
def changeLogSets = currentBuild.changeSets
for (int i = 0; i < changeLogSets.size(); i++) {
def entries = changeLogSets[i].items
for (int j = 0; j < entries.length; j++) {
def entry = entries[j]
truncated_msg = entry.msg.take(MAX_MSG_LEN)
changeString += " - ${truncated_msg} [${entry.author}]\n"
}
}
if (!changeString) {
changeString = " - Nessuna Modifica"
}
return changeString
}
def sendEmail(status) {
mail (
to: "$EMAIL_RECIPIENTS",
subject: "Build $BUILD_NUMBER - " + status + " ($JOB_NAME)",
body: "Modifiche:\n " + getChangeString() + "\n\n Verifica console output: $BUILD_URL/console" + "\n")
}