Files
GPW/Jenkinsfile
T
Samuele E. Locatelli 202dcc93ac altri parametri
2017-04-12 14:17:32 +02:00

157 lines
9.2 KiB
Groovy

pipeline {
agent any
parameters {
/*choice(
choices: 'ALL\nETS\nSPS\nALL\nNONE',
description: 'Creare Installers? [ALL|ETS|SPS|NONE]',
name: 'MAKE_INST')*/
booleanParam(defaultValue: true, description: 'Make installers?', name: 'makeInst')
string(defaultValue: "TEST", description: 'What environment?', name: 'userFlag')
// choices are newline separated
choice(choices: 'US-EAST-1\nUS-WEST-2', description: 'What AWS region?', name: 'region')
}
stages {
stage('Checkout') {
steps {
echo "flag: ${params.makeInst}"
echo "flag: ${params.userFlag}"
echo "flag: ${params.region}"
/* 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=4056']) {
env.versionNumber = VersionNumber(versionNumberString : '${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, versionPrefix: '2.4.')
/*env.versionNumber = VersionNumber(versionNumberString : '${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, versionPrefix: '2.4.', overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')*/
}
}
script {
currentBuild.displayName = "${env.versionNumber}"
currentBuild.description = "BUILD ${env.versionNumber}"
}
/* CAMBIO numero versione in file sorgente!!! */
bat "fart.exe VersGen\\GPW.cs 2.4.999.0 ${env.versionNumber} || EXIT /B 0"
}
}
stage('Build') {
steps {
parallel (
HOME: {
bat "\"${tool 'MSBuild-14.0'}\" HOME\\HOME.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
},
ADMIN: {
sleep 0
bat "\"${tool 'MSBuild-14.0'}\" GPW_Admin\\GPW_Admin.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
},
BARCODE: {
sleep 1
bat "\"${tool 'MSBuild-14.0'}\" GPW_Barcode\\GPW_Barcode.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
},
SMART: {
sleep 2
bat "\"${tool 'MSBuild-14.0'}\" GPW_Smart\\GPW_Smart.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
},
COMMESSE: {
sleep 3
bat "\"${tool 'MSBuild-14.0'}\" GPW_Commesse\\GPW_Commesse.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
},
failFast: false)
}
}
stage('Test') {
steps {
echo 'Testing.. 2 be done...'
}
}
stage('Deploy') {
steps {
script {
if (env.BRANCH_NAME == "master") {
parallel (
ADMIN: {
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/ GPW_Admin/GPW_Admin.csproj"
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/ GPW_Admin/GPW_Admin.csproj"
},
BCODE: {
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/ GPW_Barcode/GPW_Barcode.csproj"
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/ GPW_Barcode/GPW_Barcode.csproj"
},
COMM: {
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/ GPW_Commesse/GPW_Commesse.csproj"
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/ GPW_Commesse/GPW_Commesse.csproj"
},
HOME: {
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/ HOME/HOME.csproj"
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/ HOME/HOME.csproj"
},
SMART: {
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/ GPW_Smart/GPW_Smart.csproj"
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/ GPW_Smart/GPW_Smart.csproj"
},
failFast: false)
}
else {
echo 'Nothing to deploy...'
}
}
}
}
stage('Installers') {
steps {
script {
if (env.BRANCH_NAME == "master") {
if(params.MAKE_INST =="ALL" || params.MAKE_INST =="SPS") {
parallel (
SPS_TEST: {
echo 'Creazione zip SPS TEST...'
/*sleep 1
echo 'Copia...'
bat "E:\\Jenkins\\exportDropbox.bat TestSam\\Test\\pipeline_test\\lastSuccessfulBuild\\archive\\ScratchTest\\ScratchTest\\bin\\Release TestSam\\CLI_01 Build_${env.versionNumber}"*/
},
SPS_PROD: {
echo 'Creazione zip SPS PROD...'
/*sleep 1
echo 'Copia...'
bat "E:\\Jenkins\\exportDropbox.bat TestSam\\Test\\pipeline_test\\lastSuccessfulBuild\\archive\\ScratchTest\\ScratchTest\\bin\\Release TestSam\\CLI_01 Build_${env.versionNumber}"*/
},
failFast: false)
}
if(params.MAKE_INST =="ALL" || params.MAKE_INST =="ETS") {
parallel (
ETS_TEST: {
echo 'Creazione zip ETS TEST...'
/*sleep 1
echo 'Copia...'
bat "E:\\Jenkins\\exportDropbox.bat TestSam\\Test\\pipeline_test\\lastSuccessfulBuild\\archive\\ScratchTest\\ScratchTest\\bin\\Release TestSam\\CLI_01 Build_${env.versionNumber}"*/
},
ETS_PROD: {
echo 'Creazione zip ETS PROD...'
/*sleep 1
echo 'Copia...'
bat "E:\\Jenkins\\exportDropbox.bat TestSam\\Test\\pipeline_test\\lastSuccessfulBuild\\archive\\ScratchTest\\ScratchTest\\bin\\Release TestSam\\CLI_01 Build_${env.versionNumber}"*/
},
failFast: false)
}
}
}
}
}
/*stage('Archive') {
steps {
echo 'Archiviazione build Release'
archiveArtifacts artifacts: 'ScratchTest/ScratchTest/bin/Release/**'
}
}*/
}
post {
always {
/* invio email se ci sono errori... */
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: 'info@steamware.net', sendToIndividuals: true])
}
}
}