diff --git a/Jenkinsfile b/Jenkinsfile index 8c1520f..a59763f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,10 +12,10 @@ pipeline { steps { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=17']) { - // env.versionNumber = VersionNumber(versionNumberString : '1.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) - env.versionNumber = VersionNumber(versionNumberString : '1.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') - env.APP_NAME = 'QRC-UTILS' + withEnv(['NEXT_BUILD_NUMBER=71']) { + // 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' } } script { @@ -28,8 +28,76 @@ pipeline { } } // CAMBIO numero versione + checkout NuGet in file sorgente!!! - bat "fart.exe VersGen\\MoonPro.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0" - bat "e:\\nuget.exe restore ${WORKSPACE}\\QR-GEN.sln" + bat "e:\\fart.exe ${WORKSPACE}\\VersGen\\VersGen.cs 0.0.0.0 ${env.versionNumber} || EXIT /B 0" + // checkout NuGet in file sorgente!!! + fixNuget("${WORKSPACE}\\ZebraCode.sln") + } + } + } + stage('Build') { + agent any + steps { + script { + properties([buildDiscarder(logRotator(artifactDaysToKeepStr: '180', artifactNumToKeepStr: '30', daysToKeepStr: '360', numToKeepStr: '30')), pipelineTriggers([])]) + // 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" + // checkout NuGet in file sorgente!!! + fixNuget("${WORKSPACE}\\ZebraCode.sln") + } + 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) + } + else { + echo 'Niente x Build (limitata a develop)...' + } + } + } + } + stage('Deploy') { + agent any + steps { + 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" + // checkout NuGet in file sorgente!!! + fixNuget("${WORKSPACE}\\ZebraCode.sln") + } + script { + /* DEPLOY condizionale: develop (Ufficio Seriate) / master (Sito Online) */ + if (env.BRANCH_NAME == "master") { + parallel ( + IIS_01: { + 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" + } + }, + IIS_02: { + if(env.enableIIS02 == "Y") + { + sleep 4 + // 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" + } + }, + failFast: false) + } + 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" + } + else + { + echo 'Questo BRANCH non necessita di deploy...' + } + } } } } @@ -69,14 +137,6 @@ def getChangeString() { return changeString } -// Funzione x invio email -def sendEmail(status) { - mail ( - to: "$EMAIL_RECIPIENTS", - subject: "${env.versionNumber} " + status +": Build $BUILD_NUMBER ($JOB_NAME)", - body: "Modifiche:\n " + getChangeString() + "\n\n Verifica console output: $BUILD_URL/console" + "\n" - ) -} // Funzione x invio slack def sendSlack(status, colorCode) { @@ -88,3 +148,19 @@ def sendSlack(status, colorCode) { "Modifiche:\n " + getChangeString() + "\n\n Verifica build: <${env.BUILD_URL}|Apri>" + "\n" ) } + +// funzione x fix pacchetti nuget da NOSTRO repo Nexus con proxy +def fixNuget(solutionFile) { + // bat "e:\\nuget setapikey fe387daa-d07c-3207-877e-96c8be1be91b -source http://nexus.steamware.net/repository/nuget-group" + // solo la prima volta va aggiunta... + hasSource = bat "e:\\nuget sources list | find \"Steamware\" /C" + if (hasSource == "0") + { + bat "e:\\nuget sources Add -Name \"Steamware Nexus\" -Source http://nexus.steamware.net/repository/nuget-group -username \"nugetUser\" -password \"viaDante16\"" + } + else + { + bat "e:\\nuget sources Update -Name \"Steamware Nexus\" -Source http://nexus.steamware.net/repository/nuget-group -username \"nugetUser\" -password \"viaDante16\"" + } + bat "e:\\nuget.exe restore ${solutionFile}" +} \ No newline at end of file diff --git a/ZCode/Properties/PublishProfiles/IIS01.pubxml b/ZCode/Properties/PublishProfiles/IIS01.pubxml new file mode 100644 index 0000000..075f2b9 --- /dev/null +++ b/ZCode/Properties/PublishProfiles/IIS01.pubxml @@ -0,0 +1,27 @@ + + + + + MSDeploy + Release + Any CPU + + True + True + True + False + DonotMerge + True + IIS01 + Default Web Site/ZCode + + False + WMSVC + True + jenkins + <_SavePWD>True + + \ No newline at end of file diff --git a/ZCode/Properties/PublishProfiles/IIS01.pubxml.user b/ZCode/Properties/PublishProfiles/IIS01.pubxml.user new file mode 100644 index 0000000..c8bf432 --- /dev/null +++ b/ZCode/Properties/PublishProfiles/IIS01.pubxml.user @@ -0,0 +1,11 @@ + + + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAI/S2yHlOzEGsfZnJFESRYAAAAAACAAAAAAADZgAAwAAAABAAAAAE7G84vVb53R4aZ+HfuWtmAAAAAASAAACgAAAAEAAAAFP2qEkZwYHbgS8jeQXlYkIYAAAAs7f0jFvrMxDUJhgGDSV0tbf0WJarsFkBFAAAAA5GtgC/PxiRJifMrrWabUUsv0uS + + \ No newline at end of file diff --git a/ZCode/Properties/PublishProfiles/IIS02.pubxml b/ZCode/Properties/PublishProfiles/IIS02.pubxml new file mode 100644 index 0000000..b597b02 --- /dev/null +++ b/ZCode/Properties/PublishProfiles/IIS02.pubxml @@ -0,0 +1,27 @@ + + + + + MSDeploy + Release + Any CPU + + True + True + IIS02 + Default Web Site/ZCode + + False + WMSVC + True + jenkins + <_SavePWD>True + True + True + False + DonotMerge + + \ No newline at end of file diff --git a/ZCode/Properties/PublishProfiles/OVH-PROD.pubxml b/ZCode/Properties/PublishProfiles/OVH-PROD.pubxml new file mode 100644 index 0000000..2387afa --- /dev/null +++ b/ZCode/Properties/PublishProfiles/OVH-PROD.pubxml @@ -0,0 +1,23 @@ + + + + + MSDeploy + Release + Any CPU + qrcode.steamware.net + True + False + https://wprod01.steamware.net:8172/MsDeploy.axd + qrcode.steamware.net + + True + WMSVC + True + jenkins + <_SavePWD>True + + \ No newline at end of file diff --git a/ZCode/Properties/PublishProfiles/OVH-PROD.pubxml.user b/ZCode/Properties/PublishProfiles/OVH-PROD.pubxml.user new file mode 100644 index 0000000..d9bf030 --- /dev/null +++ b/ZCode/Properties/PublishProfiles/OVH-PROD.pubxml.user @@ -0,0 +1,11 @@ + + + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAI/S2yHlOzEGsfZnJFESRYAAAAAACAAAAAAADZgAAwAAAABAAAADRGyRflF9zMzRp57A+PBt9AAAAAASAAACgAAAAEAAAALl7FQBp0w39dqC/KjfHYQEYAAAAViubc54Evmg1amaBPgWawo/pbmtTlnk3FAAAAKTJS8XBVzk2R3uxaOszcDc41aX4 + + \ No newline at end of file diff --git a/ZCode/Properties/PublishProfiles/Prod.pubxml b/ZCode/Properties/PublishProfiles/Prod.pubxml new file mode 100644 index 0000000..081a7cb --- /dev/null +++ b/ZCode/Properties/PublishProfiles/Prod.pubxml @@ -0,0 +1,25 @@ + + + + + Package + Release + Any CPU + + True + True + C:\Users\samuele.steamw\Documents\VisualStudioProject\QRC-UTILS\Release\QR-GEN.zip + true + Default Web Site/ZCode + + + + True + True + False + DonotMerge + + \ No newline at end of file diff --git a/ZCode/Properties/PublishProfiles/Prod.pubxml.user b/ZCode/Properties/PublishProfiles/Prod.pubxml.user new file mode 100644 index 0000000..835a267 --- /dev/null +++ b/ZCode/Properties/PublishProfiles/Prod.pubxml.user @@ -0,0 +1,11 @@ + + + + + + AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAmTIWAbwOw0WNkOJPskDBCQAAAAACAAAAAAADZgAAwAAAABAAAAAGYA4wqy8Eynb5+FXK/G0lAAAAAASAAACgAAAAEAAAAA1NLsZla+BxjV/TRtkqhrYYAAAAsqpiiZpk0a/Ao1s7MLV0uKWKHdsiiXvJFAAAAK76Zq0NsIRMLhmkNpXAL838WvB9 + + \ No newline at end of file diff --git a/ZCode/ZCode.csproj b/ZCode/ZCode.csproj index d6a2c97..458f091 100644 --- a/ZCode/ZCode.csproj +++ b/ZCode/ZCode.csproj @@ -171,6 +171,8 @@ + + diff --git a/ZebraCode.sln b/ZebraCode.sln index d65cfc0..f288509 100644 --- a/ZebraCode.sln +++ b/ZebraCode.sln @@ -3,24 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29709.97 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZCode", "QR-GEN\ZCode.csproj", "{4B0464BD-88BC-44A4-9750-AFC4259E7400}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VersGen", "VersGen\VersGen.csproj", "{175AF851-9AED-4D5F-8571-9CEC8B2D2320}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ZCode", "ZCode\ZCode.csproj", "{4B0464BD-88BC-44A4-9750-AFC4259E7400}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4B0464BD-88BC-44A4-9750-AFC4259E7400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4B0464BD-88BC-44A4-9750-AFC4259E7400}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4B0464BD-88BC-44A4-9750-AFC4259E7400}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4B0464BD-88BC-44A4-9750-AFC4259E7400}.Release|Any CPU.Build.0 = Release|Any CPU {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Debug|Any CPU.Build.0 = Debug|Any CPU {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Release|Any CPU.ActiveCfg = Release|Any CPU {175AF851-9AED-4D5F-8571-9CEC8B2D2320}.Release|Any CPU.Build.0 = Release|Any CPU + {4B0464BD-88BC-44A4-9750-AFC4259E7400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4B0464BD-88BC-44A4-9750-AFC4259E7400}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4B0464BD-88BC-44A4-9750-AFC4259E7400}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4B0464BD-88BC-44A4-9750-AFC4259E7400}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE