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=1120']) { // env.versionNumber = VersionNumber(versionNumberString : '${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'ScheMe' } } script { currentBuild.displayName = "${env.versionNumber}" if (env.BRANCH_NAME == "develop") { currentBuild.description = "TEST ${env.versionNumber}" } else { currentBuild.description = "BUILD ${env.versionNumber}" } } /* CAMBIO numero versione in file sorgente!!! */ bat "fart.exe VersGen\\VersGen.cs 000.000 ${env.versionNumber} || EXIT /B 0" } } stage('Build') { agent any steps { script { /* compilo tutti i progetti compresi... */ if (env.BRANCH_NAME == "develop") { /* CAMBIO numero versione in file sorgente!!! */ bat "fart.exe VersGen\\VersGen.cs 000.000 ${env.versionNumber} || EXIT /B 0" parallel ( SP: { sleep 0 bat "\"${tool 'MSBuild-14.0'}\" ScheMe-SP/ScheMe-SP.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m" }, // AFA: { // sleep 1 // bat "\"${tool 'MSBuild-14.0'}\" ScheMe-AFA/ScheMe-AFA.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m" // }, failFast: false) } else { echo 'Nothing to Build...' } } } } stage('Test') { steps { echo 'Testing.. 2 be done...' } } stage('Deploy') { agent any steps { script { /* DEPLOY condizionale: develop / master */ if (env.BRANCH_NAME == "master") { /* CAMBIO numero versione in file sorgente!!! */ bat "fart.exe VersGen\\VersGen.cs 000.000 ${env.versionNumber} || EXIT /B 0" parallel ( SP: { sleep 0 bat "\"${tool 'MSBuild-14.0'}\" \"/p:AspnetMergePath=C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.2 Tools\" /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS01.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS01 /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ScheMe-SP/ScheMe-SP.csproj" sleep 1 bat "\"${tool 'MSBuild-14.0'}\" \"/p:AspnetMergePath=C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.2 Tools\" /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS02.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS02 /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ScheMe-SP/ScheMe-SP.csproj" }, // AFA: { // sleep 2 // bat "\"${tool 'MSBuild-14.0'}\" \"/p:AspnetMergePath=C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.2 Tools\" /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS02.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS02 /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ScheMe-AFA/ScheMe-AFA.csproj" // sleep 3 // bat "\"${tool 'MSBuild-14.0'}\" \"/p:AspnetMergePath=C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.2 Tools\" /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=IIS01.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS01 /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ScheMe-AFA/ScheMe-AFA.csproj" // }, failFast: false) } else { echo 'Nothing to deploy...' } } } } stage('RemoteDeploy') { agent any steps { script { /* compilo installers in base al BRANCH del cliente... */ if (env.BRANCH_NAME == "cusbg") { /* CAMBIO numero versione in file sorgente!!! */ bat "fart.exe VersGen\\VersGen.cs 000.000 ${env.versionNumber} || EXIT /B 0" parallel ( SP: { sleep 0 bat "\"${tool 'MSBuild-14.0'}\" \"/p:AspnetMergePath=C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.2 Tools\" /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=CUSBG.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=CUSBG /p:username=WPROD01\\Steamware /p:Password=viaD@nte16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ScheMe-SP/ScheMe-SP.csproj" }, // AFA: { // sleep 1 // bat "\"${tool 'MSBuild-14.0'}\" \"/p:AspnetMergePath=C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.2 Tools\" /p:DeployOnBuild=true /p:Targets=Publish /p:PublishProfile=CUSBG.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=CUSBG /p:username=WPROD01\\Steamware /p:Password=viaD@nte16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ScheMe-AFA/ScheMe-AFA.csproj" // }, failFast: false) } else{ echo 'Questo BRANCH non necessita di RemoteDeploy...' } } } } /*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." }*/ } }