152 lines
7.5 KiB
Groovy
152 lines
7.5 KiB
Groovy
pipeline {
|
|
agent none
|
|
stages {
|
|
stage('Checkout') {
|
|
agent any
|
|
steps {
|
|
/* 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=83']) {
|
|
env.versionNumber = VersionNumber(versionNumberString : '1.12.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
|
// env.versionNumber = VersionNumber(versionNumberString : '1.12.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
|
env.APP_NAME = 'MAPO-IOB-WIN'
|
|
}
|
|
}
|
|
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}"
|
|
}
|
|
}
|
|
|
|
/* CAMBIO numero versione in file sorgente!!! */
|
|
bat "fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
|
}
|
|
}
|
|
stage('Build') {
|
|
agent any
|
|
steps {
|
|
script {
|
|
// compilo installers in base al BRANCH del cliente...
|
|
if (env.BRANCH_NAME == "develop") {
|
|
// CAMBIO numero versione in file sorgente!!!
|
|
bat "fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
|
// restore nuget packages
|
|
bat "e:\\nuget.exe restore ${WORKSPACE}\\IOB-WIN.sln"
|
|
// BUILD!
|
|
bat "\"${tool 'MSBuild-14.0'}\" IOB-WIN/IOB-WIN.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
|
|
}
|
|
else {
|
|
echo 'Nothing to Build...'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
stage('Test') {
|
|
steps {
|
|
echo 'Testing.. 2 be done...'
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
agent any
|
|
steps {
|
|
// in primis compilo a seconda del branch... TUTTO tranne develop...
|
|
script {
|
|
// CAMBIO numero versione in file sorgente!!!
|
|
bat "fart.exe VersGen\\VersGen.cs 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
|
// restore nuget packages
|
|
bat "e:\\nuget.exe restore ${WORKSPACE}\\IOB-WIN.sln"
|
|
// BUILD!
|
|
bat "\"${tool 'MSBuild-14.0'}\" IOB-WIN/IOB-WIN.csproj -target:Build /p:Configuration=Release /p:Platform=\"Any CPU\" /p:OutputPath=bin/ /m"
|
|
}
|
|
// compilo changelog...
|
|
script {
|
|
|
|
|
|
|
|
step([$class: 'GitChangelogRecorder', config: [configFile: 'git-changelog-settings.json', createFileTemplateContent: '''<h1> Git Changelog changelog </h1>
|
|
|
|
<p>
|
|
Changelog of Git Changelog.
|
|
</p>
|
|
|
|
{{#tags}}
|
|
<h2> {{name}} </h2>
|
|
{{#issues}}
|
|
{{#hasIssue}}
|
|
{{#hasLink}}
|
|
<h2> {{name}} <a href="{{link}}">{{issue}}</a> {{title}} </h2>
|
|
{{/hasLink}}
|
|
{{^hasLink}}
|
|
<h2> {{name}} {{issue}} {{title}} </h2>
|
|
{{/hasLink}}
|
|
{{/hasIssue}}
|
|
{{^hasIssue}}
|
|
<h2> {{name}} </h2>
|
|
{{/hasIssue}}
|
|
|
|
|
|
{{#commits}}
|
|
<a href="https://github.com/tomasbjerre/git-changelog-lib/commit/{{hash}}">{{hash}}</a> {{authorName}} <i>{{commitTime}}</i>
|
|
<p>
|
|
<h3>{{{messageTitle}}}</h3>
|
|
|
|
{{#messageBodyItems}}
|
|
<li> {{.}}</li>
|
|
{{/messageBodyItems}}
|
|
</p>
|
|
{{/commits}}
|
|
|
|
{{/issues}}
|
|
{{/tags}}
|
|
''', createFileTemplateFile: 'ChangeLogTemplate.html', createFileUseTemplateContent: false, createFileUseTemplateFile: true, customIssues: [[link: '', name: '', pattern: '', title: ''], [link: '', name: '', pattern: '', title: '']], dateFormat: 'YYYY-MM-dd HH:mm:ss', file: 'ChangeLog.html', fromReference: '', fromType: 'firstCommit', gitHubApi: '', gitHubApiTokenCredentialsId: '', gitHubIssuePattern: '#([0-9]+)', gitHubToken: '', gitLabApiTokenCredentialsId: '', gitLabProjectName: '', gitLabServer: '', gitLabToken: '', ignoreCommitsIfMessageMatches: '^\\[maven-release-plugin\\].*|^\\[Gradle Release Plugin\\].*|^Merge.*', ignoreCommitsWithoutIssue: true, ignoreTagsIfNameMatches: '', jiraIssuePattern: '\\b[a-zA-Z]([a-zA-Z]+)-([0-9]+)\\b', jiraPassword: '', jiraServer: '', jiraUsername: '', jiraUsernamePasswordCredentialsId: '', mediaWikiPassword: '', mediaWikiTemplateContent: '''''', mediaWikiTemplateFile: '', mediaWikiTitle: '', mediaWikiUrl: '', mediaWikiUseTemplateContent: false, mediaWikiUseTemplateFile: false, mediaWikiUsername: '', noIssueName: 'No issue', readableTagName: '/([^/]+?)$', showSummary: false, showSummaryTemplateContent: '''<h1> Git Changelog changelog </h1>''', showSummaryTemplateFile: '', showSummaryUseTemplateContent: false, showSummaryUseTemplateFile: false, subDirectory: '', timeZone: 'UTC', toReference: '', toType: 'master', untaggedName: 'Unreleased', useConfigFile: false, useFile: false, useGitHub: false, useGitHubApiTokenCredentials: false, useGitLab: false, useGitLabApiTokenCredentials: false, useIgnoreTagsIfNameMatches: false, useJira: false, useJiraUsernamePasswordCredentialsId: false, useMediaWiki: false, useReadableTagName: false, useSubDirectory: false]])
|
|
|
|
}
|
|
// ora mi occupo delle operazioni di compressione e copia...
|
|
script {
|
|
// elimino files conf personalizzata per ogni install...
|
|
bat "RD /S /Q IOB-WIN\\bin\\DATA"
|
|
// manifest.xml: aggiorno versNumber ed URL del branch di update...
|
|
bat "fart.exe IOB-WIN\\Resources\\manifest.xml 1.0.0.0 ${env.versionNumber} || EXIT /B 0"
|
|
bat "fart.exe IOB-WIN\\Resources\\manifest.xml {{BRANCHNAME}} ${env.BRANCH_NAME} || EXIT /B 0"
|
|
bat "fart.exe IOB-WIN\\Resources\\ChangeLog.html {{CURRENT-REL}} ${env.versionNumber} || EXIT /B 0"
|
|
// copio ed esporto in IIS02 i vari files .xml, .html, .zip
|
|
bat "xcopy /y IOB-WIN\\Resources\\manifest.xml c:\\inetpub\\wwwroot\\SWS\\MAPO-IOB-WIN\\${env.BRANCH_NAME}\\ "
|
|
bat "xcopy /y IOB-WIN\\Resources\\ChangeLog.html c:\\inetpub\\wwwroot\\SWS\\MAPO-IOB-WIN\\${env.BRANCH_NAME}\\ "
|
|
bat "xcopy /y IOB-WIN\\Resources\\logoSteamware.png c:\\inetpub\\wwwroot\\SWS\\MAPO-IOB-WIN\\${env.BRANCH_NAME}\\ "
|
|
|
|
// salvo copia della versione...
|
|
bat "xcopy /y Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip E:\\Staging\\byProd\\MAPO-IOB-WIN\\${env.BRANCH_NAME}\\${env.versionNumber}\\ "
|
|
|
|
// elimino files inutili di resources e pubblico
|
|
bat "RD /S /Q IOB-WIN\\Resources"
|
|
// elimino vecchio zip...
|
|
bat "RD /S /Q Releases\\${env.BRANCH_NAME}\\"
|
|
// Compressione in .zip dell'installer...
|
|
bat "e:\\7za.exe a -tzip ${WORKSPACE}\\Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip ${WORKSPACE}\\IOB-WIN\\bin\\*"
|
|
// copio
|
|
bat "xcopy /y Releases\\${env.BRANCH_NAME}\\MAPO-IOB-WIN.zip c:\\inetpub\\wwwroot\\SWS\\MAPO-IOB-WIN\\${env.BRANCH_NAME}\\ "
|
|
}
|
|
}
|
|
}
|
|
}
|
|
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."
|
|
}
|
|
}
|
|
} |