Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jenkins builds for pull requests #280

Merged
merged 10 commits into from
Dec 3, 2023
43 changes: 43 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
pipeline {
agent any
environment {
XOA_URL = credentials("terraform-provider-xoa-url")
XOA_USER = credentials("terraform-provider-xoa-user")
XOA_PASSWORD = credentials("terraform-provider-xoa-password")
XOA_POOL = credentials("terraform-provider-xoa-pool")
XOA_TEMPLATE = credentials("terraform-provider-xoa-template")
XOA_DISKLESS_TEMPLATE = credentials("terraform-provider-xoa-diskless-template")
XOA_ISO = credentials("terraform-provider-xoa-iso")
XOA_ISO_SR = credentials("terraform-provider-xoa-iso-sr")
XOA_NETWORK = credentials("terraform-provider-xoa-network")
XOA_RETRY_MAX_TIME = credentials("terraform-provider-xoa-retry-max-time")
XOA_RETRY_MODE = credentials("terraform-provider-xoa-retry-mode")
}

// Ensure the desired Go version is installed for all stages,
// using the name defined in the Global Tool Configuration
tools { go '1.20' }

stages {
stage('BuildAndTest') {
matrix {
axes {
axis {
name 'TF_VERSION'
values 'v0.14.11', 'v1.6.5'
}
}
stages {
stage('Test') {
steps {
lock('xoa-test-runner') {
sh 'cp /opt/terraform-provider-xenorchestra/testdata/images/alpine-virt-3.17.0-x86_64.iso xoa/testdata/alpine-virt-3.17.0-x86_64.iso'
sh 'TF_VERSION=${TF_VERSION} make ci'
}
}
}
}
}
}
}
}
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

TIMEOUT ?= 40m
GOMAXPROCS ?= 5
TF_VERSION ?= v0.14.11
ifdef TEST
TEST := github.com/ddelnano/terraform-provider-xenorchestra/xoa -run '$(TEST)'
else
Expand Down Expand Up @@ -44,4 +45,4 @@ testacc: xoa/testdata/alpine-virt-3.17.0-x86_64.iso
# to be removed from the repo. Add a target to enforce that the CI system
# has copied that file into place before the tests run
ci: xoa/testdata/alpine-virt-3.17.0-x86_64.iso
TF_ACC=1 gotestsum --debug --rerun-fails=5 --max-fails=15 --packages=./xoa -- ./xoa -v -count=1 -timeout=$(TIMEOUT) -sweep=true -parallel=$(GOMAXPROCS)
TF_ACC_TERRAFORM_VERSION=$(TF_VERSION) TF_ACC=1 gotestsum --debug --rerun-fails=5 --max-fails=15 --packages=./xoa -- ./xoa -v -count=1 -timeout=$(TIMEOUT) -sweep=true -parallel=$(GOMAXPROCS)