pipeline { agent none stages { stage('Checkout') { agent any steps { /* build delle SteamWare libs! */ /*build 'SteamWare/SteamWareLib'*/ /* copio le libs...*/ // step([$class: 'CopyArtifact', fingerprintArtifacts: true, projectName: 'Steamware/SteamWareLib', selector: [$class: 'WorkspaceSelector'], target: '../Steamware/SteamWareLib']) /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { withEnv(['NEXT_BUILD_NUMBER=64']) { // env.versionNumber = VersionNumber(versionNumberString : '0.10.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '0.10.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN' } } script { currentBuild.displayName = "${env.versionNumber}" if (env.BRANCH_NAME == "develop" || env.BRANCH_NAME.contains("DEMO")) { currentBuild.description = "TEST ${env.versionNumber}" } else { currentBuild.description = "BUILD ${env.versionNumber}" } } /* CAMBIO numero versione in file sorgente!!! */ bat "fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" } } stage('Build') { agent any steps { script { // compilo installers in base al BRANCH del cliente... if (env.BRANCH_NAME == "develop") { // 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" } else { echo 'Nothing to Build...' } } } } stage('Test') { steps { echo 'Testing.. 2 be done...' } } stage('Deploy') { agent any 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" } // ora mi occupo delle operazioni di compressione e copia... script { // elimino files di conf personalizzata per ogni install... bat "RD /S /Q IOB-WIN\\bin\\DATA" // Compressione in .zip dell'installer... bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip ${WORKSPACE}\\IOB-WIN\\bin\\" // powershell -ExecutionPolicy Unrestricted -File file.ps1 // 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" // copio ed esporto in IIS02 i vari files .xml, .html, .zip 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 Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip c:\\inetpub\\wwwroot\\SWS\\MAPO-IOB-WIN\\${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}\\ " } } } // stage('Installers') { // agent any // steps { // script { // /* compilo installers in base al BRANCH del cliente... */ // if (env.BRANCH_NAME == "Donati") { // /* CAMBIO numero versione in file sorgente!!! */ // bat "fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" // parallel ( // LANDING: { // sleep 5 // bat "\"${tool 'MSBuild-14.0'}\" \"/p:AspnetMergePath=C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.2 Tools\" /T:Package /P:Configuration=Donati /p:PublishProfile=Donati.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/Donati/${env.versionNumber}/MP-LAND.zip /p:DeployIisAppPath=\"Default Web Site/MP/LAND\" /p:PackageAsSingleFile=True /p:OutputPath=bin/ MP/MP.csproj" // bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\MP\\ReleaseClienti\\Donati\" \"E:\\Staging\\byProd\\MP\\Donati\\MP-LAND\" " // // dropbox configName: 'Donati', remoteDirectory: 'installers/MP-LAND', removePrefix: 'ReleaseClienti/Donati', sourceFiles: 'ReleaseClienti/Donati/**' // }, // failFast: false) // } // else{ // echo 'Questo BRANCH non necessita di installer...' // } // } // } // } /*stage('Archive') { steps { echo 'Archiviazione build Release' archiveArtifacts artifacts: 'ScratchTest/ScratchTest/bin/Release/**' } }*/ } 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." }*/ } }