Fix jenkisfile
This commit is contained in:
Vendored
+38
-15
@@ -14,9 +14,9 @@ pipeline {
|
||||
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=4261']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '3.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '3.2.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
withEnv(['NEXT_BUILD_NUMBER=4263']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '3.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'CMS-SC'
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,8 @@ pipeline {
|
||||
if (env.BRANCH_NAME == "develop") {
|
||||
/* CAMBIO numero versione in file sorgente!!! */
|
||||
bat "e:\\fart.exe ${WORKSPACE}\\VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
bat "e:\\nuget.exe restore ${WORKSPACE}\\CMS-SC.sln"
|
||||
// checkout NuGet in file sorgente!!!
|
||||
fixNuget("${WORKSPACE}\\CMS-SC.sln")
|
||||
parallel (
|
||||
REL: {
|
||||
sleep 0
|
||||
@@ -68,7 +69,8 @@ pipeline {
|
||||
if (env.BRANCH_NAME == "master") {
|
||||
/* CAMBIO numero versione in file sorgente!!! */
|
||||
bat "e:\\fart.exe ${WORKSPACE}\\VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
bat "e:\\nuget.exe restore ${WORKSPACE}\\CMS-SC.sln"
|
||||
// checkout NuGet in file sorgente!!!
|
||||
fixNuget("${WORKSPACE}\\CMS-SC.sln")
|
||||
parallel (
|
||||
IIS01: {
|
||||
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=14.0 /p:RunCodeAnalysis=false /p:Configuration=IIS01 /p:username=jenkins /p:Password=viadante16 /p:AllowUntrustedCertificate=true /p:OutputPath=bin/ CMS_SC/CMS_SC.csproj"
|
||||
@@ -91,7 +93,8 @@ pipeline {
|
||||
script {
|
||||
// CAMBIO numero versione + checkout NuGet in file sorgente!!!
|
||||
bat "e:\\fart.exe ${WORKSPACE}\\VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
||||
bat "e:\\nuget.exe restore ${WORKSPACE}\\CMS-SC.sln"
|
||||
// checkout NuGet in file sorgente!!!
|
||||
fixNuget("${WORKSPACE}\\CMS-SC.sln")
|
||||
}
|
||||
// ora mi occupo delle operazioni di compressione e copia...
|
||||
script {
|
||||
@@ -122,13 +125,13 @@ pipeline {
|
||||
}
|
||||
post {
|
||||
success {
|
||||
sendEmail("Successful")
|
||||
sendSlack("Successful", "good")
|
||||
}
|
||||
failure {
|
||||
sendEmail("Failed")
|
||||
sendSlack("Failed", "danger")
|
||||
}
|
||||
unstable {
|
||||
sendEmail("Unstable")
|
||||
sendSlack("Unstable", "warning")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,10 +181,30 @@ def getChangeString() {
|
||||
}
|
||||
return changeString
|
||||
}
|
||||
// Funzione x invio email
|
||||
def sendEmail(status) {
|
||||
mail (
|
||||
to: "$EMAIL_RECIPIENTS",
|
||||
subject: "Build $BUILD_NUMBER - " + status + " ($JOB_NAME)",
|
||||
body: "Modifiche:\n " + getChangeString() + "\n\n Verifica console output: $BUILD_URL/console" + "\n")
|
||||
|
||||
|
||||
// Funzione x invio slack
|
||||
def sendSlack(status, colorCode) {
|
||||
slackSend (
|
||||
color: colorCode,
|
||||
channel: "#ctrack-dev",
|
||||
failOnError: false,
|
||||
message: "${env.JOB_NAME} ${env.versionNumber} | " + status + ": Build ${env.BUILD_NUMBER}\n\n" +
|
||||
"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}"
|
||||
}
|
||||
Reference in New Issue
Block a user