diff --git a/Jenkinsfile b/Jenkinsfile index 6e75af9..c01bfa9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=74']) { + withEnv(['NEXT_BUILD_NUMBER=75']) { // env.versionNumber = VersionNumber(versionNumberString : '1.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '1.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'ZCode' @@ -45,19 +45,66 @@ pipeline { script { /* compilo installers in base al BRANCH del cliente... */ if (env.BRANCH_NAME == "develop") { - parallel ( - ZCode: { - sleep 0 - bat "\"${tool 'MSBuild-15.0'}\" ZCode\\ZCode.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m" - }, - failFast: false) - } + bat "\"${tool 'MSBuild-15.0'}\" ZCode\\ZCode.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m" + } else { echo 'Niente x Build (limitata a develop)...' } } } } + stage('Installers') { + agent any + steps { + // in primis cambio versione e NuGet + script { + // CAMBIO numero versione + checkout NuGet in file sorgente!!! + bat "e:\\fart.exe ${WORKSPACE}\\VersGen\\VersGen.cs 0.0.0.0 ${env.versionNumber} || EXIT /B 0" + fixNuget("${WORKSPACE}\\ZebraCode.sln") + } + // ora mi occupo delle operazioni di compressione e copia... + script { + if (env.BRANCH_NAME == "stable" || env.BRANCH_NAME == "beta") { + // creo ZIP package + bat "\"${tool 'MSBuild-15.0'}\" \"/p:AspnetMergePath=C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v10.0A\\bin\\NETFX 4.6.2 Tools\" /T:Package /P:Configuration=Release /p:PublishProfile=${env.BRANCH_NAME}.pubxml /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/${env.BRANCH_NAME}/ZCode.zip /p:DeployIisAppPath=\"Default Web Site/ZCode\" /p:PackageAsSingleFile=True /p:OutputPath=bin/ ZCode/Zcode.csproj" + } + } + script { + // calcolo il config... + if (env.BRANCH_NAME.contains("beta")) { + env.config = "Debug" + env.classifier = "unstable" + } + else if (env.BRANCH_NAME == "stable") { + env.config = "Release" + env.classifier = "" + } + if (env.BRANCH_NAME == "stable" || env.BRANCH_NAME.contains("beta") ) { + // upload! + nexusArtifactUploader ( + artifacts: + [ + artifactId: 'ZCode', + classifier: "${env.classifier}", + file: "ReleaseClienti\\${env.BRANCH_NAME}\\ZCode.zip", + type: 'zip' + ] + ], + credentialsId: 'bc9d8e92-4302-3266-817f-7b58501d12d5', + nexusUrl: 'nexus.steamware.net', + nexusVersion: 'nexus3', + protocol: 'http', + repository: 'SWS', + version: "${env.versionNumber}" + ) + } + else + { + echo 'Questo BRANCH non necessita di installers...' + } + } + } + } stage('Deploy') { agent any steps { @@ -69,23 +116,16 @@ pipeline { script { /* DEPLOY condizionale: develop (Ufficio Seriate) / master (Sito Online) */ if (env.BRANCH_NAME == "master") { - parallel ( - IIS_02: { - if(env.enableIIS02 == "Y") - { - // SITE - bat "\"${tool 'MSBuild-15.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=15.0 /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ZCode\\ZCode.csproj" - } - }, - IIS_01: { - if(env.enableIIS01 == "Y") - { - sleep 5 - // SITE - bat "\"${tool 'MSBuild-15.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=15.0 /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ZCode\\ZCode.csproj" - } - }, - failFast: false) + if(env.enableIIS02 == "Y") + { + // SITE + bat "\"${tool 'MSBuild-15.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=15.0 /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ZCode\\ZCode.csproj" + } + if(env.enableIIS01 == "Y") + { + // SITE + bat "\"${tool 'MSBuild-15.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=15.0 /p:RunCodeAnalysis=false /p:Configuration=Release /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ZCode\\ZCode.csproj" + } } else if (env.BRANCH_NAME == "ovh") { bat "\"${tool 'MSBuild-15.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=OVH-PROD.pubxml /p:VisualStudioVersion=15.0 /p:RunCodeAnalysis=false /p:Configuration=OVH /p:username=WPROD01\\Steamware /p:Password=viaD@nte16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ ZCode\\ZCode.csproj"