Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ def run(params) {

// The junit plugin doesn't affect full paths
junit_resultdir = "results/${BUILD_NUMBER}/results_junit"
env.common_params = "--outputdir ${resultdir} --tf ${params.tf_file} --gitfolder ${resultdir}/sumaform --terraform-bin ${params.bin_path}"

String tf_file = 'susemanager-ci/terracumber_config/tf_files/templates/salt-shaker.tf'
String tfvariables_file = 'susemanager-ci/terracumber_config/tf_files/variables/salt-shaker.tf'
String tfvars_file = 'susemanager-ci/terracumber_config/tf_files/tfvars/salt-shaker/salt-shaker.tfvars'

GString common_params = "--outputdir ${resultdir} --tf ${tf_file} --tf_variables_description_file ${tfvariables_file} --gitfolder ${resultdir}/sumaform --terraform-bin ${params.bin_path}"

if (params.deploy_parallelism) {
common_params = "${common_params} --parallelism ${params.deploy_parallelism}"
}

// Start pipeline
deployed = false
Expand All @@ -27,28 +36,31 @@ def run(params) {
}
stage('Deploy') {
// Provision the environment
String TERRAFORM_INIT = ''
if (params.terraform_init) {
env.TERRAFORM_INIT = '--init'
} else {
env.TERRAFORM_INIT = ''
TERRAFORM_INIT = '--init'
}
env.TERRAFORM_TAINT = ''
String TERRAFORM_TAINT = ''
if (params.terraform_taint) {
switch(params.sumaform_backend) {
case "libvirt":
env.TERRAFORM_TAINT = " --taint '.*(domain|combustion_disk|cloudinit_disk|ignition_disk|main_disk|data_disk|database_disk|standalone_provisioning).*'";
TERRAFORM_TAINT = " --taint '.*(domain|combustion_disk|cloudinit_disk|ignition_disk|main_disk|data_disk|database_disk|standalone_provisioning).*'";
break;
case "aws":
env.TERRAFORM_TAINT = " --taint '.*(host).*'";
TERRAFORM_TAINT = " --taint '.*(host).*'";
break;
default:
println("ERROR: Unknown backend ${params.sumaform_backend}");
sh "exit 1";
break;
}
}
// Write the tfvars file and append the selected environment key
sh "rm -f ${resultdir}/sumaform/terraform.tfvars"
sh "cat ${tfvars_file} >> ${resultdir}/sumaform/terraform.tfvars"
sh "echo 'ENVIRONMENT = \"${params.minion}\"' >> ${resultdir}/sumaform/terraform.tfvars"
retry(count: 3) {
sh "set +x; source /home/jenkins/.credentials set -x; export TERRAFORM=${params.bin_path}; export TERRAFORM_PLUGINS=${params.bin_plugins_path}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform.log ${env.TERRAFORM_INIT} ${env.TERRAFORM_TAINT} --sumaform-backend ${params.sumaform_backend} --runstep provision"
sh "set +x; source /home/jenkins/.credentials set -x; export TERRAFORM=${params.bin_path}; export TERRAFORM_PLUGINS=${params.bin_plugins_path}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform.log ${TERRAFORM_INIT} ${TERRAFORM_TAINT} --sumaform-backend ${params.sumaform_backend} --runstep provision"
deployed = true
if (params.wait_after_deploy) {
echo "Waiting ${params.wait_after_deploy} seconds after sumaform deployment (usually to allow transactional system to reboot)"
Expand Down Expand Up @@ -100,7 +112,7 @@ def run(params) {
}
finally {
stage('Save TF state') {
archiveArtifacts artifacts: "results/sumaform/terraform.tfstate, results/sumaform/.terraform/**/*"
archiveArtifacts artifacts: "results/sumaform/terraform.tfstate, results/sumaform/.terraform/**/*"
}

stage('Get results') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ node('sumaform-cucumber') {

// The junit plugin doesn't affect full paths
junit_resultdir = "results/${BUILD_NUMBER}/results_junit"
env.common_params = "--outputdir ${resultdir} --tf ${params.tf_file} --gitfolder ${resultdir}/sumaform --terraform-bin ${params.bin_path}"
common_params = "--outputdir ${resultdir} --tf ${params.tf_file} --gitfolder ${resultdir}/sumaform --terraform-bin ${params.bin_path}"
if (params.deploy_parallelism) {
env.common_params = "${env.common_params} --parallelism ${params.deploy_parallelism}"
common_params = "${common_params} --parallelism ${params.deploy_parallelism}"
}

// Start pipeline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ node('salt-shaker-tests') {
booleanParam(name: 'run_functional_tests', defaultValue: true, description: 'Run the Salt functional tests'),
string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'),
string(name: 'skip_list_url', defaultValue: 'https://github.com/openSUSE/salt-test-skiplist/raw/refs/heads/main/skipped_tests.toml', description: 'URL to the skiplist.toml file to run Salt shaker'),
string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/salt-shaker/Salt-Shaker-Next-AlmaLinux10-Bundle.tf', description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
choice(name: 'sumaform_backend', choices: ['libvirt', 'aws'], description: 'Sumaform backend to be used (see https://github.com/uyuni-project/sumaform#backend-choice)'),
Expand All @@ -42,7 +41,9 @@ node('salt-shaker-tests') {
checkout scm
}
timeout(activity: false, time: 3, unit: 'HOURS') {
def mutableParams = [:] + params
mutableParams.minion = "next-almalinux10-bundle"
def pipeline = load "jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy"
pipeline.run(params)
pipeline.run(mutableParams)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ node('salt-shaker-tests') {
booleanParam(name: 'run_functional_tests', defaultValue: true, description: 'Run the Salt functional tests'),
string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'),
string(name: 'skip_list_url', defaultValue: 'https://github.com/openSUSE/salt-test-skiplist/raw/refs/heads/main/skipped_tests.toml', description: 'URL to the skiplist.toml file to run Salt shaker'),
string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/salt-shaker/Salt-Shaker-Next-AlmaLinux8.tf', description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
choice(name: 'sumaform_backend', choices: ['libvirt', 'aws'], description: 'Sumaform backend to be used (see https://github.com/uyuni-project/sumaform#backend-choice)'),
Expand All @@ -31,7 +30,9 @@ node('salt-shaker-tests') {
checkout scm
}
timeout(activity: false, time: 3, unit: 'HOURS') {
def mutableParams = [:] + params
mutableParams.minion = "next-almalinux8"
def pipeline = load "jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy"
pipeline.run(params)
pipeline.run(mutableParams)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ node('salt-shaker-tests') {
booleanParam(name: 'run_functional_tests', defaultValue: true, description: 'Run the Salt functional tests'),
string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'),
string(name: 'skip_list_url', defaultValue: 'https://github.com/openSUSE/salt-test-skiplist/raw/refs/heads/main/skipped_tests.toml', description: 'URL to the skiplist.toml file to run Salt shaker'),
string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/salt-shaker/Salt-Shaker-Next-AlmaLinux8-Bundle.tf', description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
choice(name: 'sumaform_backend', choices: ['libvirt', 'aws'], description: 'Sumaform backend to be used (see https://github.com/uyuni-project/sumaform#backend-choice)'),
Expand All @@ -31,7 +30,9 @@ node('salt-shaker-tests') {
checkout scm
}
timeout(activity: false, time: 3, unit: 'HOURS') {
def mutableParams = [:] + params
mutableParams.minion = "next-almalinux8-bundle"
def pipeline = load "jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy"
pipeline.run(params)
pipeline.run(mutableParams)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ node('salt-shaker-tests') {
booleanParam(name: 'run_functional_tests', defaultValue: true, description: 'Run the Salt functional tests'),
string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'),
string(name: 'skip_list_url', defaultValue: 'https://github.com/openSUSE/salt-test-skiplist/raw/refs/heads/main/skipped_tests.toml', description: 'URL to the skiplist.toml file to run Salt shaker'),
string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/salt-shaker/Salt-Shaker-Next-AlmaLinux9-Bundle.tf', description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
choice(name: 'sumaform_backend', choices: ['libvirt', 'aws'], description: 'Sumaform backend to be used (see https://github.com/uyuni-project/sumaform#backend-choice)'),
Expand All @@ -42,7 +41,9 @@ node('salt-shaker-tests') {
checkout scm
}
timeout(activity: false, time: 3, unit: 'HOURS') {
def mutableParams = [:] + params
mutableParams.minion = "next-almalinux9-bundle"
def pipeline = load "jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy"
pipeline.run(params)
pipeline.run(mutableParams)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ node('salt-shaker-tests') {
booleanParam(name: 'run_functional_tests', defaultValue: true, description: 'Run the Salt functional tests'),
string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'),
string(name: 'skip_list_url', defaultValue: 'https://github.com/openSUSE/salt-test-skiplist/raw/refs/heads/main/skipped_tests.toml', description: 'URL to the skiplist.toml file to run Salt shaker'),
string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/salt-shaker/Salt-Shaker-Next-CENTOS7-Bundle.tf', description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
choice(name: 'sumaform_backend', choices: ['libvirt', 'aws'], description: 'Sumaform backend to be used (see https://github.com/uyuni-project/sumaform#backend-choice)'),
Expand All @@ -31,7 +30,9 @@ node('salt-shaker-tests') {
checkout scm
}
timeout(activity: false, time: 3, unit: 'HOURS') {
def mutableParams = [:] + params
mutableParams.minion = "next-centos7-bundle"
def pipeline = load "jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy"
pipeline.run(params)
pipeline.run(mutableParams)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ node('salt-shaker-tests') {
booleanParam(name: 'run_functional_tests', defaultValue: true, description: 'Run the Salt functional tests'),
string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'),
string(name: 'skip_list_url', defaultValue: 'https://github.com/openSUSE/salt-test-skiplist/raw/refs/heads/main/skipped_tests.toml', description: 'URL to the skiplist.toml file to run Salt shaker'),
string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/salt-shaker/Salt-Shaker-Next-Debian11-Bundle.tf', description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
choice(name: 'sumaform_backend', choices: ['libvirt', 'aws'], description: 'Sumaform backend to be used (see https://github.com/uyuni-project/sumaform#backend-choice)'),
Expand All @@ -31,7 +30,9 @@ node('salt-shaker-tests') {
checkout scm
}
timeout(activity: false, time: 3, unit: 'HOURS') {
def mutableParams = [:] + params
mutableParams.minion = "next-debian11-bundle"
def pipeline = load "jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy"
pipeline.run(params)
pipeline.run(mutableParams)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ node('salt-shaker-tests') {
booleanParam(name: 'run_functional_tests', defaultValue: true, description: 'Run the Salt functional tests'),
string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'),
string(name: 'skip_list_url', defaultValue: 'https://github.com/openSUSE/salt-test-skiplist/raw/refs/heads/main/skipped_tests.toml', description: 'URL to the skiplist.toml file to run Salt shaker'),
string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/salt-shaker/Salt-Shaker-Next-Debian12-Bundle.tf', description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
choice(name: 'sumaform_backend', choices: ['libvirt', 'aws'], description: 'Sumaform backend to be used (see https://github.com/uyuni-project/sumaform#backend-choice)'),
Expand All @@ -31,7 +30,9 @@ node('salt-shaker-tests') {
checkout scm
}
timeout(activity: false, time: 3, unit: 'HOURS') {
def mutableParams = [:] + params
mutableParams.minion = "next-debian12-bundle"
def pipeline = load "jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy"
pipeline.run(params)
pipeline.run(mutableParams)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ node('salt-shaker-tests') {
booleanParam(name: 'run_functional_tests', defaultValue: true, description: 'Run the Salt functional tests'),
string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'),
string(name: 'skip_list_url', defaultValue: 'https://github.com/openSUSE/salt-test-skiplist/raw/refs/heads/main/skipped_tests.toml', description: 'URL to the skiplist.toml file to run Salt shaker'),
string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/salt-shaker/Salt-Shaker-Next-Leap156.tf', description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
choice(name: 'sumaform_backend', choices: ['libvirt', 'aws'], description: 'Sumaform backend to be used (see https://github.com/uyuni-project/sumaform#backend-choice)'),
Expand All @@ -31,7 +30,9 @@ node('salt-shaker-tests') {
checkout scm
}
timeout(activity: false, time: 3, unit: 'HOURS') {
def mutableParams = [:] + params
mutableParams.minion = "next-leap156"
def pipeline = load "jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy"
pipeline.run(params)
pipeline.run(mutableParams)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ node('salt-shaker-tests') {
booleanParam(name: 'run_functional_tests', defaultValue: true, description: 'Run the Salt functional tests'),
string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'),
string(name: 'skip_list_url', defaultValue: 'https://github.com/openSUSE/salt-test-skiplist/raw/refs/heads/main/skipped_tests.toml', description: 'URL to the skiplist.toml file to run Salt shaker'),
string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/salt-shaker/Salt-Shaker-Next-Leap156-Bundle.tf', description: 'Path to the tf file to be used'),
string(name: 'sumaform_gitrepo', defaultValue: 'https://github.com/uyuni-project/sumaform.git', description: 'Sumaform Git Repository'),
string(name: 'sumaform_ref', defaultValue: 'master', description: 'Sumaform Git reference (branch, tag...)'),
choice(name: 'sumaform_backend', choices: ['libvirt', 'aws'], description: 'Sumaform backend to be used (see https://github.com/uyuni-project/sumaform#backend-choice)'),
Expand All @@ -31,7 +30,9 @@ node('salt-shaker-tests') {
checkout scm
}
timeout(activity: false, time: 3, unit: 'HOURS') {
def mutableParams = [:] + params
mutableParams.minion = "next-leap156-bundle"
def pipeline = load "jenkins_pipelines/environments/common/pipeline-salt-shaker.groovy"
pipeline.run(params)
pipeline.run(mutableParams)
}
}
Loading
Loading