Created
March 5, 2020 09:23
-
-
Save FyberEngineers/c96729dc7ae6356b7185576d67279b74 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!branch.startsWith('ST-')){ | |
stage('Deploy') { | |
def incrementVersion = { | |
def environment = { | |
switch(branch) { | |
case 'develop': 'development.json' | |
break | |
case 'master': 'production.json' | |
break | |
default: 'qa.json' | |
} | |
} | |
def environmentFileContent = readFile environment | |
def environmentJson = new groovy.json.JsonSlurper().parseText(environmentFileContent) | |
environmentJson.default_attributes.volcano.version = "volcano-${version}" | |
String environmentPrettyJsonString = new groovy.json.JsonBuilder(environmentJson).toPrettyString() | |
environmentJson = null | |
writeFile file: $environment, text: environmentPrettyJsonString | |
sh "git commit -am 'Changed volcano version in $environment env to '${version}" | |
sh "git push" | |
} | |
checkout changelog: false, poll: false, scm: [$class: 'GitSCM', browser: [$class: 'BitbucketWeb', repoUrl: 'https://bitbucket.org/fullgc/chef'], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: | |
'**']], submoduleCfg: [], userRemoteConfigs: [[url: 'git@bitbucket.org:fullgc/chef']]] | |
dir('environments/') { | |
incrementVersion() | |
} | |
slackSend channel: 'server', color: 'good', message: " New volcano version ${version} is being deployed to $environment" | |
} | |
if (branch == 'develop' || branch == 'master') sh "rm releases.txt" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment