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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-27 09:37:10 +00:00
|
|
|
stage ('Check for fuzzer files only changes') {
|
2022-06-06 14:50:33 +00:00
|
|
|
when {
|
|
|
|
expression {
|
2022-07-27 09:37:10 +00:00
|
|
|
return fuzzFileOnly()
|
2022-06-06 14:50:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
script {
|
|
|
|
runWorkers = false
|
|
|
|
echo "Fuzzer cargo files 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') {
|
2022-02-25 11:11:30 +00:00
|
|
|
parallel {
|
2020-02-07 16:56:08 +00:00
|
|
|
stage ('Worker build') {
|
2022-05-23 15:06:53 +00:00
|
|
|
agent { node { label 'jammy' } }
|
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
|
|
|
|
}
|
|
|
|
}
|
2022-03-15 10:28:53 +00:00
|
|
|
stage ('Prepare environment') {
|
|
|
|
steps {
|
|
|
|
sh "scripts/prepare_vdpa.sh"
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
}
|
2022-08-03 21:52:53 +00:00
|
|
|
environment {
|
|
|
|
AZURE_CONNECTION_STRING = credentials('46b4e7d6-315f-4cc1-8333-b58780863b9b')
|
|
|
|
}
|
2020-08-07 08:59:15 +00:00
|
|
|
stages {
|
|
|
|
stage ('Checkout') {
|
|
|
|
steps {
|
|
|
|
checkout scm
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run unit tests') {
|
|
|
|
steps {
|
2022-03-02 11:46:52 +00:00
|
|
|
sh "scripts/dev_cli.sh tests --unit --libc musl"
|
2020-08-07 08:59:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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"
|
2022-03-02 11:46:52 +00:00
|
|
|
sh "scripts/dev_cli.sh tests --integration --libc musl"
|
2020-08-07 08:59:15 +00:00
|
|
|
}
|
|
|
|
}
|
2022-08-03 21:52:53 +00:00
|
|
|
stage ('Install azure-cli') {
|
|
|
|
steps {
|
|
|
|
installAzureCli("bionic", "arm64")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Download Windows image') {
|
|
|
|
steps {
|
|
|
|
sh '''#!/bin/bash -x
|
|
|
|
IMG_BASENAME=windows-11-iot-enterprise-aarch64.raw
|
|
|
|
IMG_PATH=$HOME/workloads/$IMG_BASENAME
|
|
|
|
IMG_GZ_PATH=$HOME/workloads/$IMG_BASENAME.gz
|
|
|
|
IMG_GZ_BLOB_NAME=windows-11-iot-enterprise-aarch64-9-min.raw.gz
|
|
|
|
cp "scripts/$IMG_BASENAME.sha1" "$HOME/workloads/"
|
|
|
|
pushd "$HOME/workloads"
|
|
|
|
if sha1sum "$IMG_BASENAME.sha1" --check; then
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
popd
|
|
|
|
mkdir -p "$HOME/workloads"
|
|
|
|
az storage blob download \
|
|
|
|
--container-name private-images \
|
|
|
|
--file "$IMG_GZ_PATH" \
|
|
|
|
--name "$IMG_GZ_BLOB_NAME" \
|
|
|
|
--connection-string "$AZURE_CONNECTION_STRING"
|
|
|
|
gzip -d $IMG_GZ_PATH
|
|
|
|
'''
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage ('Run Windows guest integration tests') {
|
|
|
|
options {
|
|
|
|
timeout(time: 1, unit: 'HOURS')
|
|
|
|
}
|
|
|
|
steps {
|
|
|
|
sh "scripts/dev_cli.sh tests --integration-windows --libc musl"
|
|
|
|
}
|
|
|
|
}
|
2020-08-07 08:59:15 +00:00
|
|
|
}
|
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)') {
|
2022-05-23 15:06:53 +00:00
|
|
|
agent { node { label 'jammy' } }
|
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
|
|
|
|
}
|
|
|
|
}
|
2022-03-15 10:28:53 +00:00
|
|
|
stage ('Prepare environment') {
|
|
|
|
steps {
|
|
|
|
sh "scripts/prepare_vdpa.sh"
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|
2020-10-07 14:34:18 +00:00
|
|
|
stage ('Worker build - Windows guest') {
|
2022-05-23 15:06:53 +00:00
|
|
|
agent { node { label 'jammy' } }
|
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 {
|
2022-08-03 21:52:53 +00:00
|
|
|
installAzureCli("jammy", "amd64")
|
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') {
|
2022-08-03 14:17:19 +00:00
|
|
|
agent { node { label 'jammy' } }
|
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') {
|
2022-09-15 08:12:12 +00:00
|
|
|
slackSend (color: '#ff0000', message: '"main" branch build is now failing', channel: '#jenkins-ci')
|
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') {
|
2022-09-15 08:12:12 +00:00
|
|
|
slackSend (color: '#00ff00', message: '"main" branch build is now fixed', channel: '#jenkins-ci')
|
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
|
|
|
|
2022-08-03 21:52:53 +00:00
|
|
|
def installAzureCli(distro, arch) {
|
2021-12-03 17:17:23 +00:00
|
|
|
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"
|
2022-08-03 21:52:53 +00:00
|
|
|
sh "echo \"deb [arch=${arch}] https://packages.microsoft.com/repos/azure-cli/ ${distro} main\" | sudo tee /etc/apt/sources.list.d/azure-cli.list"
|
2021-12-03 17:17:23 +00:00
|
|
|
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
|
2022-02-25 11:11:30 +00:00
|
|
|
}
|
2022-06-06 14:50:33 +00:00
|
|
|
|
2022-07-27 09:37:10 +00:00
|
|
|
def boolean fuzzFileOnly() {
|
2022-06-06 14:50:33 +00:00
|
|
|
if (env.CHANGE_TARGET == null) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return sh(
|
|
|
|
returnStatus: true,
|
2022-07-27 09:37:10 +00:00
|
|
|
script: "git diff --name-only origin/${env.CHANGE_TARGET}... | grep -v -E 'fuzz/'"
|
2022-06-06 14:50:33 +00:00
|
|
|
) != 0
|
|
|
|
}
|