Merge "Additions to airship-seaworthy pipeline"

This commit is contained in:
Zuul 2018-10-10 20:05:14 +00:00 committed by Gerrit Code Review
commit 941f9b5186

112
tools/gate/Jenkinsfile vendored
View File

@ -52,6 +52,10 @@ def clone(String url, String ref){
refspec = "${ref}:${ref}" refspec = "${ref}:${ref}"
} }
if (ref == 'latest') {
ref = 'master'
}
checkout poll: false, checkout poll: false,
scm: [$class: 'GitSCM', scm: [$class: 'GitSCM',
branches: [[name: ref]], branches: [[name: ref]],
@ -191,6 +195,10 @@ def genesis_cleanup = {
ssh_cmd "sudo parted -s /dev/sd${it} mklabel msdos" ssh_cmd "sudo parted -s /dev/sd${it} mklabel msdos"
} }
ssh_cmd 'sudo rm -rf /var/lib/ceph/cp' ssh_cmd 'sudo rm -rf /var/lib/ceph/cp'
ssh_cmd 'sudo rm -rf /var/lib/docker'
ssh_cmd 'sudo rm -rf /var/lib/kubelet'
ssh_cmd 'sudo rm -rf /var/lib/openstack-helm'
} }
} }
@ -210,10 +218,13 @@ def genesis_deploy = {
timeout (90) { timeout (90) {
ssh_cmd 'sudo promenade-bundle/genesis.sh' ssh_cmd 'sudo promenade-bundle/genesis.sh'
ssh_cmd 'sudo -S promenade-bundle/validate-genesis.sh'
retry(3) {
ssh_cmd 'sudo -S promenade-bundle/validate-genesis.sh'
}
} }
sleep 47 // wait for k8s to calm down sleep 120 // wait for k8s to calm down
} catch (err) { } catch (err) {
debug_report() debug_report()
@ -240,10 +251,15 @@ def keystone_token = {
def res def res
retry (3) { retry (3) {
res = httpRequest (url: KEYSTONE_URL, try {
res = httpRequest (url: KEYSTONE_URL,
contentType: 'APPLICATION_JSON', contentType: 'APPLICATION_JSON',
httpMode: 'POST', httpMode: 'POST',
requestBody: jreq) requestBody: jreq)
} catch (err) {
sleep 120
error(err)
}
} }
return res.getHeaders()['X-Subject-Token'][0] return res.getHeaders()['X-Subject-Token'][0]
@ -266,11 +282,19 @@ def shipyard_config_upload = {
manifests += readFile it.path manifests += readFile it.path
} }
def res = httpRequest (url: "${SHIPYARD_URL}/configdocs/${SITE_NAME}?buffermode=replace", def res
retry(3) {
try {
res = httpRequest (url: "${SHIPYARD_URL}/configdocs/${SITE_NAME}?buffermode=replace",
httpMode: 'POST', httpMode: 'POST',
customHeaders: [[name: 'Content-Type', value: 'application/x-yaml'], customHeaders: [[name: 'Content-Type', value: 'application/x-yaml'],
[name: 'X-Auth-Token', value: token]], [name: 'X-Auth-Token', value: token]],
requestBody: manifests) requestBody: manifests)
} catch (err) {
sleep 120
error(err)
}
}
if (res.status != 201) { if (res.status != 201) {
error("Failed to upload configdocs: ${res.status}") error("Failed to upload configdocs: ${res.status}")
@ -388,7 +412,6 @@ def shipyard_action_create = { action ->
def shipyard_deploy = { action -> def shipyard_deploy = { action ->
try { try {
shipyard_config_upload() shipyard_config_upload()
shipyard_action_create(action) shipyard_action_create(action)
@ -397,14 +420,74 @@ def shipyard_deploy = { action ->
error(err) 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'
ssh_cmd 'sudo kubectl get pods --all-namespaces -o wide -a=false |grep kubernetes-proxy'
}
//// 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 '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'
}
}
}
//// test utils
def sanity_tests = {
stage('Sanity Tests') {
sh 'sudo apt-get install nmap -y'
withEnv(['TERM_OPTS=-i',
'OSH_EXT_SUBNET=',
'OSH_BR_EX_ADDR=']) {
sh 'tools/tests.sh'
}
}
} }
//// main flow //// main flow
vm2() { vm2() {
// wait and make sure genesis is up, and remove docker // wait and make sure genesis is up, and remove docker
// this ensures no containers are running after reboot // this ensures no containers are running after reboot
gen_wait() gen_wait()
@ -417,6 +500,11 @@ vm2() {
clone(AIRSHIP_MANIFESTS_REPO, AIRSHIP_MANIFESTS_REF) clone(AIRSHIP_MANIFESTS_REPO, AIRSHIP_MANIFESTS_REF)
// use updater tool to pull latest charts/images
if (AIRSHIP_MANIFESTS_REF == 'latest') {
uplift_versions()
}
resolve_versions() resolve_versions()
pegleg_site_collect() pegleg_site_collect()
@ -429,6 +517,14 @@ vm2() {
genesis_cleanup() genesis_cleanup()
genesis_deploy() genesis_deploy()
shipyard_deploy('deploy_site') timeout(240) {
shipyard_deploy('deploy_site')
}
sanity_tests()
if (AIRSHIP_MANIFESTS_REF == 'latest') {
uplift_review()
}
} }