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'>
<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>
<div class="row">

View File

@ -10,7 +10,12 @@ node() {
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") {
sh "sed -i '' 's/{{BUILD_VERSION}}/${buildVersion}/g' config.ru"
ocutil.ocBuild("rubex-dev", "frontend", config.dev.build.frontend)
}
@ -26,10 +31,6 @@ node() {
if (isPromoteToTest) {
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']]) {
sh "git tag ${tagVersion}"
sh "git push --tags https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/omallo/ruby-ex.git"