build: Run linter over Jenkinsfile

This has resulted in the content being indented with spaces rather tabs
per Groovy coding style.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2022-11-01 09:10:07 +00:00
parent 851de1e0b3
commit 65628e8d94

136
Jenkinsfile vendored
View File

@ -1,16 +1,16 @@
def runWorkers = true def runWorkers = true
pipeline{ pipeline {
agent none agent none
stages { stages {
stage ('Early checks') { stage('Early checks') {
agent { node { label 'built-in' } } agent { node { label 'built-in' } }
stages { stages {
stage ('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout scm
} }
} }
stage ('Check for documentation only changes') { stage('Check for documentation only changes') {
when { when {
expression { expression {
return docsFileOnly() return docsFileOnly()
@ -19,11 +19,11 @@ pipeline{
steps { steps {
script { script {
runWorkers = false runWorkers = false
echo "Documentation only changes, no need to run the CI" echo 'Documentation only changes, no need to run the CI'
} }
} }
} }
stage ('Check for fuzzer files only changes') { stage('Check for fuzzer files only changes') {
when { when {
expression { expression {
return fuzzFileOnly() return fuzzFileOnly()
@ -32,20 +32,20 @@ pipeline{
steps { steps {
script { script {
runWorkers = false runWorkers = false
echo "Fuzzer cargo files only changes, no need to run the CI" echo 'Fuzzer cargo files only changes, no need to run the CI'
} }
} }
} }
stage ('Check for RFC/WIP builds') { stage('Check for RFC/WIP builds') {
when { when {
changeRequest comparator: 'REGEXP', title: '.*(rfc|RFC|wip|WIP).*' changeRequest comparator: 'REGEXP', title: '.*(rfc|RFC|wip|WIP).*'
beforeAgent true beforeAgent true
} }
steps { steps {
error("Failing as this is marked as a WIP or RFC PR.") error('Failing as this is marked as a WIP or RFC PR.')
} }
} }
stage ('Cancel older builds') { stage('Cancel older builds') {
when { not { branch 'main' } } when { not { branch 'main' } }
steps { steps {
cancelPreviousBuilds() cancelPreviousBuilds()
@ -53,9 +53,9 @@ pipeline{
} }
} }
} }
stage ('Build') { stage('Build') {
parallel { parallel {
stage ('Worker build') { stage('Worker build') {
agent { node { label 'jammy' } } agent { node { label 'jammy' } }
when { when {
beforeAgent true beforeAgent true
@ -64,38 +64,38 @@ pipeline{
} }
} }
stages { stages {
stage ('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout scm
} }
} }
stage ('Prepare environment') { stage('Prepare environment') {
steps { steps {
sh "scripts/prepare_vdpa.sh" sh 'scripts/prepare_vdpa.sh'
} }
} }
stage ('Run OpenAPI tests') { stage('Run OpenAPI tests') {
steps { steps {
sh "scripts/run_openapi_tests.sh" sh 'scripts/run_openapi_tests.sh'
} }
} }
stage ('Run unit tests') { stage('Run unit tests') {
steps { steps {
sh "scripts/dev_cli.sh tests --unit" sh 'scripts/dev_cli.sh tests --unit'
} }
} }
stage ('Run integration tests') { stage('Run integration tests') {
options { options {
timeout(time: 1, unit: 'HOURS') timeout(time: 1, unit: 'HOURS')
} }
steps { steps {
sh "sudo modprobe openvswitch" sh 'sudo modprobe openvswitch'
sh "scripts/dev_cli.sh tests --integration" sh 'scripts/dev_cli.sh tests --integration'
} }
} }
} }
} }
stage ('AArch64 worker build') { stage('AArch64 worker build') {
agent { node { label 'bionic-arm64' } } agent { node { label 'bionic-arm64' } }
when { when {
beforeAgent true beforeAgent true
@ -107,31 +107,31 @@ pipeline{
AZURE_CONNECTION_STRING = credentials('46b4e7d6-315f-4cc1-8333-b58780863b9b') AZURE_CONNECTION_STRING = credentials('46b4e7d6-315f-4cc1-8333-b58780863b9b')
} }
stages { stages {
stage ('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout scm
} }
} }
stage ('Run unit tests') { stage('Run unit tests') {
steps { steps {
sh "scripts/dev_cli.sh tests --unit --libc musl" sh 'scripts/dev_cli.sh tests --unit --libc musl'
} }
} }
stage ('Run integration tests') { stage('Run integration tests') {
options { options {
timeout(time: 1, unit: 'HOURS') timeout(time: 1, unit: 'HOURS')
} }
steps { steps {
sh "sudo modprobe openvswitch" sh 'sudo modprobe openvswitch'
sh "scripts/dev_cli.sh tests --integration --libc musl" sh 'scripts/dev_cli.sh tests --integration --libc musl'
} }
} }
stage ('Install azure-cli') { stage('Install azure-cli') {
steps { steps {
installAzureCli("bionic", "arm64") installAzureCli('bionic', 'arm64')
} }
} }
stage ('Download Windows image') { stage('Download Windows image') {
steps { steps {
sh '''#!/bin/bash -x sh '''#!/bin/bash -x
IMG_BASENAME=windows-11-iot-enterprise-aarch64.raw IMG_BASENAME=windows-11-iot-enterprise-aarch64.raw
@ -154,12 +154,12 @@ pipeline{
''' '''
} }
} }
stage ('Run Windows guest integration tests') { stage('Run Windows guest integration tests') {
options { options {
timeout(time: 1, unit: 'HOURS') timeout(time: 1, unit: 'HOURS')
} }
steps { steps {
sh "scripts/dev_cli.sh tests --integration-windows --libc musl" sh 'scripts/dev_cli.sh tests --integration-windows --libc musl'
} }
} }
} }
@ -170,7 +170,7 @@ pipeline{
} }
} }
} }
stage ('Worker build (musl)') { stage('Worker build (musl)') {
agent { node { label 'jammy' } } agent { node { label 'jammy' } }
when { when {
beforeAgent true beforeAgent true
@ -179,33 +179,33 @@ pipeline{
} }
} }
stages { stages {
stage ('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout scm
} }
} }
stage ('Prepare environment') { stage('Prepare environment') {
steps { steps {
sh "scripts/prepare_vdpa.sh" sh 'scripts/prepare_vdpa.sh'
} }
} }
stage ('Run unit tests for musl') { stage('Run unit tests for musl') {
steps { steps {
sh "scripts/dev_cli.sh tests --unit --libc musl" sh 'scripts/dev_cli.sh tests --unit --libc musl'
} }
} }
stage ('Run integration tests for musl') { stage('Run integration tests for musl') {
options { options {
timeout(time: 1, unit: 'HOURS') timeout(time: 1, unit: 'HOURS')
} }
steps { steps {
sh "sudo modprobe openvswitch" sh 'sudo modprobe openvswitch'
sh "scripts/dev_cli.sh tests --integration --libc musl" sh 'scripts/dev_cli.sh tests --integration --libc musl'
} }
} }
} }
} }
stage ('Worker build - Windows guest') { stage('Worker build - Windows guest') {
agent { node { label 'jammy' } } agent { node { label 'jammy' } }
when { when {
beforeAgent true beforeAgent true
@ -217,41 +217,41 @@ pipeline{
AZURE_CONNECTION_STRING = credentials('46b4e7d6-315f-4cc1-8333-b58780863b9b') AZURE_CONNECTION_STRING = credentials('46b4e7d6-315f-4cc1-8333-b58780863b9b')
} }
stages { stages {
stage ('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout scm
} }
} }
stage ('Install azure-cli') { stage('Install azure-cli') {
steps { steps {
installAzureCli("jammy", "amd64") installAzureCli('jammy', 'amd64')
} }
} }
stage ('Download assets') { stage('Download assets') {
steps { steps {
sh "mkdir ${env.HOME}/workloads" sh "mkdir ${env.HOME}/workloads"
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"' 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"'
} }
} }
stage ('Run Windows guest integration tests') { stage('Run Windows guest integration tests') {
options { options {
timeout(time: 1, unit: 'HOURS') timeout(time: 1, unit: 'HOURS')
} }
steps { steps {
sh "scripts/dev_cli.sh tests --integration-windows" sh 'scripts/dev_cli.sh tests --integration-windows'
} }
} }
stage ('Run Windows guest integration tests for musl') { stage('Run Windows guest integration tests for musl') {
options { options {
timeout(time: 1, unit: 'HOURS') timeout(time: 1, unit: 'HOURS')
} }
steps { steps {
sh "scripts/dev_cli.sh tests --integration-windows --libc musl" sh 'scripts/dev_cli.sh tests --integration-windows --libc musl'
} }
} }
} }
} }
stage ('Worker build - Live Migration') { stage('Worker build - Live Migration') {
agent { node { label 'jammy' } } agent { node { label 'jammy' } }
when { when {
beforeAgent true beforeAgent true
@ -260,27 +260,27 @@ pipeline{
} }
} }
stages { stages {
stage ('Checkout') { stage('Checkout') {
steps { steps {
checkout scm checkout scm
} }
} }
stage ('Run live-migration integration tests') { stage('Run live-migration integration tests') {
options { options {
timeout(time: 1, unit: 'HOURS') timeout(time: 1, unit: 'HOURS')
} }
steps { steps {
sh "sudo modprobe openvswitch" sh 'sudo modprobe openvswitch'
sh "scripts/dev_cli.sh tests --integration-live-migration" sh 'scripts/dev_cli.sh tests --integration-live-migration'
} }
} }
stage ('Run live-migration integration tests for musl') { stage('Run live-migration integration tests for musl') {
options { options {
timeout(time: 1, unit: 'HOURS') timeout(time: 1, unit: 'HOURS')
} }
steps { steps {
sh "sudo modprobe openvswitch" sh 'sudo modprobe openvswitch'
sh "scripts/dev_cli.sh tests --integration-live-migration --libc musl" sh 'scripts/dev_cli.sh tests --integration-live-migration --libc musl'
} }
} }
} }
@ -292,14 +292,14 @@ pipeline{
regression { regression {
script { script {
if (env.BRANCH_NAME == 'main') { if (env.BRANCH_NAME == 'main') {
slackSend (color: '#ff0000', message: '"main" branch build is now failing', channel: '#jenkins-ci') slackSend(color: '#ff0000', message: '"main" branch build is now failing', channel: '#jenkins-ci')
} }
} }
} }
fixed { fixed {
script { script {
if (env.BRANCH_NAME == 'main') { if (env.BRANCH_NAME == 'main') {
slackSend (color: '#00ff00', message: '"main" branch build is now fixed', channel: '#jenkins-ci') slackSend(color: '#00ff00', message: '"main" branch build is now fixed', channel: '#jenkins-ci')
} }
} }
} }
@ -322,16 +322,16 @@ def cancelPreviousBuilds() {
} }
def installAzureCli(distro, arch) { def installAzureCli(distro, arch) {
sh "sudo apt install -y ca-certificates curl apt-transport-https lsb-release gnupg" 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 '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=${arch}] https://packages.microsoft.com/repos/azure-cli/ ${distro} main\" | sudo tee /etc/apt/sources.list.d/azure-cli.list" sh "echo \"deb [arch=${arch}] https://packages.microsoft.com/repos/azure-cli/ ${distro} main\" | sudo tee /etc/apt/sources.list.d/azure-cli.list"
sh "sudo apt update" sh 'sudo apt update'
sh "sudo apt install -y azure-cli" sh 'sudo apt install -y azure-cli'
} }
def boolean docsFileOnly() { def boolean docsFileOnly() {
if (env.CHANGE_TARGET == null) { if (env.CHANGE_TARGET == null) {
return false; return false
} }
return sh( return sh(
@ -342,7 +342,7 @@ def boolean docsFileOnly() {
def boolean fuzzFileOnly() { def boolean fuzzFileOnly() {
if (env.CHANGE_TARGET == null) { if (env.CHANGE_TARGET == null) {
return false; return false
} }
return sh( return sh(