2017-01-03 21:38:32 +00:00
|
|
|
@Library('occd') _
|
2016-12-15 16:35:06 +00:00
|
|
|
|
|
|
|
node() {
|
2016-12-09 15:48:52 +00:00
|
|
|
stage("Checkout") {
|
2017-01-02 03:00:35 +00:00
|
|
|
deleteDir()
|
2017-01-03 23:49:51 +00:00
|
|
|
git(url: "https://github.com/omallo/ruby-ex.git", branch: "master", credentialsId: "github-omallo")
|
2016-12-09 15:48:52 +00:00
|
|
|
}
|
2016-12-09 15:41:36 +00:00
|
|
|
|
2017-01-03 21:38:32 +00:00
|
|
|
def config = occd.parseConfig(readFile("deployment/config.yaml"))
|
2016-12-09 14:55:28 +00:00
|
|
|
|
2017-01-03 23:41:10 +00:00
|
|
|
def buildVersion = occd.getBuildVersion()
|
|
|
|
def releaseVersion = occd.getReleaseVersion()
|
2017-01-02 23:29:33 +00:00
|
|
|
|
2016-12-09 15:48:52 +00:00
|
|
|
stage("Build") {
|
2017-01-03 23:44:43 +00:00
|
|
|
echo "versions: build=${buildVersion}, next-release=${releaseVersion}"
|
2017-01-02 23:32:19 +00:00
|
|
|
sh "sed -e 's/{{BUILD_VERSION}}/${buildVersion}/g' -i config.ru"
|
2017-01-03 21:38:32 +00:00
|
|
|
occd.build("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") {
|
2017-01-04 00:19:16 +00:00
|
|
|
occd.tag("rubex-dev", "frontend", "b-master", "dev")
|
2017-01-03 21:38:32 +00:00
|
|
|
occd.rollout("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 04:07:48 +00:00
|
|
|
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'github-omallo', usernameVariable: 'GIT_USERNAME', passwordVariable: 'GIT_PASSWORD']]) {
|
2017-01-03 23:41:10 +00:00
|
|
|
sh "git tag ${releaseVersion}"
|
2017-01-02 04:07:48 +00:00
|
|
|
sh "git push --tags https://${GIT_USERNAME}:${GIT_PASSWORD}@github.com/omallo/ruby-ex.git"
|
|
|
|
}
|
2017-01-02 02:45:03 +00:00
|
|
|
|
2017-01-03 23:41:10 +00:00
|
|
|
occd.tag("rubex-dev", "frontend", "dev", releaseVersion)
|
|
|
|
occd.tag("rubex-dev", "frontend", releaseVersion, "test")
|
2017-01-03 21:38:32 +00:00
|
|
|
occd.rollout("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
|
|
|
}
|