2022-02-09 14:48:01 +00:00
|
|
|
def runWorkers = true
|
2019-11-22 13:50:19 +00:00
|
|
|
pipeline{
|
2019-12-11 13:55:40 +00:00
|
|
|
agent none
|
2019-11-22 13:50:19 +00:00
|
|
|
stages {
|
2020-02-07 16:56:08 +00:00
|
|
|
stage ('Early checks') {
|
2021-08-23 13:06:55 +00:00
|
|
|
agent { node { label 'built-in' } }
|
2019-12-11 13:55:40 +00:00
|
|
|
stages {
|
2022-02-09 14:48:01 +00:00
|
|
|
stage ('Checkout') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Check for documentation only changes') {
|
|
|
|
when {
|
|
|
|
expression {
|
|
|
|
return docsFileOnly()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
runWorkers = false
|
|
|
|
echo "Documentation only changes, no need to run the CI"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-11 16:49:32 +00:00
|
|
|
stage ('Check for RFC/WIP builds') {
|
|
|
|
when {
|
|
|
|
changeRequest comparator: 'REGEXP', title: '.*(rfc|RFC|wip|WIP).*'
|
|
|
|
beforeAgent true
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
error("Failing as this is marked as a WIP or RFC PR.")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Cancel older builds') {
|
2021-08-24 13:16:57 +00:00
|
|
|
when { not { branch 'main' } }
|
2019-12-11 13:55:40 +00:00
|
|
|
steps {
|
|
|
|
cancelPreviousBuilds()
|
|
|
|
}
|
|
|
|
}
|
2019-11-22 13:50:19 +00:00
|
|
|
}
|
2019-05-23 15:45:13 +00:00
|
|
|
}
|
2020-02-07 16:56:08 +00:00
|
|
|
stage ('Build') {
|
2021-12-02 16:48:22 +00:00
|
|
|
parallel {
|
2020-02-07 16:56:08 +00:00
|
|
|
stage ('Worker build') {
|
2021-12-10 15:24:27 +00:00
|
|
|
agent { node { label 'hirsute' } }
|
2022-02-09 14:48:01 +00:00
|
|
|
when {
|
|
|
|
beforeAgent true
|
|
|
|
expression {
|
|
|
|
return runWorkers
|
|
|
|
}
|
|
|
|
}
|
2020-02-07 16:56:08 +00:00
|
|
|
stages {
|
|
|
|
stage ('Checkout') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
2021-12-06 17:45:17 +00:00
|
|
|
|
2020-08-13 14:56:22 +00:00
|
|
|
stage ('Run OpenAPI tests') {
|
|
|
|
steps {
|
|
|
|
sh "scripts/run_openapi_tests.sh"
|
|
|
|
}
|
|
|
|
}
|
2020-02-17 15:07:01 +00:00
|
|
|
stage ('Run unit tests') {
|
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --unit"
|
|
|
|
}
|
|
|
|
}
|
2020-02-07 16:56:08 +00:00
|
|
|
stage ('Run integration tests') {
|
2020-11-27 16:39:03 +00:00
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
2020-02-07 16:56:08 +00:00
|
|
|
steps {
|
2021-05-27 12:55:57 +00:00
|
|
|
sh "sudo modprobe openvswitch"
|
2020-02-10 15:19:49 +00:00
|
|
|
sh "scripts/dev_cli.sh tests --integration"
|
2020-02-07 16:56:08 +00:00
|
|
|
}
|
|
|
|
}
|
2020-06-10 07:47:18 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-07 08:59:15 +00:00
|
|
|
stage ('AArch64 worker build') {
|
|
|
|
agent { node { label 'bionic-arm64' } }
|
2022-02-09 14:48:01 +00:00
|
|
|
when {
|
|
|
|
beforeAgent true
|
|
|
|
expression {
|
|
|
|
return runWorkers
|
|
|
|
}
|
|
|
|
}
|
2020-08-07 08:59:15 +00:00
|
|
|
stages {
|
|
|
|
stage ('Checkout') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run unit tests') {
|
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --unit"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run integration tests') {
|
2020-11-27 16:39:03 +00:00
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
2020-08-07 08:59:15 +00:00
|
|
|
steps {
|
2021-05-27 12:55:57 +00:00
|
|
|
sh "sudo modprobe openvswitch"
|
2020-08-07 08:59:15 +00:00
|
|
|
sh "scripts/dev_cli.sh tests --integration"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-19 12:15:36 +00:00
|
|
|
post {
|
|
|
|
always {
|
|
|
|
sh "sudo chown -R jenkins.jenkins ${WORKSPACE}"
|
|
|
|
deleteDir()
|
|
|
|
}
|
|
|
|
}
|
2020-08-07 08:59:15 +00:00
|
|
|
}
|
2020-06-10 07:47:18 +00:00
|
|
|
stage ('Worker build (musl)') {
|
2021-12-10 15:24:27 +00:00
|
|
|
agent { node { label 'hirsute' } }
|
2022-02-09 14:48:01 +00:00
|
|
|
when {
|
|
|
|
beforeAgent true
|
|
|
|
expression {
|
|
|
|
return runWorkers
|
|
|
|
}
|
|
|
|
}
|
2020-06-10 07:47:18 +00:00
|
|
|
stages {
|
|
|
|
stage ('Checkout') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
2021-12-06 17:45:17 +00:00
|
|
|
|
2020-04-29 11:31:56 +00:00
|
|
|
stage ('Run unit tests for musl') {
|
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --unit --libc musl"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run integration tests for musl') {
|
2020-11-27 16:39:03 +00:00
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
2020-04-29 11:31:56 +00:00
|
|
|
steps {
|
2021-05-27 12:55:57 +00:00
|
|
|
sh "sudo modprobe openvswitch"
|
2020-04-29 11:31:56 +00:00
|
|
|
sh "scripts/dev_cli.sh tests --integration --libc musl"
|
|
|
|
}
|
|
|
|
}
|
2019-12-11 13:55:40 +00:00
|
|
|
}
|
|
|
|
}
|
2021-09-03 14:56:50 +00:00
|
|
|
stage ('Worker build SGX') {
|
|
|
|
agent { node { label 'bionic-sgx' } }
|
|
|
|
when {
|
|
|
|
beforeAgent true
|
2022-02-09 14:48:01 +00:00
|
|
|
allOf {
|
|
|
|
branch 'main'
|
|
|
|
expression {
|
|
|
|
return runWorkers
|
|
|
|
}
|
|
|
|
}
|
2021-09-03 14:56:50 +00:00
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage ('Checkout') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run SGX integration tests') {
|
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --integration-sgx"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run SGX integration tests for musl') {
|
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --integration-sgx --libc musl"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
sh "sudo chown -R jenkins.jenkins ${WORKSPACE}"
|
|
|
|
deleteDir()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Worker build VFIO') {
|
|
|
|
agent { node { label 'bionic-vfio' } }
|
|
|
|
when {
|
|
|
|
beforeAgent true
|
2022-02-09 14:48:01 +00:00
|
|
|
allOf {
|
|
|
|
branch 'main'
|
|
|
|
expression {
|
|
|
|
return runWorkers
|
|
|
|
}
|
|
|
|
}
|
2021-09-03 14:56:50 +00:00
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage ('Checkout') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run VFIO integration tests') {
|
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --integration-vfio"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run VFIO integration tests for musl') {
|
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --integration-vfio --libc musl"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
sh "sudo chown -R jenkins.jenkins ${WORKSPACE}"
|
|
|
|
deleteDir()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-10-07 14:34:18 +00:00
|
|
|
stage ('Worker build - Windows guest') {
|
2021-12-10 15:24:27 +00:00
|
|
|
agent { node { label 'hirsute' } }
|
2022-02-09 14:48:01 +00:00
|
|
|
when {
|
|
|
|
beforeAgent true
|
|
|
|
expression {
|
|
|
|
return runWorkers
|
|
|
|
}
|
|
|
|
}
|
2021-06-21 14:54:29 +00:00
|
|
|
environment {
|
|
|
|
AZURE_CONNECTION_STRING = credentials('46b4e7d6-315f-4cc1-8333-b58780863b9b')
|
|
|
|
}
|
2020-10-07 14:34:18 +00:00
|
|
|
stages {
|
|
|
|
stage ('Checkout') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
2021-12-02 16:48:22 +00:00
|
|
|
stage ('Install azure-cli') {
|
2021-01-08 15:47:05 +00:00
|
|
|
steps {
|
2021-12-03 17:17:23 +00:00
|
|
|
installAzureCli()
|
2021-12-02 16:48:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Download assets') {
|
|
|
|
steps {
|
2021-01-08 15:47:05 +00:00
|
|
|
sh "mkdir ${env.HOME}/workloads"
|
2021-06-21 14:54:29 +00:00
|
|
|
sh 'az storage blob download --container-name private-images --file "$HOME/workloads/windows-server-2019.raw" --name windows-server-2019.raw --connection-string "$AZURE_CONNECTION_STRING"'
|
2021-01-08 15:47:05 +00:00
|
|
|
}
|
|
|
|
}
|
2020-10-07 14:34:18 +00:00
|
|
|
stage ('Run Windows guest integration tests') {
|
2020-11-27 16:39:03 +00:00
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
2020-10-07 14:34:18 +00:00
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --integration-windows"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run Windows guest integration tests for musl') {
|
2020-11-27 16:39:03 +00:00
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
2020-10-07 14:34:18 +00:00
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --integration-windows --libc musl"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-08-27 22:46:42 +00:00
|
|
|
stage ('Worker build - Live Migration') {
|
2021-12-10 15:24:27 +00:00
|
|
|
agent { node { label 'hirsute-small' } }
|
2022-02-09 14:48:01 +00:00
|
|
|
when {
|
|
|
|
beforeAgent true
|
|
|
|
expression {
|
|
|
|
return runWorkers
|
|
|
|
}
|
|
|
|
}
|
2021-08-27 22:46:42 +00:00
|
|
|
stages {
|
|
|
|
stage ('Checkout') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run live-migration integration tests') {
|
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
|
|
|
steps {
|
2021-09-09 04:44:27 +00:00
|
|
|
sh "sudo modprobe openvswitch"
|
2021-08-27 22:46:42 +00:00
|
|
|
sh "scripts/dev_cli.sh tests --integration-live-migration"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run live-migration integration tests for musl') {
|
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
|
|
|
steps {
|
2021-09-09 04:44:27 +00:00
|
|
|
sh "sudo modprobe openvswitch"
|
2021-08-27 22:46:42 +00:00
|
|
|
sh "scripts/dev_cli.sh tests --integration-live-migration --libc musl"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-12-11 07:49:06 +00:00
|
|
|
}
|
|
|
|
}
|
2019-12-11 13:55:40 +00:00
|
|
|
}
|
2020-08-05 09:39:19 +00:00
|
|
|
post {
|
|
|
|
regression {
|
2020-08-05 12:29:52 +00:00
|
|
|
script {
|
2021-08-24 13:16:57 +00:00
|
|
|
if (env.BRANCH_NAME == 'main') {
|
|
|
|
slackSend (color: '#ff0000', message: '"main" branch build is now failing')
|
2020-08-05 12:29:52 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-05 09:39:19 +00:00
|
|
|
}
|
|
|
|
fixed {
|
2020-08-05 12:29:52 +00:00
|
|
|
script {
|
2021-08-24 13:16:57 +00:00
|
|
|
if (env.BRANCH_NAME == 'main') {
|
|
|
|
slackSend (color: '#00ff00', message: '"main" branch build is now fixed')
|
2020-08-05 12:29:52 +00:00
|
|
|
}
|
|
|
|
}
|
2020-08-05 09:39:19 +00:00
|
|
|
}
|
|
|
|
}
|
2019-12-11 13:55:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
def cancelPreviousBuilds() {
|
|
|
|
// Check for other instances of this particular build, cancel any that are older than the current one
|
|
|
|
def jobName = env.JOB_NAME
|
|
|
|
def currentBuildNumber = env.BUILD_NUMBER.toInteger()
|
|
|
|
def currentJob = Jenkins.instance.getItemByFullName(jobName)
|
|
|
|
|
|
|
|
// Loop through all instances of this particular job/branch
|
|
|
|
for (def build : currentJob.builds) {
|
|
|
|
if (build.isBuilding() && (build.number.toInteger() < currentBuildNumber)) {
|
|
|
|
echo "Older build still queued. Sending kill signal to build number: ${build.number}"
|
|
|
|
build.doStop()
|
2019-11-22 13:50:19 +00:00
|
|
|
}
|
2019-05-23 15:45:13 +00:00
|
|
|
}
|
2020-06-17 10:16:19 +00:00
|
|
|
}
|
2021-12-03 17:17:23 +00:00
|
|
|
|
|
|
|
def installAzureCli() {
|
|
|
|
sh "sudo apt install -y ca-certificates curl apt-transport-https lsb-release gnupg"
|
|
|
|
sh "curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/microsoft.gpg > /dev/null"
|
|
|
|
sh "echo \"deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ hirsute main\" | sudo tee /etc/apt/sources.list.d/azure-cli.list"
|
|
|
|
sh "sudo apt update"
|
|
|
|
sh "sudo apt install -y azure-cli"
|
2021-12-10 15:24:27 +00:00
|
|
|
}
|
2022-02-09 14:48:01 +00:00
|
|
|
|
|
|
|
def boolean docsFileOnly() {
|
|
|
|
if (env.CHANGE_TARGET == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sh(
|
|
|
|
returnStatus: true,
|
|
|
|
script: "git diff --name-only origin/${env.CHANGE_TARGET}... | grep -v '\\.md'"
|
|
|
|
) != 0
|
|
|
|
}
|