Skip to content

Commit

Permalink
Comment redeploy stage
Browse files Browse the repository at this point in the history
  • Loading branch information
maximenoel8 committed Nov 6, 2024
1 parent 86ac92e commit b6c62a8
Showing 1 changed file with 55 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,61 +167,61 @@ def run(params) {
export TERRAFORM_PLUGINS=${terraform_bin_plugins}
"""

stage('Delete client VMs') {

// Construct the --tf-resources-to-delete argument dynamically
ArrayList tfResourcesToDelete = []
if (params.clean_proxy) {
tfResourcesToDelete.add('proxy')
}
if (params.clean_monitoring_server) {
tfResourcesToDelete.add('monitoring-server')
}
if (params.clean_retail) {
tfResourcesToDelete.add('retail')
}

// Join the resources into a comma-separated string if there are any to delete
String tfResourcesToDeleteArg = defaultResourcesToDelete.isEmpty() ? '' : "--tf-resources-to-delete ${defaultResourcesToDelete.join(' ')}"

// Execute Terracumber CLI to deploy the environment without clients
sh """
${environmentVars}
set +x
./terracumber-cli ${commonParams} --logfile ${logFile} --init --sumaform-backend ${sumaform_backend} --use-tf-resource-cleaner --init --runstep provision ${tfResourcesToDeleteArg}
"""
}

stage('Redeploy the environment with new client VMs and update custom repositories into cucumber') {

// Run Terracumber to deploy the environment
sh """
${environmentVars}
set +x
./terracumber-cli ${commonParams} --logfile ${resultdirbuild}/sumaform.log --init --sumaform-backend ${sumaform_backend} --runstep provision
"""
}

stage('Copy the new custom repository json file to controller') {
// Generate custom_repositories.json file in the workspace from the value passed by parameter
if (params.custom_repositories?.trim()) {
writeFile file: 'custom_repositories.json', text: params.custom_repositories, encoding: "UTF-8"
}

// Generate custom_repositories.json file in the workspace using a Python script - MI Identifiers passed by parameter
if (params.mi_ids?.trim()) {
node('manager-jenkins-node') {
checkout scm
res_python_script_ = sh(script: "python3 jenkins_pipelines/scripts/json_generator/maintenance_json_generator.py --mi_ids ${params.mi_ids}", returnStatus: true)
echo "Build Validation JSON script return code:\n ${json_content}"
if (res_python_script != 0) {
error("MI IDs (${params.mi_ids}) passed by parameter are wrong (or already released)")
}
}
}
sh(script: "${SUSEManagerCleanerProgram} --url ${controllerHostname} --product_version ${product_version} --mode update_custom_repositories")

}
// stage('Delete client VMs') {
//
// // Construct the --tf-resources-to-delete argument dynamically
// ArrayList tfResourcesToDelete = []
// if (params.clean_proxy) {
// tfResourcesToDelete.add('proxy')
// }
// if (params.clean_monitoring_server) {
// tfResourcesToDelete.add('monitoring-server')
// }
// if (params.clean_retail) {
// tfResourcesToDelete.add('retail')
// }
//
// // Join the resources into a comma-separated string if there are any to delete
// String tfResourcesToDeleteArg = defaultResourcesToDelete.isEmpty() ? '' : "--tf-resources-to-delete ${defaultResourcesToDelete.join(' ')}"
//
// // Execute Terracumber CLI to deploy the environment without clients
// sh """
// ${environmentVars}
// set +x
// ./terracumber-cli ${commonParams} --logfile ${logFile} --init --sumaform-backend ${sumaform_backend} --use-tf-resource-cleaner --init --runstep provision ${tfResourcesToDeleteArg}
// """
// }
//
// stage('Redeploy the environment with new client VMs and update custom repositories into cucumber') {
//
// // Run Terracumber to deploy the environment
// sh """
// ${environmentVars}
// set +x
// ./terracumber-cli ${commonParams} --logfile ${resultdirbuild}/sumaform.log --init --sumaform-backend ${sumaform_backend} --runstep provision
// """
// }
//
// stage('Copy the new custom repository json file to controller') {
// // Generate custom_repositories.json file in the workspace from the value passed by parameter
// if (params.custom_repositories?.trim()) {
// writeFile file: 'custom_repositories.json', text: params.custom_repositories, encoding: "UTF-8"
// }
//
// // Generate custom_repositories.json file in the workspace using a Python script - MI Identifiers passed by parameter
// if (params.mi_ids?.trim()) {
// node('manager-jenkins-node') {
// checkout scm
// res_python_script_ = sh(script: "python3 jenkins_pipelines/scripts/json_generator/maintenance_json_generator.py --mi_ids ${params.mi_ids}", returnStatus: true)
// echo "Build Validation JSON script return code:\n ${json_content}"
// if (res_python_script != 0) {
// error("MI IDs (${params.mi_ids}) passed by parameter are wrong (or already released)")
// }
// }
// }
// sh(script: "${SUSEManagerCleanerProgram} --url ${controllerHostname} --product_version ${product_version} --mode update_custom_repositories")
//
// }

stage('Sanity check') {
sh "./terracumber-cli ${commonParams} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; ${exports} rake cucumber:build_validation_sanity_check'"
Expand Down

0 comments on commit b6c62a8

Please sign in to comment.