Add uplift feature for Airship Seaworthy pipeline

Change-Id: I80bfe749e46709cb4f4ad0892613c090342a3c33
This commit is contained in:
Kaspars Skels 2018-09-19 13:22:33 -05:00
parent f9afea172d
commit c794496b47
1 changed files with 60 additions and 3 deletions

View File

@ -52,6 +52,10 @@ def clone(String url, String ref){
refspec = "${ref}:${ref}"
}
if (ref == 'latest') {
ref = 'master'
}
checkout poll: false,
scm: [$class: 'GitSCM',
branches: [[name: ref]],
@ -388,7 +392,6 @@ def shipyard_action_create = { action ->
def shipyard_deploy = { action ->
try {
shipyard_config_upload()
shipyard_action_create(action)
@ -397,14 +400,59 @@ def shipyard_deploy = { action ->
error(err)
}
sh 'sudo kubectl get pods --all-namespaces -o wide -a=false'
ssh_cmd 'sudo kubectl get pods --all-namespaces -o wide -a=false'
}
//// uplift utils
def uplift_versions = {
sh 'sudo apt-get install python3-yaml python3-git -y'
sh 'tools/updater.py --in-file global/software/config/versions.yaml'
sh 'mv global/software/config/versions.new.yaml global/software/config/versions.yaml'
sh 'git diff'
}
def uplift_review = {
withCredentials([sshUserPrivateKey(credentialsId: 'jenkins-uplifter-key',
keyFileVariable: 'SSH_KEY',
usernameVariable: 'SSH_USER')]) {
sh 'sudo apt-get install git-review -y'
sh "cp ${SSH_KEY} ~/.ssh/id_rsa"
sh "ssh-keyscan -p 29418 review.openstack.org >> ~/.ssh/known_hosts"
sh "git clone ssh://${SSH_USER}@review.openstack.org:29418/openstack/airship-treasuremap"
sh "scp -p -P 29418 ${SSH_USER}@review.openstack.org:hooks/commit-msg airship-treasuremap/.git/hooks/"
sh "cp global/software/config/versions.yaml airship-treasuremap/global/software/config/versions.yaml"
dir ('airship-treasuremap') {
sh "git config --global user.name 'Jenkins Uplifter'"
sh "git config --global user.email ${SSH_USER}@gmail.com"
sh "git config --global gitreview.username ${SSH_USER}"
sh 'git checkout -b versions/uplift'
sh 'git add global/software/config/versions.yaml'
sh 'git status'
sh 'git commit -m "Auto chart/image uplift to latest"'
sh 'git review -s'
sh 'git review'
}
}
}
//// main flow
vm2() {
// wait and make sure genesis is up, and remove docker
// this ensures no containers are running after reboot
gen_wait()
@ -417,6 +465,11 @@ vm2() {
clone(AIRSHIP_MANIFESTS_REPO, AIRSHIP_MANIFESTS_REF)
// use updater tool to pull latest charts/images
if (AIRSHIP_MANIFESTS_REF == 'latest') {
uplift_versions()
}
resolve_versions()
pegleg_site_collect()
@ -430,5 +483,9 @@ vm2() {
genesis_deploy()
shipyard_deploy('deploy_site')
if (AIRSHIP_MANIFESTS_REF == 'latest') {
uplift_review()
}
}