modifica preliminare jenkinsfile x versione NEXT

This commit is contained in:
Samuele Locatelli
2021-08-03 13:15:45 +02:00
parent a87a719879
commit 8204181b44
Vendored
+64 -30
View File
@@ -9,11 +9,8 @@ pipeline {
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=769']) {
// env.versionNumber = VersionNumber(versionNumberString : '3.4.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '3.4.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'
}
env.versionNumber = VersionNumber(versionNumberString : '3.5.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILD_DATE_FORMATTED, "ddHH"}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'
}
script {
currentBuild.displayName = "${env.versionNumber}"
@@ -37,6 +34,7 @@ pipeline {
bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
// checkout NuGet in file sorgente!!!
fixNuget("${WORKSPACE}\\IOB-WIN.sln")
fixNuget("${WORKSPACE}\\IOB-WIN-NEXT.sln")
}
script {
if (env.BRANCH_NAME == "develop") {
@@ -45,6 +43,10 @@ pipeline {
// BUILD!
bat "\"${tool 'MSBuild-16.0'}\" IOB-WIN/IOB-WIN.csproj -target:Build /p:Configuration=Release /p:Platform=\"x86\" /p:OutputPath=bin/ /m"
},
IOB_WIN_NEXT: {
// BUILD!
bat "\"${tool 'MSBuild-16.0'}\" IOB-WIN-NEXT/IOB-WIN-NEXT.csproj -target:Build /p:Configuration=Release /p:Platform=\"x86\" /p:OutputPath=bin/ /m"
},
IOB_MAN: {
// BUILD!
bat "\"${tool 'MSBuild-16.0'}\" IOB-MAN/IOB-MAN.csproj -target:Build /p:Configuration=Release /p:Platform=\"x86\" /p:OutputPath=bin/ /m"
@@ -72,6 +74,7 @@ pipeline {
bat "e:\\fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
// checkout NuGet in file sorgente!!!
fixNuget("${WORKSPACE}\\IOB-WIN.sln")
fixNuget("${WORKSPACE}\\IOB-WIN-NEXT.sln")
}
// a seconda del branch decido cosa e come compilare e caricare...
script {
@@ -83,6 +86,7 @@ pipeline {
else if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME.contains("master") ) {
// BUILD!
bat "\"${tool 'MSBuild-16.0'}\" IOB-WIN/IOB-WIN.csproj -target:Build /p:Configuration=Release /p:Platform=\"x86\" /p:OutputPath=bin/ /m"
bat "\"${tool 'MSBuild-16.0'}\" IOB-WIN-NEXT/IOB-WIN-NEXT.csproj -target:Build /p:Configuration=Release /p:Platform=\"x86\" /p:OutputPath=bin/ /m"
}
else
{
@@ -118,35 +122,43 @@ pipeline {
}
// procedo solo se NON si tratta di commit in ramo DOCUMentazione...
else if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME.contains("master") ) {
def now = new Date()
def anno = now.format("yyyy", TimeZone.getTimeZone('UTC'))
// elimino files conf personalizzata per ogni install...
bat "RD /S /Q IOB-WIN\\bin\\DATA"
// manifest.xml: aggiorno versNumber ed URL del branch di update...
bat "e:\\fart.exe IOB-WIN\\Resources\\manifest.xml 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
bat "e:\\fart.exe IOB-WIN\\Resources\\manifest.xml {{BRANCHNAME}} ${env.BRANCH_NAME} || EXIT /B 0"
bat "e:\\fart.exe IOB-WIN\\Resources\\ChangeLog.html {{CURRENT-REL}} ${env.versionNumber} || EXIT /B 0"
bat "e:\\fart.exe IOB-WIN\\Resources\\ChangeLog.html {{CURR-YEAR}} ${anno} || EXIT /B 0"
//bat "e:\\fart.exe IOB-WIN\\Resources\\ChangeLog.html {{LAST-CHANGES}} ${getChangeString()} || EXIT /B 0"
//writeFile file: 'changeLog.log', text: "${getChangeString()}"
// 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'
fixResources("IOB-WIN")
fixResources("IOB-WIN-NEXT")
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}\\ "
// def now = new Date()
// def anno = now.format("yyyy", TimeZone.getTimeZone('UTC'))
// // elimino files conf personalizzata per ogni install...
// bat "RD /S /Q IOB-WIN\\bin\\DATA"
// // manifest.xml: aggiorno versNumber ed URL del branch di update...
// bat "e:\\fart.exe IOB-WIN\\Resources\\manifest.xml 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
// bat "e:\\fart.exe IOB-WIN\\Resources\\manifest.xml {{BRANCHNAME}} ${env.BRANCH_NAME} || EXIT /B 0"
// bat "e:\\fart.exe IOB-WIN\\Resources\\ChangeLog.html {{CURRENT-REL}} ${env.versionNumber} || EXIT /B 0"
// bat "e:\\fart.exe IOB-WIN\\Resources\\ChangeLog.html {{CURR-YEAR}} ${anno} || 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 "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}\\ "
// elimino files inutili di resources e pubblico
bat "RD /S /Q IOB-WIN\\Resources"
bat "RD /S /Q IOB-WIN-NEXT\\Resources"
// elimino vecchio zip...
bat "RD /S /Q Releases\\${env.BRANCH_NAME}\\ || EXIT /B 0"
// Compressione in .zip dell'installer...
bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip ${WORKSPACE}\\IOB-WIN\\bin\\*"
bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN-NEXT.zip ${WORKSPACE}\\IOB-WIN-NEXT\\bin\\*"
// salvo copia della versione in staging...
bat "xcopy /y Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip E:\\Staging\\byProd\\MP\\${env.BRANCH_NAME}\\IOB-WIN\\${env.versionNumber}\\ "
bat "xcopy /y Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN-NEXT.zip E:\\Staging\\byProd\\MP\\${env.BRANCH_NAME}\\IOB-WIN-NEXT\\${env.versionNumber}\\ "
// copio in area WebDeploy
bat "xcopy /y Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip c:\\inetpub\\wwwroot\\SWS\\MAPO\\IOB-WIN\\${env.BRANCH_NAME}\\ "
bat "xcopy /y Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN-NEXT.zip c:\\inetpub\\wwwroot\\SWS\\MAPO\\IOB-WIN-NEXT\\${env.BRANCH_NAME}\\ "
// fix classificazione x develop/master...
if (env.BRANCH_NAME == "develop")
@@ -174,6 +186,11 @@ pipeline {
classifier: "",
// classifier: "${env.classifier}",
file: "Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip",
type: 'zip'],
[artifactId: 'IOB-WIN-NEXT',
classifier: "",
// classifier: "${env.classifier}",
file: "Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN-NEXT.zip",
type: 'zip']
]
)
@@ -188,15 +205,12 @@ pipeline {
}
post {
success {
//sendEmail("Successful")
sendSlack("Successful", "good")
}
failure {
//sendEmail("Failed")
sendSlack("Failed", "danger")
}
unstable {
//sendEmail("Unstable")
sendSlack("Unstable", "warning")
}
}
@@ -224,11 +238,31 @@ def getChangeString() {
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")
def fixResources(basePath){
def now = new Date()
def anno = now.format("yyyy", TimeZone.getTimeZone('UTC'))
// elimino files conf personalizzata per ogni install...
bat "RD /S /Q ${basePath}}\\bin\\DATA"
// manifest.xml: aggiorno versNumber ed URL del branch di update...
bat "e:\\fart.exe ${basePath}\\Resources\\manifest.xml 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
bat "e:\\fart.exe ${basePath}\\Resources\\manifest.xml {{BRANCHNAME}} ${env.BRANCH_NAME} || EXIT /B 0"
bat "e:\\fart.exe ${basePath}\\Resources\\ChangeLog.html {{CURRENT-REL}} ${env.versionNumber} || EXIT /B 0"
bat "e:\\fart.exe ${basePath}\\Resources\\ChangeLog.html {{CURR-YEAR}} ${anno} || EXIT /B 0"
// copio ed esporto in IIS02 i vari files .xml, .html, .zip
if(basePath == "IOB-WIN")
{
powershell '(Get-Content IOB-WIN\\Resources\\ChangeLog.html) | ForEach-Object { $_ -replace \"{{LAST-CHANGES}}\", \"${getChangeString()}\" } | Set-Content IOB-WIN\\Resources\\ChangeLog.html'
}
else if (basePath == "IOB-WIN")
{
powershell '(Get-Content IOB-WIN-NEXT\\Resources\\ChangeLog.html) | ForEach-Object { $_ -replace \"{{LAST-CHANGES}}\", \"${getChangeString()}\" } | Set-Content IOB-WIN-NEXT\\Resources\\ChangeLog.html'
}
bat "xcopy /y ${basePath}\\Resources\\manifest.xml c:\\inetpub\\wwwroot\\SWS\\MAPO\\${basePath}\\${env.BRANCH_NAME}\\ "
bat "xcopy /y ${basePath}\\Resources\\ChangeLog.html c:\\inetpub\\wwwroot\\SWS\\MAPO\\${basePath}\\${env.BRANCH_NAME}\\ "
bat "xcopy /y ${basePath}\\Resources\\logoSteamware.png c:\\inetpub\\wwwroot\\SWS\\MAPO\\${basePath}\\${env.BRANCH_NAME}\\ "
}
// Funzione x invio slack