Files
GMW/Jenkinsfile
T
2018-07-05 15:08:12 +02:00

214 lines
16 KiB
Groovy

pipeline {
agent none
stages {
stage('Checkout') {
agent any
steps {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
withEnv(['NEXT_BUILD_NUMBER=2665']) {
// impiego numero di build del SINGOLO RAMO
// env.versionNumber = VersionNumber(versionNumberString : '3.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
// forzo numero di build x tutti rami uguali
env.versionNumber = VersionNumber(versionNumberString : '3.9.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'GMW'
}
}
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}"
}
}
}
}
stage('Build') {
agent any
steps {
// CAMBIO numero versione in file sorgente + recupero packages
bat "e:\\fart.exe ${WORKSPACE}\\VersGen\\GMW.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
bat "e:\\nuget.exe restore ${WORKSPACE}\\GMW.sln"
// bat "e:\\nuget.exe restore ${WORKSPACE}\\GMW_Data.sln"
// bat "e:\\nuget.exe restore ${WORKSPACE}\\GMW_Terminus.sln"
script {
/* compilo installers in base al BRANCH del cliente... */
if (env.BRANCH_NAME == "develop") {
parallel (
GMW: {
sleep 0
bat "\"${tool 'MSBuild-15.0'}\" GMW/GMW.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
},
GMWT: {
sleep 1
// bat "\"${tool 'MSBuild-15.0'}\" GMW_Term/GMW_Term.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
},
failFast: false)
}
else {
echo 'Nothing to Build...'
}
}
}
}
stage('Test') {
steps {
script {
/* compilo installers in base al BRANCH del cliente... */
parallel (
GMW: {
sleep 0
// bat "\"${tool 'MSBuild-15.0'}\" GMW/GMW.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
echo 'Testing.. 2 be done...'
},
GMWT: {
sleep 1
// bat "\"${tool 'MSBuild-15.0'}\" GMW_Term/GMW_Term.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
echo 'Testing.. 2 be done...'
},
failFast: false)
}
}
}
stage('Deploy-Installers') {
agent any
steps {
// CAMBIO numero versione in file sorgente + recupero packages
bat "e:\\fart.exe ${WORKSPACE}\\VersGen\\GMW.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
bat "e:\\nuget.exe restore ${WORKSPACE}\\GMW.sln"
// bat "e:\\nuget.exe restore ${WORKSPACE}\\GMW_Data.sln"
// bat "e:\\nuget.exe restore ${WORKSPACE}\\GMW_Terminus.sln"
script {
/* DEPLOY condizionale: develop / master */
if (env.BRANCH_NAME == "develop") {
parallel (
GMW_TK: {
sleep 0
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_TK.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS02_TK /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ GMW/GMW.csproj"
},
GMW_SP: {
sleep 1
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_SP.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS02_SP /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ GMW/GMW.csproj"
},
GMWT_TK: {
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_TK.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS02_TK /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ GMW_Term/GMW_Term.csproj"
},
GMWT_SP: {
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=IIS02_SP.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS02_SP /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ GMW_Term/GMW_Term.csproj"
},
failFast: false)
}
else if (env.BRANCH_NAME == "TK_GMW") {
parallel (
GMW_TK: {
sleep 0
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_TK.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS01_TK /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ GMW/GMW.csproj"
},
TEST: {
sleep 1
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=TK_test /p:PublishProfile=TK_test.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/TK_test/Build_${env.versionNumber}/GMW.zip /p:PackageAsSingleFile=True /p:OutputPath=bin/ GMW/GMW.csproj"
bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\TK_test\" \"E:\\Staging\\byProd\\GMW\\TK_test\\GMW-site\" "
// bat "E:\\Jenkins\\exportInstaller.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\TK_test\" \"E:\\Staging\\GMW\\GMW-site\\TK_test\" "
dropbox configName: 'Mazzucconi - Tekal', remoteDirectory: 'File_Installazione_GMW_Test', removePrefix: 'GMW/ReleaseClienti/TK_test', sourceFiles: 'GMW/ReleaseClienti/TK_test/**'
},
PROD: {
sleep 2
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=TK_prod /p:PublishProfile=TK_prod.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/TK_prod/Build_${env.versionNumber}/GMW.zip /p:PackageAsSingleFile=True /p:OutputPath=bin/ GMW/GMW.csproj"
bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\TK_prod\" \"E:\\Staging\\byProd\\GMW\\TK_prod\\GMW-site\" "
// bat "E:\\Jenkins\\exportInstaller.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\TK_prod\" \"E:\\Staging\\GMW\\GMW-site\\TK_prod\" "
dropbox configName: 'Mazzucconi - Tekal', remoteDirectory: 'File_Installazione_GMW', removePrefix: 'GMW/ReleaseClienti/TK_prod', sourceFiles: 'GMW/ReleaseClienti/TK_prod/**'
},
failFast: false)
}
else if (env.BRANCH_NAME == "TK_GMWT") {
parallel (
GMW_TK: {
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_TK.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS01_TK /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ GMW_Term/GMW_Term.csproj"
},
TEST: {
sleep 1
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=TK_test /p:PublishProfile=TK_test.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/TK_test/Build_${env.versionNumber}/GMW.zip /p:PackageAsSingleFile=True /p:OutputPath=bin/ GMW_Term/GMW_Term.csproj"
bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\TK_test\" \"E:\\Staging\\byProd\\GMW\\TK_test\\GMW-site\" "
// bat "E:\\Jenkins\\exportInstaller.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\TK_test\" \"E:\\Staging\\GMW\\GMW-site\\TK_test\" "
dropbox configName: 'Mazzucconi - Tekal', remoteDirectory: 'File_Installazione_GMW_Test', removePrefix: 'GMW/ReleaseClienti/TK_test', sourceFiles: 'GMW/ReleaseClienti/TK_test/**'
},
PROD: {
sleep 2
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=TK_prod /p:PublishProfile=TK_prod.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/TK_prod/Build_${env.versionNumber}/GMW.zip /p:PackageAsSingleFile=True /p:OutputPath=bin/ GMW_Term/GMW_Term.csproj"
bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\TK_prod\" \"E:\\Staging\\byProd\\GMW\\TK_prod\\GMW-site\" "
// bat "E:\\Jenkins\\exportInstaller.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\TK_prod\" \"E:\\Staging\\GMW\\GMW-site\\TK_prod\" "
dropbox configName: 'Mazzucconi - Tekal', remoteDirectory: 'File_Installazione_GMW', removePrefix: 'GMW/ReleaseClienti/TK_prod', sourceFiles: 'GMW/ReleaseClienti/TK_prod/**'
},
failFast: false)
}
else if (env.BRANCH_NAME == "SP_GMW") {
parallel (
GMW_SP: {
sleep 0
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_SP.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS01_SP /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ GMW/GMW.csproj"
},
TEST: {
sleep 1
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=SP_test /p:PublishProfile=SP_test.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SP_test/Build_${env.versionNumber}/GMW.zip /p:PackageAsSingleFile=True /p:OutputPath=bin/ GMW/GMW.csproj"
bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\SP_test\" \"E:\\Staging\\byProd\\GMW\\SP_test\\GMW-site\" "
// bat "E:\\Jenkins\\exportInstaller.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\SP_test\" \"E:\\Staging\\GMW\\GMW-site\\SP_test\" "
dropbox configName: 'Mazzucconi - San Possidonio', remoteDirectory: 'File_Installazione_GMW_Test', removePrefix: 'GMW/ReleaseClienti/SP_test', sourceFiles: 'GMW/ReleaseClienti/SP_test/**'
},
PROD: {
sleep 2
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=SP_prod /p:PublishProfile=SP_prod.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SP_prod/Build_${env.versionNumber}/GMW.zip /p:PackageAsSingleFile=True /p:OutputPath=bin/ GMW/GMW.csproj"
bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\SP_prod\" \"E:\\Staging\\byProd\\GMW\\SP_prod\\GMW-site\" "
// bat "E:\\Jenkins\\exportInstaller.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\SP_prod\" \"E:\\Staging\\GMW\\GMW-site\\SP_prod\" "
dropbox configName: 'Mazzucconi - San Possidonio', remoteDirectory: 'File_Installazione_GMW', removePrefix: 'GMW/ReleaseClienti/SP_prod', sourceFiles: 'GMW/ReleaseClienti/SP_prod/**'
},
failFast: false)
}
else if (env.BRANCH_NAME == "SP_GMWT") {
parallel (
GMW_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_SP.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS01_SP /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ GMW_Term/GMW_Term.csproj"
},
TEST: {
sleep 1
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=SP_test /p:PublishProfile=SP_test.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SP_test/Build_${env.versionNumber}/GMW.zip /p:PackageAsSingleFile=True /p:OutputPath=bin/ GMW_Term/GMW_Term.csproj"
bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\SP_test\" \"E:\\Staging\\byProd\\GMW\\SP_test\\GMW-site\" "
// bat "E:\\Jenkins\\exportInstaller.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\SP_test\" \"E:\\Staging\\GMW\\GMW-site\\SP_test\" "
dropbox configName: 'Mazzucconi - San Possidonio', remoteDirectory: 'File_Installazione_GMW_Test', removePrefix: 'GMW/ReleaseClienti/SP_test', sourceFiles: 'GMW/ReleaseClienti/SP_test/**'
},
PROD: {
sleep 2
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=SP_prod /p:PublishProfile=SP_prod.pubxml /p:VisualStudioVersion=14.0 /p:RunCodeAnalysis=false /p:PackageLocation=ReleaseClienti/SP_prod/Build_${env.versionNumber}/GMW.zip /p:PackageAsSingleFile=True /p:OutputPath=bin/ GMW_Term/GMW_Term.csproj"
bat "E:\\Jenkins\\exportDropbox.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\SP_prod\" \"E:\\Staging\\byProd\\GMW\\SP_prod\\GMW-site\" "
// bat "E:\\Jenkins\\exportInstaller.bat \"${WORKSPACE}\\GMW\\ReleaseClienti\\SP_prod\" \"E:\\Staging\\GMW\\GMW-site\\SP_prod\" "
dropbox configName: 'Mazzucconi - San Possidonio', remoteDirectory: 'File_Installazione_GMW', removePrefix: 'GMW/ReleaseClienti/SP_prod', sourceFiles: 'GMW/ReleaseClienti/SP_prod/**'
},
failFast: false)
}
else {
echo 'Niente x Deploy / Install...'
}
}
}
}
}
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."
}*/
}
}