Skip to content

Commit

Permalink
Move upgrade from 4.2 job to shared libs
Browse files Browse the repository at this point in the history
Also merges the 2 jobs into one
  • Loading branch information
Itxaka committed Dec 3, 2020
1 parent 5d10512 commit 292fe80
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 288 deletions.
1 change: 0 additions & 1 deletion ci/jenkins/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@
jobs:
- '{name}/{platform}/{test}-daily'
- '{name}/{platform}/update-daily'
- '{name}/{platform}/trigger-upgrade-from-4-2-daily'
- '{name}/{platform}/upgrade-from-4-2-daily'

- project:
Expand Down
98 changes: 0 additions & 98 deletions ci/jenkins/pipelines/skuba-trigger-upgrade-from-4.2.Jenkinsfile

This file was deleted.

140 changes: 5 additions & 135 deletions ci/jenkins/pipelines/skuba-upgrade-from-4.2.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,137 +1,7 @@
def cleanup_cluster=true
/*
* This pipeline runs the skuba upgrade from 4.2
*/

pipeline {

agent { label "${WORKER_LABEL}" }

environment {
SKUBA_BINPATH = "/home/jenkins/go/bin/skuba"
OPENSTACK_OPENRC = credentials('ecp-openrc')
GITHUB_TOKEN = credentials('github-token')
VMWARE_ENV_FILE = credentials('vmware-env')
TERRAFORM_STACK_NAME = "${BUILD_NUMBER}-${JOB_NAME.replaceAll("/","-")}".take(70)
}

stages {

stage("Build skuba"){
steps{
sh(script: "git checkout ${INITIAL_VERSION}")
sh(script: "make -f Makefile install", label: "Build Skuba ${INITIAL_VERSION}")
}
}

stage('Provision cluster') {
steps {
sh(script: 'make -f ci/Makefile provision', label: 'Provision')
}
}

stage('Deploy cluster') {
steps {
sh(script: 'make -f ci/Makefile deploy KUBERNETES_VERSION=${KUBERNETES_VERSION}', label: 'Deploy')
sh(script: 'make -f ci/Makefile check_cluster', label: 'Check cluster')
}
}

stage('upgrade admin node') {
environment {
REG_CODE = credentials('scc-regcode-caasp')
}
steps {
echo 'upgrading sles'
sh "sudo sudo zypper in -y --no-recommends zypper-migration-plugin"
sh "sudo SUSEConnect -r ${REG_CODE}"
sh "sudo zypper migration --migration 2 --no-recommends --non-interactive --auto-agree-with-licenses"
echo "upgrade completed"
}
}

stage('reboot'){
agent { label 'caasp-team-private-integration' }
environment {
JENKINS_ID = credentials('jenkins-ssh')
}
steps{
echo 'rebooting ${WORKER_HOST} ...'
sh "ssh -i ${JENKINS_ID} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T jenkins@${WORKER_HOST} sudo reboot &"

sleep 120

timeout(180){
waitUntil { script {
sh(script: "ssh -i ${JENKINS_ID} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -T jenkins@${WORKER_HOST} sudo systemctl is-active --quiet swarm-client", returnStatus: true) == 0
}}
}
}
}

stage('Inhibit kured reboots') { steps {
sh(script: 'make -f ci/Makefile inhibit_kured')
}
}
stage('upgrade skuba') {
steps {
sh(script: "sudo zypper in -y --no-recommends go1.13")
sh(script: "git checkout -f ${TARGET_VERSION}")
sh(script: "make install", label: "Build ${TARGET_VERSION}")
}
}

stage('upgrade cluster'){
environment {
REG_CODE = credentials('scc-regcode-caasp')

}
steps {
sh(script: "make -f ci/Makefile test SUITE='test_upgrade_from_4_2' SKIP_SETUP='deployed'", label: "Test upgrade")
}
}
}
post {
always { script {
archiveArtifacts(artifacts: "ci/infra/${PLATFORM}/terraform.tfstate", allowEmptyArchive: true)
archiveArtifacts(artifacts: "ci/infra/${PLATFORM}/terraform.tfvars.json", allowEmptyArchive: true)
archiveArtifacts(artifacts: 'testrunner.log', allowEmptyArchive: true)
// only attempt to collect logs if platform was provisioned
if (fileExists("tfout.json")) {
archiveArtifacts(artifacts: 'tfout.json', allowEmptyArchive: true)
sh(script: "make --keep-going -f ci/Makefile gather_logs", label: 'Gather Logs')
archiveArtifacts(artifacts: 'platform_logs/**/*', allowEmptyArchive: true)
}
if (Boolean.parseBoolean(env.RETAIN_CLUSTER)) {
def retention_period= env.RETENTION_PERIOD?env.RETENTION_PERIOD:24
try{
timeout(time: retention_period, unit: 'HOURS'){
input(message: 'Waiting '+retention_period +' hours before cleaning up cluster \n. ' +
'Press <abort> to cleanup inmediately, <keep> for keeping it',
ok: 'keep')
cleanup_cluster = false
}
}catch (err){
// either timeout occurred or <abort> was selected
cleanup_cluster = true
}
}
}}
cleanup{ script{
if(cleanup_cluster){
sh(script: "make --keep-going -f ci/Makefile cleanup", label: 'Cleanup')
}
dir("${WORKSPACE}@tmp") {
deleteDir()
}
dir("${WORKSPACE}@script") {
deleteDir()
}
dir("${WORKSPACE}@script@tmp") {
deleteDir()
}
dir("${WORKSPACE}") {
deleteDir()
}
sh(script: "rm -f ${SKUBA_BINPATH}; ", label: 'Remove built skuba')
}}
}
}
@Library('caasp-jenkins-lib@master') _

upgradeFrom42()
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- job-template:
name: '{name}/{platform}/trigger-upgrade-from-4-2-daily'
name: '{name}/{platform}/upgrade-from-4-2-daily'
project-type: pipeline
number-to-keep: 30
days-to-keep: 30
Expand All @@ -15,10 +15,6 @@
name: PLATFORM
default: '{platform}'
description: The platform to perform the tests on
- string:
name: DOWNSTREAM_JOB
description: Job to be triggered downstream
default: '{name}/{platform}/upgrade-from-4-2-daily'
- string:
name: WORKER_TEMPLATE
description: Template for worker
Expand Down Expand Up @@ -53,5 +49,5 @@
- '$BRANCH'
browser: auto
suppress-automatic-scm-triggering: true
script-path: ci/jenkins/pipelines/skuba-trigger-upgrade-from-4.2.Jenkinsfile
script-path: ci/jenkins/pipelines/skuba-upgrade-from-4.2.Jenkinsfile

48 changes: 0 additions & 48 deletions ci/jenkins/templates/upgrade-from-4.2.yaml

This file was deleted.

0 comments on commit 292fe80

Please sign in to comment.