Modifica jenkinsfile x evitare compilazioni in ramo documentazione...

This commit is contained in:
Samuele E. Locatelli
2018-04-05 15:36:14 +02:00
parent a60751ba71
commit 8bd4d6b910
Vendored
+37 -32
View File
@@ -22,7 +22,7 @@ pipeline {
}
script {
currentBuild.displayName = "${env.versionNumber}"
if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME.contains("DEMO")) {
if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME.contains("DEMO") || env.BRANCH_NAME.contains("docum")) {
currentBuild.description = "TEST ${env.versionNumber}"
}
else {
@@ -48,14 +48,14 @@ pipeline {
bat "\"${tool 'MSBuild-14.0'}\" IOB-WIN/IOB-WIN.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
}
else {
echo 'NON faccio test di Build... x casi NON develop...'
echo 'NON faccio test di Build se non per BRANCH DEVELOP...'
}
}
}
}
stage('Test') {
steps {
echo 'Testing.. 2 be done...'
echo 'Testing.. 2 be done...'
}
}
stage('Deploy') {
@@ -63,40 +63,46 @@ pipeline {
steps {
// in primis compilo a seconda del branch... TUTTO tranne develop...
script {
// CAMBIO numero versione in file sorgente!!!
bat "fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
// restore nuget packages
bat "e:\\nuget.exe restore ${WORKSPACE}\\IOB-WIN.sln"
// BUILD!
bat "\"${tool 'MSBuild-14.0'}\" IOB-WIN/IOB-WIN.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
// procedo solo se NON si tratta di commit in ramo DOCUMentazione...
if (env.BRANCH_NAME != "docum") {
// CAMBIO numero versione in file sorgente!!!
bat "fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
// restore nuget packages
bat "e:\\nuget.exe restore ${WORKSPACE}\\IOB-WIN.sln"
// BUILD!
bat "\"${tool 'MSBuild-14.0'}\" IOB-WIN/IOB-WIN.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
}
}
// ora mi occupo delle operazioni di compressione e copia...
script {
// 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 "fart.exe IOB-WIN\\Resources\\manifest.xml 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
bat "fart.exe IOB-WIN\\Resources\\manifest.xml {{BRANCHNAME}} ${env.BRANCH_NAME} || EXIT /B 0"
bat "fart.exe IOB-WIN\\Resources\\ChangeLog.html {{CURRENT-REL}} ${env.versionNumber} || 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'
// procedo solo se NON si tratta di commit in ramo DOCUMentazione...
if (env.BRANCH_NAME != "docum") {
// 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 "fart.exe IOB-WIN\\Resources\\manifest.xml 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
bat "fart.exe IOB-WIN\\Resources\\manifest.xml {{BRANCHNAME}} ${env.BRANCH_NAME} || EXIT /B 0"
bat "fart.exe IOB-WIN\\Resources\\ChangeLog.html {{CURRENT-REL}} ${env.versionNumber} || 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'
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 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"
// 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\\*"
// 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}\\ "
// 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}\\ "
// elimino files inutili di resources e pubblico
bat "RD /S /Q IOB-WIN\\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\\*"
// 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}\\ "
// 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}\\ "
}
}
}
}
@@ -117,7 +123,6 @@ pipeline {
}
}
@NonCPS
def getChangeString() {
MAX_MSG_LEN = 100