Set the version in the config file during the build

This commit is contained in:
Ovidio Mallo 2017-01-03 00:29:33 +01:00
parent 495546894c
commit 042f8a847e
2 changed files with 6 additions and 5 deletions

View File

@ -226,7 +226,7 @@ pre {
<section class='container'> <section class='container'>
<hgroup> <hgroup>
<h1>Welcome to your Ruby application on OpenShift (version 31)</h1> <h1>Welcome to your Ruby application on OpenShift (version {{BUILD_VERSION}})</h1>
</hgroup> </hgroup>
<div class="row"> <div class="row">

View File

@ -10,7 +10,12 @@ node() {
def config = ocutil.parseConfig(readFile("deployment/config.yaml")) def config = ocutil.parseConfig(readFile("deployment/config.yaml"))
def buildVersion = sh(script: "${gitVersionCmd} /showvariable FullSemVer", returnStdout: true).trim()
def tagVersion = sh(script: "${gitVersionCmd} /showvariable MajorMinorPatch", returnStdout: true).trim()
echo "versions: buildVersion=${buildVersion}, tagVersion=${tagVersion}"
stage("Build") { stage("Build") {
sh "sed -i '' 's/{{BUILD_VERSION}}/${buildVersion}/g' config.ru"
ocutil.ocBuild("rubex-dev", "frontend", config.dev.build.frontend) ocutil.ocBuild("rubex-dev", "frontend", config.dev.build.frontend)
} }
@ -26,10 +31,6 @@ node() {
if (isPromoteToTest) { if (isPromoteToTest) {
stage("Deploy to TEST") { stage("Deploy to TEST") {
def buildVersion = sh(script: "${gitVersionCmd} /showvariable FullSemVer", returnStdout: true).trim()
def tagVersion = sh(script: "${gitVersionCmd} /showvariable MajorMinorPatch", returnStdout: true).trim()
echo "versions: buildVersion=${buildVersion}, tagVersion=${tagVersion}"
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'github-omallo', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD']]) { withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'github-omallo', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD']]) {
sh "git tag ${tagVersion}" sh "git tag ${tagVersion}"
sh "git push --tags https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/omallo/ruby-ex.git" sh "git push --tags https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/omallo/ruby-ex.git"