ruby-ex/deployment/pipeline.groovy

41 lines
1.4 KiB
Groovy
Raw Normal View History

2016-12-16 10:34:37 +00:00
@Library('ocutil') _
node() {
2016-12-09 15:48:52 +00:00
stage("Checkout") {
2017-01-02 03:00:35 +00:00
deleteDir()
2017-01-02 03:10:21 +00:00
git(url: "https://github.com/omallo/ruby-ex.git", credentialsId: "github-omallo")
2016-12-09 15:48:52 +00:00
}
2016-12-09 15:41:36 +00:00
2017-01-02 03:46:42 +00:00
def gitVersionCmd = "mono /usr/local/GitVersion_3.6.5/GitVersion.exe"
def buildVersion = sh(script: "${gitVersionCmd} /showvariable FullSemVer", returnStdout: true).trim()
def tagVersion = sh(script: "${gitVersionCmd} /showvariable MajorMinorPatch", returnStdout: true).trim()
2017-01-02 03:36:29 +00:00
echo "versions: buildVersion=${buildVersion}, tagVersion=${tagVersion}"
2017-01-02 02:45:03 +00:00
2016-12-16 10:42:14 +00:00
def config = ocutil.parseConfig(readFile("deployment/config.yaml"))
2016-12-09 14:55:28 +00:00
2016-12-09 15:48:52 +00:00
stage("Build") {
2016-12-16 10:49:10 +00:00
ocutil.ocBuild("rubex-dev", "frontend", config.dev.build.frontend)
2016-12-05 14:32:22 +00:00
}
2016-12-09 15:48:52 +00:00
stage("Deploy to DEV") {
2016-12-16 10:40:33 +00:00
ocutil.ocTag("rubex-dev", "frontend", "latest", "dev")
ocutil.ocDeploy("rubex-dev", "frontend", config.dev.deployment.frontend)
2016-12-05 14:32:22 +00:00
}
def isPromoteToTest = false
2016-12-09 13:33:03 +00:00
stage("Promote to TEST?") {
isPromoteToTest = input(message: "Promotion", parameters: [booleanParam(defaultValue: false, name: "Promote to TEST?")])
2016-12-05 14:32:22 +00:00
}
if (isPromoteToTest) {
2016-12-09 13:33:03 +00:00
stage("Deploy to TEST") {
2017-01-02 03:36:29 +00:00
sh "git tag ${releaseVersion}"
2017-01-02 02:45:03 +00:00
sh "git push --tags"
2017-01-02 03:36:29 +00:00
ocutil.ocTag("rubex-dev", "frontend", "dev", releaseVersion)
ocutil.ocTag("rubex-dev", "frontend", releaseVersion, "test")
2016-12-16 10:40:33 +00:00
ocutil.ocDeploy("rubex-test", "frontend", config.test.deployment.frontend)
2016-12-05 14:32:22 +00:00
}
2016-12-09 15:48:52 +00:00
}
2016-12-05 14:32:22 +00:00
}