From 368552406802b9d863e060fe5bd0ddef4e8e83a7 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 13:57:50 +1200 Subject: [PATCH 01/59] First pipeline version --- .../environments/common/pipeline-aws.groovy | 180 ++++++++++++------ .../manager-5.0-dev-acceptance-tests-AWS | 50 +++++ 2 files changed, 168 insertions(+), 62 deletions(-) create mode 100644 jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 5c999c72d..9cd894290 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -3,14 +3,13 @@ def run(params) { deployed = false env.resultdir = "${WORKSPACE}/results" env.resultdirbuild = "${resultdir}/${BUILD_NUMBER}" + // The junit plugin doesn't affect full paths junit_resultdir = "results/${BUILD_NUMBER}/results_junit" local_mirror_dir = "${resultdir}/sumaform-local" aws_mirror_dir = "${resultdir}/sumaform-aws" awscli = '/usr/local/bin/aws' - suma43_build_url = "https://dist.suse.de/ibs/SUSE:/SLE-15-SP4:/Update:/Products:/Manager43/images/" node_user = 'jenkins' - build_validation = true ssh_option = '-o StrictHostKeyChecking=no -o ConnectTimeout=7200 -o ServerAliveInterval=60' server_ami = null @@ -20,21 +19,17 @@ def run(params) { deployed_local = false deployed_aws = false - // Declare lock resource use during node bootstrap - mgrCreateBootstrapRepo = 'share resource to avoid running mgr create bootstrap repo in parallel' - def client_stage_result_fail = false - local_mirror_params = "--outputdir ${resultdir} --tf susemanager-ci/terracumber_config/tf_files/local_mirror.tf --gitfolder ${local_mirror_dir}" aws_mirror_params = "--outputdir ${resultdir} --tf susemanager-ci/terracumber_config/tf_files/aws_mirror.tf --gitfolder ${aws_mirror_dir}" env.common_params = "--outputdir ${resultdir} --tf susemanager-ci/terracumber_config/tf_files/${params.tf_file} --gitfolder ${aws_mirror_dir} --bastion_ssh_key ${params.key_file}" + env.exports = "export BUILD_NUMBER=${BUILD_NUMBER}; export CAPYBARA_TIMEOUT=${capybara_timeout}; export DEFAULT_TIMEOUT=${default_timeout}; " - //Capybara configuration - def capybara_timeout =30 - def default_timeout = 300 - - // Path to JSON run set file for non MU repositories - env.non_MU_channels_tasks_file = 'susemanager-ci/jenkins_pipelines/data/non_MU_channels_tasks.json' + // Upload image variables + security_group_id = 'sg-0778949b97990ce04' + subnet_id = 'subnet-05b9d049f3af01c38' + image_help_ami = 'ami-0ad2088f58aad429e' + pattern = ~/\/([^\/]*Manager-(?:Server|Proxy)-[^\/]*)-[^\/]*BYOS[^\/]*-Build(\d+\.\d+)\.raw\.xz/ if (params.terraform_parallelism) { local_mirror_params = "${local_mirror_params} --parallelism ${params.terraform_parallelism}" @@ -43,9 +38,46 @@ def run(params) { } // Public IP for AWS ingress String[] ALLOWED_IPS = params.allowed_IPS.split("\n") + if (params.bastion_ssh_key_file) { + env.common_params = "${env.common_params} --bastion_ssh_key ${params.bastion_ssh_key_file} --bastion_user ${params.bastion_username}" + if (params.bastion_hostname) { + env.common_params = "${env.common_params} --bastion_hostname ${params.bastion_hostname}" + } + } + + def previous_commit = null + def product_commit = null + if (params.show_product_changes) { + // Retrieve the hash commit of the last product built in OBS/IBS and previous job + def prefix = env.JOB_BASE_NAME.split('-acceptance-tests')[0] + if (prefix == "uyuni-master-dev") { + prefix = "manager-Head-dev" + } + // The 2obs jobs are releng, not dev + prefix = prefix.replaceAll("-dev", "-releng") + def request = httpRequest "https://ci.suse.de/job/${prefix}-2obs/lastBuild/api/json" + def requestJson = readJSON text: request.getContent() + product_commit = "${requestJson.actions.lastBuiltRevision.SHA1}" + product_commit = product_commit.substring(product_commit.indexOf('[') + 1, product_commit.indexOf(']')); + print "Current product commit: ${product_commit}" + previous_commit = currentBuild.getPreviousBuild().description + if (previous_commit == null) { + previous_commit = product_commit + } else { + previous_commit = previous_commit.substring(previous_commit.indexOf('[') + 1, previous_commit.indexOf(']')); + } + print "Previous product commit: ${previous_commit}" + } + // Start pipeline + deployed = false try { stage('Clone terracumber, susemanager-ci and sumaform') { + if (params.show_product_changes) { + // Rename build using product commit hash + currentBuild.description = "[${product_commit}]" + } + // Create a directory for to place the directory with the build results (if it does not exist) sh "mkdir -p ${resultdir}" git url: params.terracumber_gitrepo, branch: params.terracumber_ref @@ -53,55 +85,54 @@ def run(params) { checkout scm } // Clone sumaform for aws and local repositories - sh "./terracumber-cli ${local_mirror_params} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync --sumaform-backend libvirt" - sh "./terracumber-cli ${common_params} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync --sumaform-backend aws" + sh "set +x; source /home/jenkins/.credentials set -x; ./terracumber-cli ${local_mirror_params} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync" + sh "set +x; source /home/jenkins/.credentials set -x; ./terracumber-cli ${common_params} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync --sumaform-backend aws --runstep gitsync" } - - if (params.prepare_aws_env) { + if (params.build_image != null) { stage("Prepare AWS environment") { parallel( "upload_latest_image": { if (params.use_latest_ami_image) { - stage('Clean old images') { - // Get all image ami ids - image_amis = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].ImageId'", - returnStdout: true) - // Get all snapshot ids - image_snapshots = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].BlockDeviceMappings[0].Ebs.SnapshotId'", - returnStdout: true) - - String[] ami_list = image_amis.split("\n") - String[] snapshot_list = image_snapshots.split("\n") - - // Deregister all BYOS images - ami_list.each { ami -> - if (ami) { - sh(script: "${awscli} ec2 deregister-image --image-id ${ami} --region ${params.aws_region}") - } - } - // Delete all BYOS snapshot - snapshot_list.each { snapshot -> - if (snapshot) { - sh(script: "${awscli} ec2 delete-snapshot --snapshot-id ${snapshot} --region ${params.aws_region}") - } - } - } +// stage('Clean old images') { +// // Get all image ami ids +// image_amis = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].ImageId'", +// returnStdout: true) +// // Get all snapshot ids +// image_snapshots = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].BlockDeviceMappings[0].Ebs.SnapshotId'", +// returnStdout: true) +// +// String[] ami_list = image_amis.split("\n") +// String[] snapshot_list = image_snapshots.split("\n") +// +// // Deregister all BYOS images +// ami_list.each { ami -> +// if (ami) { +// sh(script: "${awscli} ec2 deregister-image --image-id ${ami} --region ${params.aws_region}") +// } +// } +// // Delete all BYOS snapshot +// snapshot_list.each { snapshot -> +// if (snapshot) { +// sh(script: "${awscli} ec2 delete-snapshot --snapshot-id ${snapshot} --region ${params.aws_region}") +// } +// } +// } stage('Download last ami image') { sh "rm -rf ${resultdir}/images" sh "mkdir -p ${resultdir}/images" - sh(script: "curl ${suma43_build_url} > images.html") - server_image_name = sh(script: "grep -oP '(?<=href=\")SUSE-Manager-Server-BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() - proxy_image_name = sh(script: "grep -oP '(?<=href=\")SUSE-Manager-Proxy-BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() - - sh(script: "cd ${resultdir}/images; wget ${suma_43_build_url}${server_image_name}") - sh(script: "cd ${resultdir}/images; wget ${suma_43_build_url}${proxy_image_name}") - sh(script: "ec2uploadimg -f /home/jenkins/.ec2utils.conf -a test --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --ena-support --verbose --regions '${params.aws_region}' -d 'build_suma_server' --wait-count 3 -n '${server_image_name}' '${resultdir}/images/${server_image_name}'") - sh(script: "ec2uploadimg -f /home/jenkins/.ec2utils.conf -a test --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --ena-support --verbose --regions '${params.aws_region}' -d 'build_suma_proxy' --wait-count 3 -n '${proxy_image_name}' '${resultdir}/images/${proxy_image_name}'") - env.server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", +// sh(script: "curl ${build_image} > images.html") +// server_image_name = sh(script: "grep -oP '(?<=href=\")Manager-Server-.*BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() +// proxy_image_name = sh(script: "grep -oP '(?<=href=\")SUSE-Manager-Proxy-BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() + def server_image_name = extractBuildName(build_image) + sh(script: "cd ${resultdir}/images; wget ${build_image}") +// sh(script: "cd ${resultdir}/images; wget ${suma_43_build_url}${proxy_image_name}") + sh(script: "ec2uploadimg -a default --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --wait-count 3 --ena-support --verbose --regions '${params.aws_region}' -n '${server_image_name[0]}' -d 'build image' --ssh-key-pair 'testing-suma' --private-key-file '/home/jenkins/.ssh/testing-suma.pem' --security-group-ids '${security_group_id}' --vpc-subnet ${subnet_id} --type 't2.2xlarge' --user 'ec2-user' -e '${image_help_ami}' '${resultdir}/images/${server_image_name[1]}'") +// sh(script: "ec2uploadimg -a test --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --ena-support --verbose --regions '${params.aws_region}' -d 'build_suma_proxy' --wait-count 3 -n '${proxy_image_name}' '${resultdir}/images/${proxy_image_name}'") + env.server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", returnStdout: true).trim() env.proxy_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${proxy_image_name}' --region ${params.aws_region} | jq -r '.Images[0].ImageId'", returnStdout: true).trim() @@ -175,6 +206,21 @@ def run(params) { } } + stage('Product changes') { + if (params.show_product_changes) { + sh """ + # Comparison between: + # - the previous git revision of spacewalk (or uyuni) repository pushed in IBS (or OBS) + # - the git revision of the current spacewalk (or uyuni) repository pushed in IBS (or OBS) + # Note: This is a trade-off, we should be comparing the git revisions of all the packages composing our product + # For that extra mile, we need a new tag in the repo metadata of each built, with the git revision of the related repository. + """ + sh script:"./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/; git --no-pager log --pretty=format:\"%h %<(16,trunc)%cn %s %d\" ${previous_commit}..${product_commit}'", returnStatus:true + } else { + println("Product changes disabled, checkbox 'show_product_changes' was not enabled'") + } + } + if (params.must_deploy) { stage("Deploy AWS with MU") { int count = 0 @@ -192,17 +238,17 @@ def run(params) { } stage('Sanity Check') { - sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; rake cucumber:sanity_check'" + sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; ${env.exports} rake cucumber:sanity_check'" } stage('Core - Setup') { if (params.must_run_core && (deployed_aws || !params.must_deploy)) { - sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; rake cucumber:core'" - sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; rake cucumber:reposync'" + sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; ${env.exports} rake cucumber:core'" + sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; ${env.exports} rake cucumber:reposync'" } } stage('Core - Initialize clients') { if (params.must_init_clients) { - sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; rake ${params.rake_namespace}:init_clients'" + sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd 'cd /root/spacewalk/testsuite; ${env.exports} rake ${params.rake_namespace}:init_clients'" } } stage('Secondary features') { @@ -211,12 +257,12 @@ def run(params) { if (params.functional_scopes) { exports += "export TAGS=${params.functional_scopes}; " } - def statusCode1 = sh script: "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd '${exports} cd /root/spacewalk/testsuite; rake cucumber:secondary'", returnStatus: true - def statusCode2 = sh script: "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd '${exports} cd /root/spacewalk/testsuite; rake ${params.rake_namespace}:secondary_parallelizable'", returnStatus: true - sh "exit \$(( ${statusCode1}|${statusCode2} ))" + def statusCode1 = sh script: "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd '${exports} cd /root/spacewalk/testsuite; ${env.exports} rake cucumber:secondary'", returnStatus: true + def statusCode2 = sh script: "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd '${exports} cd /root/spacewalk/testsuite; ${env.exports} rake ${params.rake_namespace}:secondary_parallelizable'", returnStatus: true + def statusCode3 = sh script: "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd '${exports} cd /root/spacewalk/testsuite; ${env.exports} rake ${params.rake_namespace}:secondary_finishing'", returnStatus: true + sh "exit \$(( ${statusCode1}|${statusCode2}|${statusCode3} ))" } } - } finally { stage('Save TF state') { @@ -253,14 +299,24 @@ def run(params) { sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/mail.log --runstep mail" // Clean up old results sh "./clean-old-results -r ${resultdir}" - // Fail pipeline if client stages failed - if (client_stage_result_fail) { - error("Client stage failed") - } - sh "exit ${result_error}" + sh "exit ${error}" } } } } +def extractBuildName(String url) { + def matcher = (url =~ ${pattern}) + def lastIndex = url.lastIndexOf('/') + def fileImageName = url.substring(lastIndex + 1) + + if (matcher.find()) { + def imageName = matcher.group(1) + def buildNumber = matcher.group(2) + return ["${imageName}-build${buildNumber}", fileImageName] + } else { + return null + } +} + return this diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS new file mode 100644 index 000000000..9605bd712 --- /dev/null +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -0,0 +1,50 @@ +#!/usr/bin/env groovy + +node('sumaform-cucumber-provo') { + properties([ + buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '3')), + disableConcurrentBuilds(), + parameters([ + string(name: 'cucumber_gitrepo', defaultValue: 'https://github.com/uyuni-project/uyuni.git', description: 'Testsuite Git Repository'), + string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'), + string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/SUSEManager-Head-NUE.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)'), + choice(name: 'terraform_bin', choices: ['/usr/bin/terraform'], description: 'Terraform binary path'), + choice(name: 'terraform_bin_plugins', choices: ['/usr/bin'], description: 'Terraform plugins path'), + string(name: 'terraform_parallelism', defaultValue: '', description: 'Advanced: Define the number of parallel resource operations for terraform'), + string(name: 'terracumber_gitrepo', defaultValue: 'https://github.com/uyuni-project/terracumber.git', description: 'Terracumber Git Repository'), + string(name: 'terracumber_ref', defaultValue: 'master', description: 'Terracumber Git ref (branch, tag...)'), + booleanParam(name: 'terraform_init', defaultValue: true, description: 'Call terraform init (needed if modules are added or changes)'), + booleanParam(name: 'terraform_taint', defaultValue: true, description: 'Call terraform taint (so the resources, except volumes, are recreated)'), + booleanParam(name: 'use_previous_terraform_state', defaultValue: true, description: 'Use previous Terraform state'), + booleanParam(name: 'show_product_changes', defaultValue: true, description: 'Show the product changes since the last build'), + choice(name: 'rake_namespace', choices: ['cucumber', 'parallel'], description: 'Choose [parallel] (Clients and some features will run in parallel) or [cucumber] (all sequential)'), + extendedChoice(name: 'functional_scopes', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_CHECKBOX', visibleItemCount: 30, value: '@scope_smdba,@scope_spacecmd,@scope_spacewalk_utils,@scope_visualization,@scope_notification_message,@scope_virtual_host_manager,@scope_subscription_matching,@scope_formulas,@scope_sp_migration,@scope_cve_audit,@scope_onboarding,@scope_content_lifecycle_management,@scope_res,@scope_recurring_actions,@scope_maintenance_windows,@scope_building_container_images,@scope_kubernetes_integration,@scope_openscap,@scope_deblike,@scope_action_chains,@scope_salt_ssh,@scope_tomcat,@scope_changing_software_channels,@scope_monitoring,@scope_salt,@scope_cobbler,@scope_sumatoolbox,@scope_virtualization,@scope_hub,@scope_retail,@scope_configuration_channels,@scope_content_staging,@scope_proxy,@scope_traditional_client,@scope_api,@scope_power_management,@scope_retracted_patches,@scope_ansible,@scope_reportdb,@scope_containerized_proxy', description: 'Choose the functional scopes that you want to test') + booleanParam(name: 'use_previous_terraform_state', defaultValue: false, description: 'Use previous Terraform state'), + booleanParam(name: 'prepare_aws_env', defaultValue: true, description: 'Create local and AWS mirror and upload data to AWS mirror'), + booleanParam(name: 'must_deploy', defaultValue: true, description: 'Deploy'), + booleanParam(name: 'must_run_core', defaultValue: true, description: 'Run Core features'), + booleanParam(name: 'must_init_clients', defaultValue: true, description: 'Run init clients'), + booleanParam(name: 'must_secondary', defaultValue: true, description: 'Run secondary featuress'), + string(name: 'aws_region', defaultValue: 'eu-central-1', description: 'Describe the AWS region where to deploy the server'), + string(name: 'aws_availability_zone', defaultValue: 'eu-central-1a', description: 'Describe the AWS availability zone to deploy the server'), + string(name: 'key_file', defaultValue: '/home/jenkins/.ssh/testing-suma.pem', description: 'Path to SSH private key to access instance in AWS'), + string(name: 'key_name', defaultValue: 'testing-suma', description: 'SSH key name in AWS'), + text(name: 'allowed_IPS', defaultValue: '65.132.116.252', description: 'Add the public IPs to add to AWS ingress security group ( keep default Jenkins address ) separated by new line' ), + text(name: 'build_image', description: 'Build image url' )) + ]) + ]) + + stage('Checkout pipeline') { + checkout scm + } + timeout(activity: false, time: 14, unit: 'HOURS') { + //Capybara configuration + capybara_timeout = 10 + default_timeout = 250 + def pipeline = load "jenkins_pipelines/environments/common/pipeline-aws.groovy" + pipeline.run(params) + } +} From eb56989d4a77eb3f6eaf2c51989c57253941136c Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 13:59:00 +1200 Subject: [PATCH 02/59] comment stages --- .../environments/common/pipeline-aws.groovy | 112 +++++++++--------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 9cd894290..cb9c29ae3 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -139,64 +139,64 @@ def run(params) { } } }, - "create_local_mirror_with_mu": { - stage("Create local mirror with MU") { - // Copy minimum repo list to mirror - sh "cp ${local_mirror_dir}/salt/mirror/etc/minimum_repositories_testsuite.yaml ${local_mirror_dir}/salt/mirror/etc/minima-customize.yaml" - // Deploy local mirror - sh "set +x; source /home/jenkins/.credentials set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${local_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-local.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend libvirt" - deployed_local = true - - } - }, - "create_empty_aws_mirror": { - stage("Create empty AWS mirror") { - // Fix issue where result folder is created at the same time by local mirror and aws mirror - sleep(30) - NAME_PREFIX = env.JOB_NAME.toLowerCase().replace('.', '-') - env.aws_configuration = "REGION = \"${params.aws_region}\"\n" + - "AVAILABILITY_ZONE = \"${params.aws_availability_zone}\"\n" + - "NAME_PREFIX = \"${NAME_PREFIX}\"\n" + - "KEY_FILE = \"${params.key_file}\"\n" + - "KEY_NAME = \"${params.key_name}\"\n" + - "ALLOWED_IPS = [ \n" - - ALLOWED_IPS.each { ip -> - env.aws_configuration = aws_configuration + " \"${ip}\",\n" - } - env.aws_configuration = aws_configuration + "]\n" - writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: aws_configuration, encoding: "UTF-8" - // Deploy empty AWS mirror - sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend aws" - - } - } +// "create_local_mirror_with_mu": { +// stage("Create local mirror with MU") { +// // Copy minimum repo list to mirror +// sh "cp ${local_mirror_dir}/salt/mirror/etc/minimum_repositories_testsuite.yaml ${local_mirror_dir}/salt/mirror/etc/minima-customize.yaml" +// // Deploy local mirror +// sh "set +x; source /home/jenkins/.credentials set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${local_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-local.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend libvirt" +// deployed_local = true +// +// } +// }, +// "create_empty_aws_mirror": { +// stage("Create empty AWS mirror") { +// // Fix issue where result folder is created at the same time by local mirror and aws mirror +// sleep(30) +// NAME_PREFIX = env.JOB_NAME.toLowerCase().replace('.', '-') +// env.aws_configuration = "REGION = \"${params.aws_region}\"\n" + +// "AVAILABILITY_ZONE = \"${params.aws_availability_zone}\"\n" + +// "NAME_PREFIX = \"${NAME_PREFIX}\"\n" + +// "KEY_FILE = \"${params.key_file}\"\n" + +// "KEY_NAME = \"${params.key_name}\"\n" + +// "ALLOWED_IPS = [ \n" +// +// ALLOWED_IPS.each { ip -> +// env.aws_configuration = aws_configuration + " \"${ip}\",\n" +// } +// env.aws_configuration = aws_configuration + "]\n" +// writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: aws_configuration, encoding: "UTF-8" +// // Deploy empty AWS mirror +// sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend aws" +// +// } +// } ) - stage("Upload local mirror data to AWS mirror") { - - // Get local and aws hostname - mirror_hostname_local = sh(script: "cat ${local_mirror_dir}/terraform.tfstate | jq -r '.outputs.local_mirrors_public_ip.value[0][0]' ", - returnStdout: true).trim() - mirror_hostname_aws_public = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_public_name.value[0]' ", - returnStdout: true).trim() - env.mirror_hostname_aws_private = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_private_name.value[0]' ", - returnStdout: true).trim() - if (params.prepare_aws_env) { - user = 'root' - sh "ssh-keygen -R ${mirror_hostname_local} -f /home/${node_user}/.ssh/known_hosts" - sh "scp ${ssh_option} ${params.key_file} ${user}@${mirror_hostname_local}:/root/testing-suma.pem" - sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'chmod 0400 /root/testing-suma.pem'" - sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'tar -czvf mirror.tar.gz -C /srv/mirror/ .'" - sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'scp ${ssh_option} -i /root/testing-suma.pem /root/mirror.tar.gz ec2-user@${mirror_hostname_aws_public}:/home/ec2-user/' " - sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo tar -xvf /home/ec2-user/mirror.tar.gz -C /srv/mirror/' " - sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/ibs/ /srv/mirror' " - sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/download/ibs/ /srv/mirror' " - sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/ibs' " - sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/download/ibs' " - } - - } +// stage("Upload local mirror data to AWS mirror") { +// +// // Get local and aws hostname +// mirror_hostname_local = sh(script: "cat ${local_mirror_dir}/terraform.tfstate | jq -r '.outputs.local_mirrors_public_ip.value[0][0]' ", +// returnStdout: true).trim() +// mirror_hostname_aws_public = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_public_name.value[0]' ", +// returnStdout: true).trim() +// env.mirror_hostname_aws_private = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_private_name.value[0]' ", +// returnStdout: true).trim() +// if (params.prepare_aws_env) { +// user = 'root' +// sh "ssh-keygen -R ${mirror_hostname_local} -f /home/${node_user}/.ssh/known_hosts" +// sh "scp ${ssh_option} ${params.key_file} ${user}@${mirror_hostname_local}:/root/testing-suma.pem" +// sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'chmod 0400 /root/testing-suma.pem'" +// sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'tar -czvf mirror.tar.gz -C /srv/mirror/ .'" +// sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'scp ${ssh_option} -i /root/testing-suma.pem /root/mirror.tar.gz ec2-user@${mirror_hostname_aws_public}:/home/ec2-user/' " +// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo tar -xvf /home/ec2-user/mirror.tar.gz -C /srv/mirror/' " +// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/ibs/ /srv/mirror' " +// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/download/ibs/ /srv/mirror' " +// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/ibs' " +// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/download/ibs' " +// } +// +// } } } else { From 6b4593ad2b62cde220f28c2cd76bca2d224b1af1 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 14:04:03 +1200 Subject: [PATCH 03/59] Remove duplicate values --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 2 -- 1 file changed, 2 deletions(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index 9605bd712..eef94c9c1 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -18,11 +18,9 @@ node('sumaform-cucumber-provo') { string(name: 'terracumber_ref', defaultValue: 'master', description: 'Terracumber Git ref (branch, tag...)'), booleanParam(name: 'terraform_init', defaultValue: true, description: 'Call terraform init (needed if modules are added or changes)'), booleanParam(name: 'terraform_taint', defaultValue: true, description: 'Call terraform taint (so the resources, except volumes, are recreated)'), - booleanParam(name: 'use_previous_terraform_state', defaultValue: true, description: 'Use previous Terraform state'), booleanParam(name: 'show_product_changes', defaultValue: true, description: 'Show the product changes since the last build'), choice(name: 'rake_namespace', choices: ['cucumber', 'parallel'], description: 'Choose [parallel] (Clients and some features will run in parallel) or [cucumber] (all sequential)'), extendedChoice(name: 'functional_scopes', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_CHECKBOX', visibleItemCount: 30, value: '@scope_smdba,@scope_spacecmd,@scope_spacewalk_utils,@scope_visualization,@scope_notification_message,@scope_virtual_host_manager,@scope_subscription_matching,@scope_formulas,@scope_sp_migration,@scope_cve_audit,@scope_onboarding,@scope_content_lifecycle_management,@scope_res,@scope_recurring_actions,@scope_maintenance_windows,@scope_building_container_images,@scope_kubernetes_integration,@scope_openscap,@scope_deblike,@scope_action_chains,@scope_salt_ssh,@scope_tomcat,@scope_changing_software_channels,@scope_monitoring,@scope_salt,@scope_cobbler,@scope_sumatoolbox,@scope_virtualization,@scope_hub,@scope_retail,@scope_configuration_channels,@scope_content_staging,@scope_proxy,@scope_traditional_client,@scope_api,@scope_power_management,@scope_retracted_patches,@scope_ansible,@scope_reportdb,@scope_containerized_proxy', description: 'Choose the functional scopes that you want to test') - booleanParam(name: 'use_previous_terraform_state', defaultValue: false, description: 'Use previous Terraform state'), booleanParam(name: 'prepare_aws_env', defaultValue: true, description: 'Create local and AWS mirror and upload data to AWS mirror'), booleanParam(name: 'must_deploy', defaultValue: true, description: 'Deploy'), booleanParam(name: 'must_run_core', defaultValue: true, description: 'Run Core features'), From a304be62ded303ee985be1ab55062512b6f39357 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 14:05:52 +1200 Subject: [PATCH 04/59] Fix parameters description --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index eef94c9c1..f2b07cb3e 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -20,7 +20,7 @@ node('sumaform-cucumber-provo') { booleanParam(name: 'terraform_taint', defaultValue: true, description: 'Call terraform taint (so the resources, except volumes, are recreated)'), booleanParam(name: 'show_product_changes', defaultValue: true, description: 'Show the product changes since the last build'), choice(name: 'rake_namespace', choices: ['cucumber', 'parallel'], description: 'Choose [parallel] (Clients and some features will run in parallel) or [cucumber] (all sequential)'), - extendedChoice(name: 'functional_scopes', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_CHECKBOX', visibleItemCount: 30, value: '@scope_smdba,@scope_spacecmd,@scope_spacewalk_utils,@scope_visualization,@scope_notification_message,@scope_virtual_host_manager,@scope_subscription_matching,@scope_formulas,@scope_sp_migration,@scope_cve_audit,@scope_onboarding,@scope_content_lifecycle_management,@scope_res,@scope_recurring_actions,@scope_maintenance_windows,@scope_building_container_images,@scope_kubernetes_integration,@scope_openscap,@scope_deblike,@scope_action_chains,@scope_salt_ssh,@scope_tomcat,@scope_changing_software_channels,@scope_monitoring,@scope_salt,@scope_cobbler,@scope_sumatoolbox,@scope_virtualization,@scope_hub,@scope_retail,@scope_configuration_channels,@scope_content_staging,@scope_proxy,@scope_traditional_client,@scope_api,@scope_power_management,@scope_retracted_patches,@scope_ansible,@scope_reportdb,@scope_containerized_proxy', description: 'Choose the functional scopes that you want to test') + extendedChoice(name: 'functional_scopes', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_CHECKBOX', visibleItemCount: 30, value: '@scope_smdba,@scope_spacecmd,@scope_spacewalk_utils,@scope_visualization,@scope_notification_message,@scope_virtual_host_manager,@scope_subscription_matching,@scope_formulas,@scope_sp_migration,@scope_cve_audit,@scope_onboarding,@scope_content_lifecycle_management,@scope_res,@scope_recurring_actions,@scope_maintenance_windows,@scope_building_container_images,@scope_kubernetes_integration,@scope_openscap,@scope_deblike,@scope_action_chains,@scope_salt_ssh,@scope_tomcat,@scope_changing_software_channels,@scope_monitoring,@scope_salt,@scope_cobbler,@scope_sumatoolbox,@scope_virtualization,@scope_hub,@scope_retail,@scope_configuration_channels,@scope_content_staging,@scope_proxy,@scope_traditional_client,@scope_api,@scope_power_management,@scope_retracted_patches,@scope_ansible,@scope_reportdb,@scope_containerized_proxy', description: 'Choose the functional scopes that you want to test'), booleanParam(name: 'prepare_aws_env', defaultValue: true, description: 'Create local and AWS mirror and upload data to AWS mirror'), booleanParam(name: 'must_deploy', defaultValue: true, description: 'Deploy'), booleanParam(name: 'must_run_core', defaultValue: true, description: 'Run Core features'), From ce99d077bcc059af8b78ff00e99e08c3bb863c72 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 14:07:37 +1200 Subject: [PATCH 05/59] Fix parameters description --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index f2b07cb3e..81c4fc1d4 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -31,7 +31,7 @@ node('sumaform-cucumber-provo') { string(name: 'key_file', defaultValue: '/home/jenkins/.ssh/testing-suma.pem', description: 'Path to SSH private key to access instance in AWS'), string(name: 'key_name', defaultValue: 'testing-suma', description: 'SSH key name in AWS'), text(name: 'allowed_IPS', defaultValue: '65.132.116.252', description: 'Add the public IPs to add to AWS ingress security group ( keep default Jenkins address ) separated by new line' ), - text(name: 'build_image', description: 'Build image url' )) + text(name: 'build_image', description: 'Build image url' ) ]) ]) From ad8735d945456831f6bc5ea0741581fdda3a6485 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 14:10:51 +1200 Subject: [PATCH 06/59] move variables around --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index 81c4fc1d4..87b3312aa 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -18,14 +18,14 @@ node('sumaform-cucumber-provo') { string(name: 'terracumber_ref', defaultValue: 'master', description: 'Terracumber Git ref (branch, tag...)'), booleanParam(name: 'terraform_init', defaultValue: true, description: 'Call terraform init (needed if modules are added or changes)'), booleanParam(name: 'terraform_taint', defaultValue: true, description: 'Call terraform taint (so the resources, except volumes, are recreated)'), - booleanParam(name: 'show_product_changes', defaultValue: true, description: 'Show the product changes since the last build'), - choice(name: 'rake_namespace', choices: ['cucumber', 'parallel'], description: 'Choose [parallel] (Clients and some features will run in parallel) or [cucumber] (all sequential)'), - extendedChoice(name: 'functional_scopes', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_CHECKBOX', visibleItemCount: 30, value: '@scope_smdba,@scope_spacecmd,@scope_spacewalk_utils,@scope_visualization,@scope_notification_message,@scope_virtual_host_manager,@scope_subscription_matching,@scope_formulas,@scope_sp_migration,@scope_cve_audit,@scope_onboarding,@scope_content_lifecycle_management,@scope_res,@scope_recurring_actions,@scope_maintenance_windows,@scope_building_container_images,@scope_kubernetes_integration,@scope_openscap,@scope_deblike,@scope_action_chains,@scope_salt_ssh,@scope_tomcat,@scope_changing_software_channels,@scope_monitoring,@scope_salt,@scope_cobbler,@scope_sumatoolbox,@scope_virtualization,@scope_hub,@scope_retail,@scope_configuration_channels,@scope_content_staging,@scope_proxy,@scope_traditional_client,@scope_api,@scope_power_management,@scope_retracted_patches,@scope_ansible,@scope_reportdb,@scope_containerized_proxy', description: 'Choose the functional scopes that you want to test'), booleanParam(name: 'prepare_aws_env', defaultValue: true, description: 'Create local and AWS mirror and upload data to AWS mirror'), booleanParam(name: 'must_deploy', defaultValue: true, description: 'Deploy'), booleanParam(name: 'must_run_core', defaultValue: true, description: 'Run Core features'), booleanParam(name: 'must_init_clients', defaultValue: true, description: 'Run init clients'), booleanParam(name: 'must_secondary', defaultValue: true, description: 'Run secondary featuress'), + booleanParam(name: 'show_product_changes', defaultValue: true, description: 'Show the product changes since the last build'), + choice(name: 'rake_namespace', choices: ['cucumber', 'parallel'], description: 'Choose [parallel] (Clients and some features will run in parallel) or [cucumber] (all sequential)'), + extendedChoice(name: 'functional_scopes', multiSelectDelimiter: ',', quoteValue: false, saveJSONParameterToFile: false, type: 'PT_CHECKBOX', visibleItemCount: 30, value: '@scope_smdba,@scope_spacecmd,@scope_spacewalk_utils,@scope_visualization,@scope_notification_message,@scope_virtual_host_manager,@scope_subscription_matching,@scope_formulas,@scope_sp_migration,@scope_cve_audit,@scope_onboarding,@scope_content_lifecycle_management,@scope_res,@scope_recurring_actions,@scope_maintenance_windows,@scope_building_container_images,@scope_kubernetes_integration,@scope_openscap,@scope_deblike,@scope_action_chains,@scope_salt_ssh,@scope_tomcat,@scope_changing_software_channels,@scope_monitoring,@scope_salt,@scope_cobbler,@scope_sumatoolbox,@scope_virtualization,@scope_hub,@scope_retail,@scope_configuration_channels,@scope_content_staging,@scope_proxy,@scope_traditional_client,@scope_api,@scope_power_management,@scope_retracted_patches,@scope_ansible,@scope_reportdb,@scope_containerized_proxy', description: 'Choose the functional scopes that you want to test'), string(name: 'aws_region', defaultValue: 'eu-central-1', description: 'Describe the AWS region where to deploy the server'), string(name: 'aws_availability_zone', defaultValue: 'eu-central-1a', description: 'Describe the AWS availability zone to deploy the server'), string(name: 'key_file', defaultValue: '/home/jenkins/.ssh/testing-suma.pem', description: 'Path to SSH private key to access instance in AWS'), From 44284cdd3b20b819ea203b4d8c3f16d96074dcaf Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 14:13:19 +1200 Subject: [PATCH 07/59] Fix terraform file path --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index 87b3312aa..659832b80 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -7,7 +7,7 @@ node('sumaform-cucumber-provo') { parameters([ string(name: 'cucumber_gitrepo', defaultValue: 'https://github.com/uyuni-project/uyuni.git', description: 'Testsuite Git Repository'), string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'), - string(name: 'tf_file', defaultValue: 'susemanager-ci/terracumber_config/tf_files/SUSEManager-Head-NUE.tf', description: 'Path to the tf file to be used'), + string(name: 'tf_file', defaultValue: 'SUSEManager-4.3-build-validation-AWS.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)'), @@ -16,8 +16,6 @@ node('sumaform-cucumber-provo') { string(name: 'terraform_parallelism', defaultValue: '', description: 'Advanced: Define the number of parallel resource operations for terraform'), string(name: 'terracumber_gitrepo', defaultValue: 'https://github.com/uyuni-project/terracumber.git', description: 'Terracumber Git Repository'), string(name: 'terracumber_ref', defaultValue: 'master', description: 'Terracumber Git ref (branch, tag...)'), - booleanParam(name: 'terraform_init', defaultValue: true, description: 'Call terraform init (needed if modules are added or changes)'), - booleanParam(name: 'terraform_taint', defaultValue: true, description: 'Call terraform taint (so the resources, except volumes, are recreated)'), booleanParam(name: 'prepare_aws_env', defaultValue: true, description: 'Create local and AWS mirror and upload data to AWS mirror'), booleanParam(name: 'must_deploy', defaultValue: true, description: 'Deploy'), booleanParam(name: 'must_run_core', defaultValue: true, description: 'Run Core features'), From 6186723f2e08a65693dbc80f440abd425f6aa01d Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 14:20:39 +1200 Subject: [PATCH 08/59] Fix condition for upload image --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index cb9c29ae3..809acbdcd 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -88,13 +88,12 @@ def run(params) { sh "set +x; source /home/jenkins/.credentials set -x; ./terracumber-cli ${local_mirror_params} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync" sh "set +x; source /home/jenkins/.credentials set -x; ./terracumber-cli ${common_params} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync --sumaform-backend aws --runstep gitsync" } - - if (params.build_image != null) { + if (params.prepare_aws_env) { stage("Prepare AWS environment") { parallel( "upload_latest_image": { - if (params.use_latest_ami_image) { + if (params.build_image != null) { // stage('Clean old images') { // // Get all image ami ids // image_amis = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].ImageId'", From f41dfaf425f0f852a2aed4e1a614011672648850 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 14:26:11 +1200 Subject: [PATCH 09/59] fix groovy function --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 809acbdcd..1dd785b4b 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -29,7 +29,7 @@ def run(params) { subnet_id = 'subnet-05b9d049f3af01c38' image_help_ami = 'ami-0ad2088f58aad429e' - pattern = ~/\/([^\/]*Manager-(?:Server|Proxy)-[^\/]*)-[^\/]*BYOS[^\/]*-Build(\d+\.\d+)\.raw\.xz/ + if (params.terraform_parallelism) { local_mirror_params = "${local_mirror_params} --parallelism ${params.terraform_parallelism}" @@ -305,7 +305,8 @@ def run(params) { } def extractBuildName(String url) { - def matcher = (url =~ ${pattern}) + def pattern = ~/\/([^\/]*Manager-(?:Server|Proxy)-[^\/]*)-[^\/]*BYOS[^\/]*-Build(\d+\.\d+)\.raw\.xz/ + def matcher = (url =~ pattern) def lastIndex = url.lastIndexOf('/') def fileImageName = url.substring(lastIndex + 1) From b345f788a0b8858ba32f49d9f3b8998856dedc0c Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 15:01:30 +1200 Subject: [PATCH 10/59] First version tf file --- .../SUSEManager-5.0-build-image-AWS.tf | 369 ++++++++++++++++++ 1 file changed, 369 insertions(+) create mode 100644 terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf new file mode 100644 index 000000000..e0f939416 --- /dev/null +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -0,0 +1,369 @@ + +// Mandatory variables for terracumber +variable "URL_PREFIX" { + type = string + default = "https://ci.suse.de/view/Manager/view/Manager-50/job/manager-5.0-build-image-aws" +} + +// Not really used as this is for --runall parameter, and we run cucumber step by step +variable "CUCUMBER_COMMAND" { + type = string + default = "export PRODUCT='SUSE-Manager' && run-testsuite" +} + +variable "CUCUMBER_GITREPO" { + type = string + default = "https://github.com/uyuni-project/uyuni.git" +} + +variable "CUCUMBER_BRANCH" { + type = string + default = "master" +} + +variable "CUCUMBER_RESULTS" { + type = string + default = "/root/spacewalk/testsuite" +} + +variable "MAIL_SUBJECT" { + type = string + default = "Results Manager5.0-WS-MU $status: $tests scenarios ($failures failed, $errors errors, $skipped skipped, $passed passed)" +} + +variable "MAIL_TEMPLATE" { + type = string + default = "../mail_templates/mail-template-jenkins.txt" +} + +variable "MAIL_SUBJECT_ENV_FAIL" { + type = string + default = "Results Manager5.0-AWS-MU: Environment setup failed" +} + +variable "MAIL_TEMPLATE_ENV_FAIL" { + type = string + default = "../mail_templates/mail-template-jenkins-env-fail.txt" +} + +variable "MAIL_FROM" { + type = string + default = "galaxy-noise@suse.de" +} + +variable "MAIL_TO" { + type = string + default = "galaxy-noise@suse.de" +} + +// sumaform specific variables +variable "SCC_USER" { + type = string +} + +variable "SCC_PASSWORD" { + type = string +} + +variable "GIT_USER" { + type = string + default = null // Not needed for master, as it is public +} + +variable "GIT_PASSWORD" { + type = string + default = null // Not needed for master, as it is public +} + +variable "REGION" { + type = string + default = null +} + +variable "MIRROR"{ + type = string + default = null +} + +variable "AVAILABILITY_ZONE" { + type = string + default = null +} + +variable "KEY_FILE" { + type = string + default = "/home/jenkins/.ssh/testing-suma.pem" +} + +variable "KEY_NAME" { + type = string + default = "testing-suma" +} + +variable "SERVER_REGISTRATION_CODE" { + type = string + default = null +} + +variable "PROXY_REGISTRATION_CODE" { + type = string + default = null +} + +variable "SLES_REGISTRATION_CODE" { + type = string + default = null +} + +variable "ALLOWED_IPS" { + type = list(string) + default = [] +} + +variable "NAME_PREFIX" { + type = string + default = null +} + + +locals { + domain = "suma.ci.aws" +} + +provider "aws" { + region = var.REGION +} + +module "base" { + source = "./modules/base" + + cc_username = var.SCC_USER + cc_password = var.SCC_PASSWORD + name_prefix = var.NAME_PREFIX + mirror = var.MIRROR + testsuite = true + + images = ["rocky8", "opensuse155o", "sles15sp5o", "sles15sp4o", "ubuntu2204"] + provider_settings = { + availability_zone = var.AVAILABILITY_ZONE + region = var.REGION + ssh_allowed_ips = var.ALLOWED_IPS + key_name = var.KEY_NAME + key_file = var.KEY_FILE + route53_domain = local.domain + bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" + } +} + + +module "mirror" { + source = "./modules/mirror" + base_configuration = module.base.configuration + disable_cron = true + provider_settings = { + public_instance = true + } + image = "opensuse155o" +} + +module "server" { + source = "./modules/server_containerized" + base_configuration = merge(module.base.configuration, + { + mirror = null + }) + name = "server" + product_version = "head" + repository_disk_size = 1500 + image = var.SERVER_AMI + server_registration_code = var.SERVER_REGISTRATION_CODE + + auto_accept = false + monitored = true + disable_firewall = false + allow_postgres_connections = false + skip_changelog_import = false + create_first_user = false + mgr_sync_autologin = false + create_sample_channel = false + create_sample_activation_key = false + create_sample_bootstrap_script = false + publish_private_ssl_key = false + use_os_released_updates = false + disable_download_tokens = false + ssh_key_path = "./salt/controller/id_rsa.pub" + provider_settings = { + instance_type = "m6a.xlarge" + } + //server_additional_repos + +} + +module "proxy" { + + source = "./modules/proxy" + base_configuration = module.base.configuration + server_configuration = module.server.configuration + product_version = "head" + name = "proxy" + proxy_registration_code = var.PROXY_REGISTRATION_CODE + + auto_register = false + auto_connect_to_master = false + download_private_ssl_key = false + install_proxy_pattern = false + auto_configure = false + generate_bootstrap_script = false + publish_private_ssl_key = false + use_os_released_updates = false + proxy_containerized = false + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true + //proxy_additional_repos + +} + +module "suse-client" { + + source = "./modules/client" + base_configuration = module.base.configuration + name = "cli-sles15" + image = "sles15sp4o" + product_version = "4.3-released" + server_configuration = module.server.configuration + sles_registration_code = var.SLES_REGISTRATION_CODE + auto_register = false + use_os_released_updates = false + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true + provider_settings = { + instance_type = "t3a.medium" + } + //sle15sp4-client_additional_repos +} + +module "suse-minion" { + source = "./modules/minion" + base_configuration = module.base.configuration + product_version = "4.3-released" + name = "min-sles15" + image = "sles15sp4o" + server_configuration = module.server.configuration + sles_registration_code = var.SLES_REGISTRATION_CODE + auto_connect_to_master = false + use_os_released_updates = true + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true + provider_settings = { + instance_type = "t3a.medium" + } + //sle15sp4-minion_additional_repos + +} + +module "suse-sshminion" { + source = "./modules/sshminion" + base_configuration = module.base.configuration + product_version = "4.3-released" + name = "minssh-sles15" + image = "sles15sp4o" + sles_registration_code = var.SLES_REGISTRATION_CODE + use_os_released_updates = true + ssh_key_path = "./salt/controller/id_rsa.pub" + gpg_keys = ["default/gpg_keys/galaxy.key"] + additional_packages = [ "venv-salt-minion" , "iptables"] + install_salt_bundle = true + provider_settings = { + instance_type = "t3a.medium" + } + +} + +module "redhat-minion" { + image = "rocky8" + name = "min-rocky8" + provider_settings = { + // Since start of May we have problems with the instance not booting after a restart if there is only a CPU and only 1024Mb for RAM + // Also, openscap cannot run with less than 1.25 GB of RAM + memory = 2048 + vcpu = 2 + instance_type = "t3a.medium" + } + source = "./modules/minion" + base_configuration = module.base.configuration + product_version = "4.3-released" + server_configuration = module.server.configuration + auto_connect_to_master = false + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true +} + +module "debian-minion" { + name = "min-ubuntu2204" + image = "ubuntu2204" + source = "./modules/minion" + base_configuration = module.base.configuration + product_version = "4.3-released" + server_configuration = module.server.configuration + auto_connect_to_master = false + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true + provider_settings = { + instance_type = "t3a.medium" + } +} + +module "controller" { + source = "./modules/controller" + base_configuration = module.base.configuration + name = "ctl" + provider_settings = { + memory = 16384 + vcpu = 8 + } + swap_file_size = null + no_mirror = true + is_using_build_image = true + is_using_scc_repositories = true + // Cucumber repository configuration for the controller + git_username = var.GIT_USER + git_password = var.GIT_PASSWORD + git_repo = var.CUCUMBER_GITREPO + branch = var.CUCUMBER_BRANCH + + server_configuration = module.server.configuration + proxy_configuration = module.proxy.configuration + client_configuration = module.suse-client.configuration + minion_configuration = module.suse-minion.configuration +// buildhost_configuration = module.build-host.configuration + sshminion_configuration = module.suse-sshminion.configuration + redhat_configuration = module.redhat-minion.configuration + debian_configuration = module.debian-minion.configuration + +} + +output "bastion_public_name" { + value = lookup(module.base.configuration, "bastion_host", null) +} + +output "aws_mirrors_private_name" { + value = module.mirror.configuration.hostnames +} + +output "aws_mirrors_public_name" { + value = module.mirror.configuration.public_names +} + +output "configuration" { + value = { + controller = module.controller.configuration + bastion = { + hostname = lookup(module.base.configuration, "bastion_host", null) + } + } +} From e98a9ff8956824e1e3542a619e4440168b3182a1 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 15:03:27 +1200 Subject: [PATCH 11/59] Add containerized server --- .../tf_files/SUSEManager-5.0-build-image-AWS.tf | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index e0f939416..a4db15346 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -178,20 +178,27 @@ module "server" { image = var.SERVER_AMI server_registration_code = var.SERVER_REGISTRATION_CODE + runtime = "podman" + container_repository = "registry.suse.com/suse/manager/5.0/x86_64" + // Most recent code. Enable again once Beta 2 will be approved: + // container_repository = "registry.suse.de/devel/galaxy/manager/head/containerfile/suse/manager/5.0/x86_64" + + + java_debugging = false auto_accept = false - monitored = true disable_firewall = false allow_postgres_connections = false skip_changelog_import = false - create_first_user = false mgr_sync_autologin = false create_sample_channel = false create_sample_activation_key = false create_sample_bootstrap_script = false publish_private_ssl_key = false - use_os_released_updates = false + use_os_released_updates = true disable_download_tokens = false - ssh_key_path = "./salt/controller/id_rsa.pub" + large_deployment = true + ssh_key_path = "./salt/controller/id_rsa.pub" + from_email = "root@suse.de" provider_settings = { instance_type = "m6a.xlarge" } From aabf5333e82d2e81dd92232256fed9d5872e5e07 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 15:04:25 +1200 Subject: [PATCH 12/59] Change default tf file --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index 659832b80..b3c91c6ca 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -7,7 +7,7 @@ node('sumaform-cucumber-provo') { parameters([ string(name: 'cucumber_gitrepo', defaultValue: 'https://github.com/uyuni-project/uyuni.git', description: 'Testsuite Git Repository'), string(name: 'cucumber_ref', defaultValue: 'master', description: 'Testsuite Git reference (branch, tag...)'), - string(name: 'tf_file', defaultValue: 'SUSEManager-4.3-build-validation-AWS.tf', description: 'Path to the tf file to be used'), + string(name: 'tf_file', defaultValue: 'SUSEManager-5.0-build-image-AWS.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)'), From 6df8bcf93cbc3ce2181bf1f5b9a5017197ec3d44 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 15:05:34 +1200 Subject: [PATCH 13/59] add back mirror creation --- .../environments/common/pipeline-aws.groovy | 112 +++++++++--------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 1dd785b4b..84adf014e 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -138,64 +138,64 @@ def run(params) { } } }, -// "create_local_mirror_with_mu": { -// stage("Create local mirror with MU") { -// // Copy minimum repo list to mirror -// sh "cp ${local_mirror_dir}/salt/mirror/etc/minimum_repositories_testsuite.yaml ${local_mirror_dir}/salt/mirror/etc/minima-customize.yaml" -// // Deploy local mirror -// sh "set +x; source /home/jenkins/.credentials set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${local_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-local.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend libvirt" -// deployed_local = true -// -// } -// }, -// "create_empty_aws_mirror": { -// stage("Create empty AWS mirror") { -// // Fix issue where result folder is created at the same time by local mirror and aws mirror -// sleep(30) -// NAME_PREFIX = env.JOB_NAME.toLowerCase().replace('.', '-') -// env.aws_configuration = "REGION = \"${params.aws_region}\"\n" + -// "AVAILABILITY_ZONE = \"${params.aws_availability_zone}\"\n" + -// "NAME_PREFIX = \"${NAME_PREFIX}\"\n" + -// "KEY_FILE = \"${params.key_file}\"\n" + -// "KEY_NAME = \"${params.key_name}\"\n" + -// "ALLOWED_IPS = [ \n" -// -// ALLOWED_IPS.each { ip -> -// env.aws_configuration = aws_configuration + " \"${ip}\",\n" -// } -// env.aws_configuration = aws_configuration + "]\n" -// writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: aws_configuration, encoding: "UTF-8" -// // Deploy empty AWS mirror -// sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend aws" -// -// } -// } + "create_local_mirror_with_mu": { + stage("Create local mirror with MU") { + // Copy minimum repo list to mirror + sh "cp ${local_mirror_dir}/salt/mirror/etc/minimum_repositories_testsuite.yaml ${local_mirror_dir}/salt/mirror/etc/minima-customize.yaml" + // Deploy local mirror + sh "set +x; source /home/jenkins/.credentials set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${local_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-local.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend libvirt" + deployed_local = true + + } + }, + "create_empty_aws_mirror": { + stage("Create empty AWS mirror") { + // Fix issue where result folder is created at the same time by local mirror and aws mirror + sleep(30) + NAME_PREFIX = env.JOB_NAME.toLowerCase().replace('.', '-') + env.aws_configuration = "REGION = \"${params.aws_region}\"\n" + + "AVAILABILITY_ZONE = \"${params.aws_availability_zone}\"\n" + + "NAME_PREFIX = \"${NAME_PREFIX}\"\n" + + "KEY_FILE = \"${params.key_file}\"\n" + + "KEY_NAME = \"${params.key_name}\"\n" + + "ALLOWED_IPS = [ \n" + + ALLOWED_IPS.each { ip -> + env.aws_configuration = aws_configuration + " \"${ip}\",\n" + } + env.aws_configuration = aws_configuration + "]\n" + writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: aws_configuration, encoding: "UTF-8" + // Deploy empty AWS mirror + sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend aws" + + } + } ) -// stage("Upload local mirror data to AWS mirror") { -// -// // Get local and aws hostname -// mirror_hostname_local = sh(script: "cat ${local_mirror_dir}/terraform.tfstate | jq -r '.outputs.local_mirrors_public_ip.value[0][0]' ", -// returnStdout: true).trim() -// mirror_hostname_aws_public = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_public_name.value[0]' ", -// returnStdout: true).trim() -// env.mirror_hostname_aws_private = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_private_name.value[0]' ", -// returnStdout: true).trim() -// if (params.prepare_aws_env) { -// user = 'root' -// sh "ssh-keygen -R ${mirror_hostname_local} -f /home/${node_user}/.ssh/known_hosts" -// sh "scp ${ssh_option} ${params.key_file} ${user}@${mirror_hostname_local}:/root/testing-suma.pem" -// sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'chmod 0400 /root/testing-suma.pem'" -// sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'tar -czvf mirror.tar.gz -C /srv/mirror/ .'" -// sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'scp ${ssh_option} -i /root/testing-suma.pem /root/mirror.tar.gz ec2-user@${mirror_hostname_aws_public}:/home/ec2-user/' " -// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo tar -xvf /home/ec2-user/mirror.tar.gz -C /srv/mirror/' " -// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/ibs/ /srv/mirror' " -// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/download/ibs/ /srv/mirror' " -// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/ibs' " -// sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/download/ibs' " -// } -// -// } + stage("Upload local mirror data to AWS mirror") { + + // Get local and aws hostname + mirror_hostname_local = sh(script: "cat ${local_mirror_dir}/terraform.tfstate | jq -r '.outputs.local_mirrors_public_ip.value[0][0]' ", + returnStdout: true).trim() + mirror_hostname_aws_public = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_public_name.value[0]' ", + returnStdout: true).trim() + env.mirror_hostname_aws_private = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_private_name.value[0]' ", + returnStdout: true).trim() + if (params.prepare_aws_env) { + user = 'root' + sh "ssh-keygen -R ${mirror_hostname_local} -f /home/${node_user}/.ssh/known_hosts" + sh "scp ${ssh_option} ${params.key_file} ${user}@${mirror_hostname_local}:/root/testing-suma.pem" + sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'chmod 0400 /root/testing-suma.pem'" + sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'tar -czvf mirror.tar.gz -C /srv/mirror/ .'" + sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'scp ${ssh_option} -i /root/testing-suma.pem /root/mirror.tar.gz ec2-user@${mirror_hostname_aws_public}:/home/ec2-user/' " + sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo tar -xvf /home/ec2-user/mirror.tar.gz -C /srv/mirror/' " + sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/ibs/ /srv/mirror' " + sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/download/ibs/ /srv/mirror' " + sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/ibs' " + sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/download/ibs' " + } + + } } } else { From a40a1a3b526753bf86a241928a39befdd1b3e689 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 15:09:44 +1200 Subject: [PATCH 14/59] add step to end to get ami --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 84adf014e..0cf669305 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -203,6 +203,12 @@ def run(params) { env.mirror_hostname_aws_private = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_private_name.value[0]' ", returnStdout: true).trim() } + stage("Get uploaded image amis") { + env.server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", + returnStdout: true).trim() + env.proxy_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${proxy_image_name}' --region ${params.aws_region} | jq -r '.Images[0].ImageId'", + returnStdout: true).trim() + } } stage('Product changes') { From 2d4564e93bcbbd5f12b028925b90d08b53da7f1b Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 15:31:21 +1200 Subject: [PATCH 15/59] Remove taint from mirror --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 0cf669305..9f07dc48a 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -133,8 +133,8 @@ def run(params) { // sh(script: "ec2uploadimg -a test --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --ena-support --verbose --regions '${params.aws_region}' -d 'build_suma_proxy' --wait-count 3 -n '${proxy_image_name}' '${resultdir}/images/${proxy_image_name}'") env.server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", returnStdout: true).trim() - env.proxy_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${proxy_image_name}' --region ${params.aws_region} | jq -r '.Images[0].ImageId'", - returnStdout: true).trim() +// env.proxy_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${proxy_image_name}' --region ${params.aws_region} | jq -r '.Images[0].ImageId'", +// returnStdout: true).trim() } } }, @@ -166,7 +166,7 @@ def run(params) { env.aws_configuration = aws_configuration + "]\n" writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: aws_configuration, encoding: "UTF-8" // Deploy empty AWS mirror - sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend aws" + sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" } } From fce3257a2f832b547231ca353df8a1f9cae1adf3 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 2 May 2024 16:05:35 +1200 Subject: [PATCH 16/59] Updaet jenkisn ip --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index b3c91c6ca..29d18bada 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -28,7 +28,7 @@ node('sumaform-cucumber-provo') { string(name: 'aws_availability_zone', defaultValue: 'eu-central-1a', description: 'Describe the AWS availability zone to deploy the server'), string(name: 'key_file', defaultValue: '/home/jenkins/.ssh/testing-suma.pem', description: 'Path to SSH private key to access instance in AWS'), string(name: 'key_name', defaultValue: 'testing-suma', description: 'SSH key name in AWS'), - text(name: 'allowed_IPS', defaultValue: '65.132.116.252', description: 'Add the public IPs to add to AWS ingress security group ( keep default Jenkins address ) separated by new line' ), + text(name: 'allowed_IPS', defaultValue: '65.132.116.254', description: 'Add the public IPs to add to AWS ingress security group ( keep default Jenkins address ) separated by new line' ), text(name: 'build_image', description: 'Build image url' ) ]) ]) From 2b05568cc9b31ede324b0e166f6946805c54f06b Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 7 May 2024 13:52:15 +1200 Subject: [PATCH 17/59] Try to fix backend issue for aws deployment --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 9f07dc48a..5e54cac6f 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -86,7 +86,7 @@ def run(params) { } // Clone sumaform for aws and local repositories sh "set +x; source /home/jenkins/.credentials set -x; ./terracumber-cli ${local_mirror_params} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync" - sh "set +x; source /home/jenkins/.credentials set -x; ./terracumber-cli ${common_params} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync --sumaform-backend aws --runstep gitsync" + sh "set +x; source /home/jenkins/.credentials set -x; ./terracumber-cli ${common_params} --gitrepo ${params.sumaform_gitrepo} --gitref ${params.sumaform_ref} --runstep gitsync --sumaform-backend aws" } if (params.prepare_aws_env) { stage("Prepare AWS environment") { @@ -236,7 +236,7 @@ def run(params) { // Deploying AWS server using MU repositories sh "echo \"export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --custom-repositories ${WORKSPACE}/custom_repositories.json --sumaform-backend aws\"" retry(count: 3) { - sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend aws" + sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" deployed_aws = true } } From 2d0667aaab26ba0de6611851495dfd46f69fd0ae Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 7 May 2024 15:06:18 +1200 Subject: [PATCH 18/59] Add possibility to get the last build image --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 8 +++++--- .../environments/manager-5.0-dev-acceptance-tests-AWS | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 5e54cac6f..3faf01973 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -14,6 +14,7 @@ def run(params) { server_ami = null proxy_ami = null + url_build_image = "https://download.suse.de/ibs/Devel:/PubCloud:/Stable:/CrossCloud:/SLE15-SP5/images/" //Deployment variables deployed_local = false @@ -93,7 +94,7 @@ def run(params) { parallel( "upload_latest_image": { - if (params.build_image != null) { + if (params.build_image != null or params.build_last_image) { // stage('Clean old images') { // // Get all image ami ids // image_amis = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].ImageId'", @@ -123,8 +124,9 @@ def run(params) { sh "rm -rf ${resultdir}/images" sh "mkdir -p ${resultdir}/images" -// sh(script: "curl ${build_image} > images.html") -// server_image_name = sh(script: "grep -oP '(?<=href=\")Manager-Server-.*BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() + sh(script: "curl ${url_build_image} > images.html") + server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() + build_image = "${url_build_image}/${server_raw_image}" // proxy_image_name = sh(script: "grep -oP '(?<=href=\")SUSE-Manager-Proxy-BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() def server_image_name = extractBuildName(build_image) sh(script: "cd ${resultdir}/images; wget ${build_image}") diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index 29d18bada..10b1d7457 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -29,6 +29,7 @@ node('sumaform-cucumber-provo') { string(name: 'key_file', defaultValue: '/home/jenkins/.ssh/testing-suma.pem', description: 'Path to SSH private key to access instance in AWS'), string(name: 'key_name', defaultValue: 'testing-suma', description: 'SSH key name in AWS'), text(name: 'allowed_IPS', defaultValue: '65.132.116.254', description: 'Add the public IPs to add to AWS ingress security group ( keep default Jenkins address ) separated by new line' ), + booleanParam(name: 'build_last_image', defaultValue: false, description: 'Get the last available image for 5.0, while overwrite build_image'), text(name: 'build_image', description: 'Build image url' ) ]) ]) From 6204ed8ae6425e40140ccb00de6515ffce20bad7 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 7 May 2024 15:10:41 +1200 Subject: [PATCH 19/59] Update or --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 3faf01973..ed43713c7 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -94,7 +94,7 @@ def run(params) { parallel( "upload_latest_image": { - if (params.build_image != null or params.build_last_image) { + if (params.build_image != null || params.build_last_image) { // stage('Clean old images') { // // Get all image ami ids // image_amis = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].ImageId'", From 73b623085d01f535c1ba37691ac2e09fc0409b21 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 7 May 2024 15:13:25 +1200 Subject: [PATCH 20/59] force x86 arch --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index ed43713c7..716902bef 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -125,7 +125,7 @@ def run(params) { sh "mkdir -p ${resultdir}/images" sh(script: "curl ${url_build_image} > images.html") - server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() + server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() build_image = "${url_build_image}/${server_raw_image}" // proxy_image_name = sh(script: "grep -oP '(?<=href=\")SUSE-Manager-Proxy-BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() def server_image_name = extractBuildName(build_image) From 7c1577377b6cbf5231e51610d6846a5f84dc4785 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 7 May 2024 15:19:55 +1200 Subject: [PATCH 21/59] Fix url --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 716902bef..43a148117 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -126,7 +126,7 @@ def run(params) { sh(script: "curl ${url_build_image} > images.html") server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() - build_image = "${url_build_image}/${server_raw_image}" + build_image = "${url_build_image}${server_raw_image}" // proxy_image_name = sh(script: "grep -oP '(?<=href=\")SUSE-Manager-Proxy-BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() def server_image_name = extractBuildName(build_image) sh(script: "cd ${resultdir}/images; wget ${build_image}") From a67eb609ff48105aebe44a69990e840c7a2f8dd4 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 8 May 2024 12:01:35 +1200 Subject: [PATCH 22/59] Only install server --- .../SUSEManager-5.0-build-image-AWS.tf | 336 +++++++++--------- 1 file changed, 168 insertions(+), 168 deletions(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index a4db15346..c89bf1de9 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -206,171 +206,171 @@ module "server" { } -module "proxy" { - - source = "./modules/proxy" - base_configuration = module.base.configuration - server_configuration = module.server.configuration - product_version = "head" - name = "proxy" - proxy_registration_code = var.PROXY_REGISTRATION_CODE - - auto_register = false - auto_connect_to_master = false - download_private_ssl_key = false - install_proxy_pattern = false - auto_configure = false - generate_bootstrap_script = false - publish_private_ssl_key = false - use_os_released_updates = false - proxy_containerized = false - ssh_key_path = "./salt/controller/id_rsa.pub" - additional_packages = [ "venv-salt-minion" ] - install_salt_bundle = true - //proxy_additional_repos - -} - -module "suse-client" { - - source = "./modules/client" - base_configuration = module.base.configuration - name = "cli-sles15" - image = "sles15sp4o" - product_version = "4.3-released" - server_configuration = module.server.configuration - sles_registration_code = var.SLES_REGISTRATION_CODE - auto_register = false - use_os_released_updates = false - ssh_key_path = "./salt/controller/id_rsa.pub" - additional_packages = [ "venv-salt-minion" ] - install_salt_bundle = true - provider_settings = { - instance_type = "t3a.medium" - } - //sle15sp4-client_additional_repos -} - -module "suse-minion" { - source = "./modules/minion" - base_configuration = module.base.configuration - product_version = "4.3-released" - name = "min-sles15" - image = "sles15sp4o" - server_configuration = module.server.configuration - sles_registration_code = var.SLES_REGISTRATION_CODE - auto_connect_to_master = false - use_os_released_updates = true - ssh_key_path = "./salt/controller/id_rsa.pub" - additional_packages = [ "venv-salt-minion" ] - install_salt_bundle = true - provider_settings = { - instance_type = "t3a.medium" - } - //sle15sp4-minion_additional_repos - -} - -module "suse-sshminion" { - source = "./modules/sshminion" - base_configuration = module.base.configuration - product_version = "4.3-released" - name = "minssh-sles15" - image = "sles15sp4o" - sles_registration_code = var.SLES_REGISTRATION_CODE - use_os_released_updates = true - ssh_key_path = "./salt/controller/id_rsa.pub" - gpg_keys = ["default/gpg_keys/galaxy.key"] - additional_packages = [ "venv-salt-minion" , "iptables"] - install_salt_bundle = true - provider_settings = { - instance_type = "t3a.medium" - } - -} - -module "redhat-minion" { - image = "rocky8" - name = "min-rocky8" - provider_settings = { - // Since start of May we have problems with the instance not booting after a restart if there is only a CPU and only 1024Mb for RAM - // Also, openscap cannot run with less than 1.25 GB of RAM - memory = 2048 - vcpu = 2 - instance_type = "t3a.medium" - } - source = "./modules/minion" - base_configuration = module.base.configuration - product_version = "4.3-released" - server_configuration = module.server.configuration - auto_connect_to_master = false - ssh_key_path = "./salt/controller/id_rsa.pub" - additional_packages = [ "venv-salt-minion" ] - install_salt_bundle = true -} - -module "debian-minion" { - name = "min-ubuntu2204" - image = "ubuntu2204" - source = "./modules/minion" - base_configuration = module.base.configuration - product_version = "4.3-released" - server_configuration = module.server.configuration - auto_connect_to_master = false - ssh_key_path = "./salt/controller/id_rsa.pub" - additional_packages = [ "venv-salt-minion" ] - install_salt_bundle = true - provider_settings = { - instance_type = "t3a.medium" - } -} - -module "controller" { - source = "./modules/controller" - base_configuration = module.base.configuration - name = "ctl" - provider_settings = { - memory = 16384 - vcpu = 8 - } - swap_file_size = null - no_mirror = true - is_using_build_image = true - is_using_scc_repositories = true - // Cucumber repository configuration for the controller - git_username = var.GIT_USER - git_password = var.GIT_PASSWORD - git_repo = var.CUCUMBER_GITREPO - branch = var.CUCUMBER_BRANCH - - server_configuration = module.server.configuration - proxy_configuration = module.proxy.configuration - client_configuration = module.suse-client.configuration - minion_configuration = module.suse-minion.configuration -// buildhost_configuration = module.build-host.configuration - sshminion_configuration = module.suse-sshminion.configuration - redhat_configuration = module.redhat-minion.configuration - debian_configuration = module.debian-minion.configuration - -} - -output "bastion_public_name" { - value = lookup(module.base.configuration, "bastion_host", null) -} - -output "aws_mirrors_private_name" { - value = module.mirror.configuration.hostnames -} - -output "aws_mirrors_public_name" { - value = module.mirror.configuration.public_names -} - -output "configuration" { - value = { - controller = module.controller.configuration - bastion = { - hostname = lookup(module.base.configuration, "bastion_host", null) - } - } -} +# module "proxy" { +# +# source = "./modules/proxy" +# base_configuration = module.base.configuration +# server_configuration = module.server.configuration +# product_version = "head" +# name = "proxy" +# proxy_registration_code = var.PROXY_REGISTRATION_CODE +# +# auto_register = false +# auto_connect_to_master = false +# download_private_ssl_key = false +# install_proxy_pattern = false +# auto_configure = false +# generate_bootstrap_script = false +# publish_private_ssl_key = false +# use_os_released_updates = false +# proxy_containerized = false +# ssh_key_path = "./salt/controller/id_rsa.pub" +# additional_packages = [ "venv-salt-minion" ] +# install_salt_bundle = true +# //proxy_additional_repos +# +# } +# +# module "suse-client" { +# +# source = "./modules/client" +# base_configuration = module.base.configuration +# name = "cli-sles15" +# image = "sles15sp4o" +# product_version = "4.3-released" +# server_configuration = module.server.configuration +# sles_registration_code = var.SLES_REGISTRATION_CODE +# auto_register = false +# use_os_released_updates = false +# ssh_key_path = "./salt/controller/id_rsa.pub" +# additional_packages = [ "venv-salt-minion" ] +# install_salt_bundle = true +# provider_settings = { +# instance_type = "t3a.medium" +# } +# //sle15sp4-client_additional_repos +# } +# +# module "suse-minion" { +# source = "./modules/minion" +# base_configuration = module.base.configuration +# product_version = "4.3-released" +# name = "min-sles15" +# image = "sles15sp4o" +# server_configuration = module.server.configuration +# sles_registration_code = var.SLES_REGISTRATION_CODE +# auto_connect_to_master = false +# use_os_released_updates = true +# ssh_key_path = "./salt/controller/id_rsa.pub" +# additional_packages = [ "venv-salt-minion" ] +# install_salt_bundle = true +# provider_settings = { +# instance_type = "t3a.medium" +# } +# //sle15sp4-minion_additional_repos +# +# } +# +# module "suse-sshminion" { +# source = "./modules/sshminion" +# base_configuration = module.base.configuration +# product_version = "4.3-released" +# name = "minssh-sles15" +# image = "sles15sp4o" +# sles_registration_code = var.SLES_REGISTRATION_CODE +# use_os_released_updates = true +# ssh_key_path = "./salt/controller/id_rsa.pub" +# gpg_keys = ["default/gpg_keys/galaxy.key"] +# additional_packages = [ "venv-salt-minion" , "iptables"] +# install_salt_bundle = true +# provider_settings = { +# instance_type = "t3a.medium" +# } +# +# } +# +# module "redhat-minion" { +# image = "rocky8" +# name = "min-rocky8" +# provider_settings = { +# // Since start of May we have problems with the instance not booting after a restart if there is only a CPU and only 1024Mb for RAM +# // Also, openscap cannot run with less than 1.25 GB of RAM +# memory = 2048 +# vcpu = 2 +# instance_type = "t3a.medium" +# } +# source = "./modules/minion" +# base_configuration = module.base.configuration +# product_version = "4.3-released" +# server_configuration = module.server.configuration +# auto_connect_to_master = false +# ssh_key_path = "./salt/controller/id_rsa.pub" +# additional_packages = [ "venv-salt-minion" ] +# install_salt_bundle = true +# } +# +# module "debian-minion" { +# name = "min-ubuntu2204" +# image = "ubuntu2204" +# source = "./modules/minion" +# base_configuration = module.base.configuration +# product_version = "4.3-released" +# server_configuration = module.server.configuration +# auto_connect_to_master = false +# ssh_key_path = "./salt/controller/id_rsa.pub" +# additional_packages = [ "venv-salt-minion" ] +# install_salt_bundle = true +# provider_settings = { +# instance_type = "t3a.medium" +# } +# } +# +# module "controller" { +# source = "./modules/controller" +# base_configuration = module.base.configuration +# name = "ctl" +# provider_settings = { +# memory = 16384 +# vcpu = 8 +# } +# swap_file_size = null +# no_mirror = true +# is_using_build_image = true +# is_using_scc_repositories = true +# // Cucumber repository configuration for the controller +# git_username = var.GIT_USER +# git_password = var.GIT_PASSWORD +# git_repo = var.CUCUMBER_GITREPO +# branch = var.CUCUMBER_BRANCH +# +# server_configuration = module.server.configuration +# proxy_configuration = module.proxy.configuration +# client_configuration = module.suse-client.configuration +# minion_configuration = module.suse-minion.configuration +# // buildhost_configuration = module.build-host.configuration +# sshminion_configuration = module.suse-sshminion.configuration +# redhat_configuration = module.redhat-minion.configuration +# debian_configuration = module.debian-minion.configuration +# +# } +# +# output "bastion_public_name" { +# value = lookup(module.base.configuration, "bastion_host", null) +# } +# +# output "aws_mirrors_private_name" { +# value = module.mirror.configuration.hostnames +# } +# +# output "aws_mirrors_public_name" { +# value = module.mirror.configuration.public_names +# } +# +# output "configuration" { +# value = { +# controller = module.controller.configuration +# bastion = { +# hostname = lookup(module.base.configuration, "bastion_host", null) +# } +# } +# } From 4ff92ca95368c9eadd1f5a7fab85b3f6f8c7b73c Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 8 May 2024 12:09:45 +1200 Subject: [PATCH 23/59] Get last ami --- .../environments/common/pipeline-aws.groovy | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 43a148117..b7cf3772d 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -124,9 +124,11 @@ def run(params) { sh "rm -rf ${resultdir}/images" sh "mkdir -p ${resultdir}/images" - sh(script: "curl ${url_build_image} > images.html") - server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() - build_image = "${url_build_image}${server_raw_image}" + if (params.build_last_image) { + sh(script: "curl ${url_build_image} > images.html") + server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() + build_image = "${url_build_image}${server_raw_image}" + } // proxy_image_name = sh(script: "grep -oP '(?<=href=\")SUSE-Manager-Proxy-BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() def server_image_name = extractBuildName(build_image) sh(script: "cd ${resultdir}/images; wget ${build_image}") @@ -206,10 +208,16 @@ def run(params) { returnStdout: true).trim() } stage("Get uploaded image amis") { + if (params.build_last_image) { + sh(script: "curl ${url_build_image} > images.html") + server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() + build_image = "${url_build_image}${server_raw_image}" + } + def server_image_name = extractBuildName(build_image) env.server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", returnStdout: true).trim() - env.proxy_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${proxy_image_name}' --region ${params.aws_region} | jq -r '.Images[0].ImageId'", - returnStdout: true).trim() +// env.proxy_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${proxy_image_name}' --region ${params.aws_region} | jq -r '.Images[0].ImageId'", +// returnStdout: true).trim() } } From 21af89746f2f124180f288868b937393820781f7 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 8 May 2024 12:14:45 +1200 Subject: [PATCH 24/59] Remove custom repo --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index b7cf3772d..a50cb54f1 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -240,11 +240,11 @@ def run(params) { stage("Deploy AWS with MU") { int count = 0 // Replace internal repositories by mirror repositories - sh "sed -i 's/download.suse.de/${mirror_hostname_aws_private}/g' ${WORKSPACE}/custom_repositories.json" - sh "sed -i 's/ibs\\///g' ${WORKSPACE}/custom_repositories.json" +// sh "sed -i 's/download.suse.de/${mirror_hostname_aws_private}/g' ${WORKSPACE}/custom_repositories.json" +// sh "sed -i 's/ibs\\///g' ${WORKSPACE}/custom_repositories.json" // Deploying AWS server using MU repositories - sh "echo \"export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --custom-repositories ${WORKSPACE}/custom_repositories.json --sumaform-backend aws\"" +// sh "echo \"export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --custom-repositories ${WORKSPACE}/custom_repositories.json --sumaform-backend aws\"" retry(count: 3) { sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" deployed_aws = true From 541c14d4d432d966d48a8eec4bcf00937acca961 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 8 May 2024 12:18:04 +1200 Subject: [PATCH 25/59] remove server registration --- terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index c89bf1de9..e50c8183f 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -176,7 +176,7 @@ module "server" { product_version = "head" repository_disk_size = 1500 image = var.SERVER_AMI - server_registration_code = var.SERVER_REGISTRATION_CODE +# server_registration_code = var.SERVER_REGISTRATION_CODE runtime = "podman" container_repository = "registry.suse.com/suse/manager/5.0/x86_64" From e46225cdcd38f25359d46ab9de7b051851d867da Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 8 May 2024 12:28:57 +1200 Subject: [PATCH 26/59] Move the get ami image --- .../environments/common/pipeline-aws.groovy | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index a50cb54f1..4c9336c84 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -135,8 +135,7 @@ def run(params) { // sh(script: "cd ${resultdir}/images; wget ${suma_43_build_url}${proxy_image_name}") sh(script: "ec2uploadimg -a default --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --wait-count 3 --ena-support --verbose --regions '${params.aws_region}' -n '${server_image_name[0]}' -d 'build image' --ssh-key-pair 'testing-suma' --private-key-file '/home/jenkins/.ssh/testing-suma.pem' --security-group-ids '${security_group_id}' --vpc-subnet ${subnet_id} --type 't2.2xlarge' --user 'ec2-user' -e '${image_help_ami}' '${resultdir}/images/${server_image_name[1]}'") // sh(script: "ec2uploadimg -a test --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --ena-support --verbose --regions '${params.aws_region}' -d 'build_suma_proxy' --wait-count 3 -n '${proxy_image_name}' '${resultdir}/images/${proxy_image_name}'") - env.server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", - returnStdout: true).trim() + // env.proxy_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${proxy_image_name}' --region ${params.aws_region} | jq -r '.Images[0].ImageId'", // returnStdout: true).trim() } @@ -207,6 +206,9 @@ def run(params) { env.mirror_hostname_aws_private = sh(script: "cat ${aws_mirror_dir}/terraform.tfstate | jq -r '.outputs.aws_mirrors_private_name.value[0]' ", returnStdout: true).trim() } + } + + if (params.build_image != null || params.build_last_image) { stage("Get uploaded image amis") { if (params.build_last_image) { sh(script: "curl ${url_build_image} > images.html") @@ -214,10 +216,9 @@ def run(params) { build_image = "${url_build_image}${server_raw_image}" } def server_image_name = extractBuildName(build_image) - env.server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", + server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", returnStdout: true).trim() -// env.proxy_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${proxy_image_name}' --region ${params.aws_region} | jq -r '.Images[0].ImageId'", -// returnStdout: true).trim() + writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: "SERVER_AMI = \"${server_ami}\"", encoding: "UTF-8" } } From 2312496d639a9a5c1d59752e6dea4bed45f2d29c Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 8 May 2024 12:31:54 +1200 Subject: [PATCH 27/59] Declare server ami --- .../tf_files/SUSEManager-5.0-build-image-AWS.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index e50c8183f..39dbc4bd1 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -125,6 +125,10 @@ variable "NAME_PREFIX" { default = null } +variable "SERVER_AMI" { + type = string + default = "slemicro55" +} locals { domain = "suma.ci.aws" From 8828ca78d3261242942b22a6171d5f1aca255d2a Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 8 May 2024 12:39:26 +1200 Subject: [PATCH 28/59] Fix tfvars --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 4c9336c84..ac2d12583 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -218,7 +218,7 @@ def run(params) { def server_image_name = extractBuildName(build_image) server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", returnStdout: true).trim() - writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: "SERVER_AMI = \"${server_ami}\"", encoding: "UTF-8" + writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: "${env.aws_configuration}\nSERVER_AMI = \"${server_ami}\"", encoding: "UTF-8" } } From 323d9158525549035d34406b4a2c6e2b00f4a8e5 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 8 May 2024 12:42:49 +1200 Subject: [PATCH 29/59] Fix tfvars issue --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index ac2d12583..8f4a2dfbe 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -218,7 +218,7 @@ def run(params) { def server_image_name = extractBuildName(build_image) server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", returnStdout: true).trim() - writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: "${env.aws_configuration}\nSERVER_AMI = \"${server_ami}\"", encoding: "UTF-8" + sh script:"echo SERVER_AMI = \"${server_ami}\" >> ${aws_mirror_dir}/terraform.tfvars" } } From e621f72edac6f076f4abb5d043c93301e07c91bf Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 8 May 2024 12:47:06 +1200 Subject: [PATCH 30/59] Try to fix terraform --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 8f4a2dfbe..1ece0b481 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -218,7 +218,7 @@ def run(params) { def server_image_name = extractBuildName(build_image) server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", returnStdout: true).trim() - sh script:"echo SERVER_AMI = \"${server_ami}\" >> ${aws_mirror_dir}/terraform.tfvars" + sh script:"echo SERVER_AMI = \\\"${server_ami}\\\" >> ${aws_mirror_dir}/terraform.tfvars" } } From 8df2ed7e4d4345c9824ea242d16844349d931f66 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Fri, 10 May 2024 09:27:15 +1200 Subject: [PATCH 31/59] Move add ami --- .../environments/common/pipeline-aws.groovy | 23 +++---------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 1ece0b481..2bdfef778 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -129,15 +129,12 @@ def run(params) { server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() build_image = "${url_build_image}${server_raw_image}" } -// proxy_image_name = sh(script: "grep -oP '(?<=href=\")SUSE-Manager-Proxy-BYOS.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() def server_image_name = extractBuildName(build_image) sh(script: "cd ${resultdir}/images; wget ${build_image}") -// sh(script: "cd ${resultdir}/images; wget ${suma_43_build_url}${proxy_image_name}") sh(script: "ec2uploadimg -a default --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --wait-count 3 --ena-support --verbose --regions '${params.aws_region}' -n '${server_image_name[0]}' -d 'build image' --ssh-key-pair 'testing-suma' --private-key-file '/home/jenkins/.ssh/testing-suma.pem' --security-group-ids '${security_group_id}' --vpc-subnet ${subnet_id} --type 't2.2xlarge' --user 'ec2-user' -e '${image_help_ami}' '${resultdir}/images/${server_image_name[1]}'") -// sh(script: "ec2uploadimg -a test --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --ena-support --verbose --regions '${params.aws_region}' -d 'build_suma_proxy' --wait-count 3 -n '${proxy_image_name}' '${resultdir}/images/${proxy_image_name}'") - -// env.proxy_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${proxy_image_name}' --region ${params.aws_region} | jq -r '.Images[0].ImageId'", -// returnStdout: true).trim() + server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", + returnStdout: true).trim() + sh script:"echo SERVER_AMI = \\\"${server_ami}\\\" >> ${aws_mirror_dir}/terraform.tfvars" } } }, @@ -208,20 +205,6 @@ def run(params) { } } - if (params.build_image != null || params.build_last_image) { - stage("Get uploaded image amis") { - if (params.build_last_image) { - sh(script: "curl ${url_build_image} > images.html") - server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() - build_image = "${url_build_image}${server_raw_image}" - } - def server_image_name = extractBuildName(build_image) - server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", - returnStdout: true).trim() - sh script:"echo SERVER_AMI = \\\"${server_ami}\\\" >> ${aws_mirror_dir}/terraform.tfvars" - } - } - stage('Product changes') { if (params.show_product_changes) { sh """ From d9a82492280b099829b7d37f367a78f6006e9277 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Fri, 10 May 2024 11:36:15 +1200 Subject: [PATCH 32/59] Increase log level --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 2bdfef778..765003072 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -158,6 +158,8 @@ def run(params) { "NAME_PREFIX = \"${NAME_PREFIX}\"\n" + "KEY_FILE = \"${params.key_file}\"\n" + "KEY_NAME = \"${params.key_name}\"\n" + + "LOG = \"DEBUG\"\n" + + "LOG_PATH = \"${aws_mirror_dir}\"\n" + "ALLOWED_IPS = [ \n" ALLOWED_IPS.each { ip -> From faf764f78c24e8703ce6051e788b2dd7e789b947 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 08:31:35 +1200 Subject: [PATCH 33/59] Add log and descrease retry --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 765003072..d733954ac 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -158,8 +158,6 @@ def run(params) { "NAME_PREFIX = \"${NAME_PREFIX}\"\n" + "KEY_FILE = \"${params.key_file}\"\n" + "KEY_NAME = \"${params.key_name}\"\n" + - "LOG = \"DEBUG\"\n" + - "LOG_PATH = \"${aws_mirror_dir}\"\n" + "ALLOWED_IPS = [ \n" ALLOWED_IPS.each { ip -> @@ -168,7 +166,7 @@ def run(params) { env.aws_configuration = aws_configuration + "]\n" writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: aws_configuration, encoding: "UTF-8" // Deploy empty AWS mirror - sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" + sh "export TF_LOG=DEBUG; export TF_LOG_PATH=${aws_mirror_dir}; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" } } @@ -231,8 +229,8 @@ def run(params) { // Deploying AWS server using MU repositories // sh "echo \"export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --custom-repositories ${WORKSPACE}/custom_repositories.json --sumaform-backend aws\"" - retry(count: 3) { - sh "set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" + retry(count: 1) { + sh "export TF_LOG=DEBUG; export TF_LOG_PATH=${aws_mirror_dir}; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" deployed_aws = true } } From 97c48bbb7b11efb25f169e3922116fee2c71d4e2 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 09:03:52 +1200 Subject: [PATCH 34/59] Switch to NUE --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 2 +- terracumber_config/tf_files/local_mirror.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index 10b1d7457..1e0b6a414 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -1,6 +1,6 @@ #!/usr/bin/env groovy -node('sumaform-cucumber-provo') { +node('sumaform-cucumber') { properties([ buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '3')), disableConcurrentBuilds(), diff --git a/terracumber_config/tf_files/local_mirror.tf b/terracumber_config/tf_files/local_mirror.tf index ad7f3df7b..ce180fe72 100644 --- a/terracumber_config/tf_files/local_mirror.tf +++ b/terracumber_config/tf_files/local_mirror.tf @@ -92,7 +92,7 @@ terraform { } provider "libvirt" { - uri = "qemu+tcp://grog.mgr.prv.suse.net/system" + uri = "qemu+tcp://suma-05.mgr.suse.de/system" } locals { From e80ada520715f3792fb868e1e490c6805d729029 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 11:15:38 +1200 Subject: [PATCH 35/59] Update logpath and ip --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 5 +++-- .../environments/manager-5.0-dev-acceptance-tests-AWS | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index d733954ac..930776ecc 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -166,7 +166,8 @@ def run(params) { env.aws_configuration = aws_configuration + "]\n" writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: aws_configuration, encoding: "UTF-8" // Deploy empty AWS mirror - sh "export TF_LOG=DEBUG; export TF_LOG_PATH=${aws_mirror_dir}; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" + sh "export TF_LOG=DEBUG; export TF_LOG_PATH=${aws_mirror_dir}/terraform.log" + + "; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" } } @@ -230,7 +231,7 @@ def run(params) { // Deploying AWS server using MU repositories // sh "echo \"export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --custom-repositories ${WORKSPACE}/custom_repositories.json --sumaform-backend aws\"" retry(count: 1) { - sh "export TF_LOG=DEBUG; export TF_LOG_PATH=${aws_mirror_dir}; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" + sh "export TF_LOG=DEBUG; export TF_LOG_PATH=${aws_mirror_dir}/terraform.log; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" deployed_aws = true } } diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index 1e0b6a414..ee11600ad 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -28,7 +28,7 @@ node('sumaform-cucumber') { string(name: 'aws_availability_zone', defaultValue: 'eu-central-1a', description: 'Describe the AWS availability zone to deploy the server'), string(name: 'key_file', defaultValue: '/home/jenkins/.ssh/testing-suma.pem', description: 'Path to SSH private key to access instance in AWS'), string(name: 'key_name', defaultValue: 'testing-suma', description: 'SSH key name in AWS'), - text(name: 'allowed_IPS', defaultValue: '65.132.116.254', description: 'Add the public IPs to add to AWS ingress security group ( keep default Jenkins address ) separated by new line' ), + text(name: 'allowed_IPS', defaultValue: '195.135.223.28', description: 'Add the public IPs to add to AWS ingress security group ( keep default Jenkins address ) separated by new line' ), booleanParam(name: 'build_last_image', defaultValue: false, description: 'Get the last available image for 5.0, while overwrite build_image'), text(name: 'build_image', description: 'Build image url' ) ]) From 3e7233303fca74a63876c7cab5e398ea100cf1f3 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 11:20:21 +1200 Subject: [PATCH 36/59] Use mirror --- terracumber_config/tf_files/local_mirror.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terracumber_config/tf_files/local_mirror.tf b/terracumber_config/tf_files/local_mirror.tf index ce180fe72..a4a1b8788 100644 --- a/terracumber_config/tf_files/local_mirror.tf +++ b/terracumber_config/tf_files/local_mirror.tf @@ -105,6 +105,8 @@ module "base" { cc_username = var.SCC_USER cc_password = var.SCC_PASSWORD name_prefix = "mirror-mu-aws-" + mirror = "minima-mirror-ci-bv.mgr.suse.de" + use_mirror_images = true images = [ "opensuse155o"] From fd24eda644c69599957afbbb3bf710f19cec20cc Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 11:36:17 +1200 Subject: [PATCH 37/59] Change images list --- .../tf_files/SUSEManager-5.0-build-image-AWS.tf | 4 ++-- terracumber_config/tf_files/aws_mirror.tf | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index 39dbc4bd1..16287f5e8 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -146,8 +146,8 @@ module "base" { name_prefix = var.NAME_PREFIX mirror = var.MIRROR testsuite = true - - images = ["rocky8", "opensuse155o", "sles15sp5o", "sles15sp4o", "ubuntu2204"] + images = [ "opensuse155o"] +# images = ["rocky8", "opensuse155o", "sles15sp5o", "sles15sp4o", "ubuntu2204"] provider_settings = { availability_zone = var.AVAILABILITY_ZONE region = var.REGION diff --git a/terracumber_config/tf_files/aws_mirror.tf b/terracumber_config/tf_files/aws_mirror.tf index 286e53d26..3fc1642fa 100644 --- a/terracumber_config/tf_files/aws_mirror.tf +++ b/terracumber_config/tf_files/aws_mirror.tf @@ -133,6 +133,7 @@ module "base" { testsuite = true use_avahi = false use_eip_bastion = false + images = [ "opensuse155o"] provider_settings = { availability_zone = var.AVAILABILITY_ZONE region = var.REGION From f5120af9b1a89effde6981e7efce8314df389abf Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 11:50:21 +1200 Subject: [PATCH 38/59] Move back to provo --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 4 ++-- terracumber_config/tf_files/local_mirror.tf | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index ee11600ad..10b1d7457 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -1,6 +1,6 @@ #!/usr/bin/env groovy -node('sumaform-cucumber') { +node('sumaform-cucumber-provo') { properties([ buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '3')), disableConcurrentBuilds(), @@ -28,7 +28,7 @@ node('sumaform-cucumber') { string(name: 'aws_availability_zone', defaultValue: 'eu-central-1a', description: 'Describe the AWS availability zone to deploy the server'), string(name: 'key_file', defaultValue: '/home/jenkins/.ssh/testing-suma.pem', description: 'Path to SSH private key to access instance in AWS'), string(name: 'key_name', defaultValue: 'testing-suma', description: 'SSH key name in AWS'), - text(name: 'allowed_IPS', defaultValue: '195.135.223.28', description: 'Add the public IPs to add to AWS ingress security group ( keep default Jenkins address ) separated by new line' ), + text(name: 'allowed_IPS', defaultValue: '65.132.116.254', description: 'Add the public IPs to add to AWS ingress security group ( keep default Jenkins address ) separated by new line' ), booleanParam(name: 'build_last_image', defaultValue: false, description: 'Get the last available image for 5.0, while overwrite build_image'), text(name: 'build_image', description: 'Build image url' ) ]) diff --git a/terracumber_config/tf_files/local_mirror.tf b/terracumber_config/tf_files/local_mirror.tf index a4a1b8788..ad7f3df7b 100644 --- a/terracumber_config/tf_files/local_mirror.tf +++ b/terracumber_config/tf_files/local_mirror.tf @@ -92,7 +92,7 @@ terraform { } provider "libvirt" { - uri = "qemu+tcp://suma-05.mgr.suse.de/system" + uri = "qemu+tcp://grog.mgr.prv.suse.net/system" } locals { @@ -105,8 +105,6 @@ module "base" { cc_username = var.SCC_USER cc_password = var.SCC_PASSWORD name_prefix = "mirror-mu-aws-" - mirror = "minima-mirror-ci-bv.mgr.suse.de" - use_mirror_images = true images = [ "opensuse155o"] From 298363b3f289d2b169c16bfb675da6d2a981b65a Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 11:56:56 +1200 Subject: [PATCH 39/59] Change to fail upload image --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 930776ecc..6e1da5ab1 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -130,8 +130,8 @@ def run(params) { build_image = "${url_build_image}${server_raw_image}" } def server_image_name = extractBuildName(build_image) - sh(script: "cd ${resultdir}/images; wget ${build_image}") - sh(script: "ec2uploadimg -a default --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --wait-count 3 --ena-support --verbose --regions '${params.aws_region}' -n '${server_image_name[0]}' -d 'build image' --ssh-key-pair 'testing-suma' --private-key-file '/home/jenkins/.ssh/testing-suma.pem' --security-group-ids '${security_group_id}' --vpc-subnet ${subnet_id} --type 't2.2xlarge' --user 'ec2-user' -e '${image_help_ami}' '${resultdir}/images/${server_image_name[1]}'") + sh "cd ${resultdir}/images; wget ${build_image}" + sh "ec2uploadimg -a default --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --wait-count 3 --ena-support --verbose --regions '${params.aws_region}' -n '${server_image_name[0]}' -d 'build image' --ssh-key-pair 'testing-suma' --private-key-file '/home/jenkins/.ssh/testing-suma.pem' --security-group-ids '${security_group_id}' --vpc-subnet ${subnet_id} --type 't2.2xlarge' --user 'ec2-user' -e '${image_help_ami}' '${resultdir}/images/${server_image_name[1]}'" server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", returnStdout: true).trim() sh script:"echo SERVER_AMI = \\\"${server_ami}\\\" >> ${aws_mirror_dir}/terraform.tfvars" From 567d5c29056e1cdaf23d2af77f9ccb267a7cf5ba Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 12:09:47 +1200 Subject: [PATCH 40/59] Change to fail upload image --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 6e1da5ab1..4a33ee1b2 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -166,7 +166,7 @@ def run(params) { env.aws_configuration = aws_configuration + "]\n" writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: aws_configuration, encoding: "UTF-8" // Deploy empty AWS mirror - sh "export TF_LOG=DEBUG; export TF_LOG_PATH=${aws_mirror_dir}/terraform.log" + + sh "export TF_LOG=INFO; export TF_LOG_PATH=${aws_mirror_dir}/terraform.log" + "; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" } @@ -231,7 +231,7 @@ def run(params) { // Deploying AWS server using MU repositories // sh "echo \"export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --custom-repositories ${WORKSPACE}/custom_repositories.json --sumaform-backend aws\"" retry(count: 1) { - sh "export TF_LOG=DEBUG; export TF_LOG_PATH=${aws_mirror_dir}/terraform.log; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" + sh "export TF_LOG=INFO; export TF_LOG_PATH=${aws_mirror_dir}/terraform.log; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" deployed_aws = true } } From f650094c594dbe9034e701c5a44b90b0980cf6a9 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 12:12:56 +1200 Subject: [PATCH 41/59] Comment mirror and upload image --- .../environments/common/pipeline-aws.groovy | 102 +++++++++--------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 4a33ee1b2..f36e27cb0 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -93,61 +93,61 @@ def run(params) { stage("Prepare AWS environment") { parallel( - "upload_latest_image": { - if (params.build_image != null || params.build_last_image) { -// stage('Clean old images') { -// // Get all image ami ids -// image_amis = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].ImageId'", -// returnStdout: true) -// // Get all snapshot ids -// image_snapshots = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].BlockDeviceMappings[0].Ebs.SnapshotId'", -// returnStdout: true) +// "upload_latest_image": { +// if (params.build_image != null || params.build_last_image) { +//// stage('Clean old images') { +//// // Get all image ami ids +//// image_amis = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].ImageId'", +//// returnStdout: true) +//// // Get all snapshot ids +//// image_snapshots = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].BlockDeviceMappings[0].Ebs.SnapshotId'", +//// returnStdout: true) +//// +//// String[] ami_list = image_amis.split("\n") +//// String[] snapshot_list = image_snapshots.split("\n") +//// +//// // Deregister all BYOS images +//// ami_list.each { ami -> +//// if (ami) { +//// sh(script: "${awscli} ec2 deregister-image --image-id ${ami} --region ${params.aws_region}") +//// } +//// } +//// // Delete all BYOS snapshot +//// snapshot_list.each { snapshot -> +//// if (snapshot) { +//// sh(script: "${awscli} ec2 delete-snapshot --snapshot-id ${snapshot} --region ${params.aws_region}") +//// } +//// } +//// } // -// String[] ami_list = image_amis.split("\n") -// String[] snapshot_list = image_snapshots.split("\n") +// stage('Download last ami image') { +// sh "rm -rf ${resultdir}/images" +// sh "mkdir -p ${resultdir}/images" // -// // Deregister all BYOS images -// ami_list.each { ami -> -// if (ami) { -// sh(script: "${awscli} ec2 deregister-image --image-id ${ami} --region ${params.aws_region}") -// } -// } -// // Delete all BYOS snapshot -// snapshot_list.each { snapshot -> -// if (snapshot) { -// sh(script: "${awscli} ec2 delete-snapshot --snapshot-id ${snapshot} --region ${params.aws_region}") -// } +// if (params.build_last_image) { +// sh(script: "curl ${url_build_image} > images.html") +// server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() +// build_image = "${url_build_image}${server_raw_image}" // } +// def server_image_name = extractBuildName(build_image) +// sh "cd ${resultdir}/images; wget ${build_image}" +// sh "ec2uploadimg -a default --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --wait-count 3 --ena-support --verbose --regions '${params.aws_region}' -n '${server_image_name[0]}' -d 'build image' --ssh-key-pair 'testing-suma' --private-key-file '/home/jenkins/.ssh/testing-suma.pem' --security-group-ids '${security_group_id}' --vpc-subnet ${subnet_id} --type 't2.2xlarge' --user 'ec2-user' -e '${image_help_ami}' '${resultdir}/images/${server_image_name[1]}'" +// server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", +// returnStdout: true).trim() +// sh script:"echo SERVER_AMI = \\\"${server_ami}\\\" >> ${aws_mirror_dir}/terraform.tfvars" // } - - stage('Download last ami image') { - sh "rm -rf ${resultdir}/images" - sh "mkdir -p ${resultdir}/images" - - if (params.build_last_image) { - sh(script: "curl ${url_build_image} > images.html") - server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() - build_image = "${url_build_image}${server_raw_image}" - } - def server_image_name = extractBuildName(build_image) - sh "cd ${resultdir}/images; wget ${build_image}" - sh "ec2uploadimg -a default --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --wait-count 3 --ena-support --verbose --regions '${params.aws_region}' -n '${server_image_name[0]}' -d 'build image' --ssh-key-pair 'testing-suma' --private-key-file '/home/jenkins/.ssh/testing-suma.pem' --security-group-ids '${security_group_id}' --vpc-subnet ${subnet_id} --type 't2.2xlarge' --user 'ec2-user' -e '${image_help_ami}' '${resultdir}/images/${server_image_name[1]}'" - server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", - returnStdout: true).trim() - sh script:"echo SERVER_AMI = \\\"${server_ami}\\\" >> ${aws_mirror_dir}/terraform.tfvars" - } - } - }, - "create_local_mirror_with_mu": { - stage("Create local mirror with MU") { - // Copy minimum repo list to mirror - sh "cp ${local_mirror_dir}/salt/mirror/etc/minimum_repositories_testsuite.yaml ${local_mirror_dir}/salt/mirror/etc/minima-customize.yaml" - // Deploy local mirror - sh "set +x; source /home/jenkins/.credentials set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${local_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-local.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend libvirt" - deployed_local = true - - } - }, +// } +// }, +// "create_local_mirror_with_mu": { +// stage("Create local mirror with MU") { +// // Copy minimum repo list to mirror +// sh "cp ${local_mirror_dir}/salt/mirror/etc/minimum_repositories_testsuite.yaml ${local_mirror_dir}/salt/mirror/etc/minima-customize.yaml" +// // Deploy local mirror +// sh "set +x; source /home/jenkins/.credentials set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${local_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-local.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend libvirt" +// deployed_local = true +// +// } +// }, "create_empty_aws_mirror": { stage("Create empty AWS mirror") { // Fix issue where result folder is created at the same time by local mirror and aws mirror From 060fb94e1cf454ac1d7474bc5dbb0a66645b2d48 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 12:23:01 +1200 Subject: [PATCH 42/59] Try a fix --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index f36e27cb0..2a487c86b 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -167,7 +167,7 @@ def run(params) { writeFile file: "${aws_mirror_dir}/terraform.tfvars", text: aws_configuration, encoding: "UTF-8" // Deploy empty AWS mirror sh "export TF_LOG=INFO; export TF_LOG_PATH=${aws_mirror_dir}/terraform.log" + - "; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" + "; export GODEBUG=asyncpreemptoff=1; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${aws_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" } } @@ -231,7 +231,7 @@ def run(params) { // Deploying AWS server using MU repositories // sh "echo \"export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --custom-repositories ${WORKSPACE}/custom_repositories.json --sumaform-backend aws\"" retry(count: 1) { - sh "export TF_LOG=INFO; export TF_LOG_PATH=${aws_mirror_dir}/terraform.log; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" + sh "export TF_LOG=INFO; export TF_LOG_PATH=${aws_mirror_dir}/terraform.log; export GODEBUG=asyncpreemptoff=1; set +x; source /home/jenkins/.credentials set -x; source /home/jenkins/.registration set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TF_VAR_MIRROR=${env.mirror_hostname_aws_private}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; export TF_VAR_SERVER_AMI=${env.server_ami}; export TF_VAR_PROXY_AMI=${env.proxy_ami}; ./terracumber-cli ${common_params} --logfile ${resultdirbuild}/sumaform-aws.log --init --taint '.*(domain|main_disk).*' --runstep provision --sumaform-backend aws" deployed_aws = true } } From 3d6a8eca303a144a6d9d3f5350fb96247a085e78 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 13 May 2024 13:42:52 +1200 Subject: [PATCH 43/59] add ack steps --- .../environments/common/pipeline-aws.groovy | 102 +++++++++--------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 2a487c86b..1ff0f0a77 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -93,61 +93,61 @@ def run(params) { stage("Prepare AWS environment") { parallel( -// "upload_latest_image": { -// if (params.build_image != null || params.build_last_image) { -//// stage('Clean old images') { -//// // Get all image ami ids -//// image_amis = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].ImageId'", -//// returnStdout: true) -//// // Get all snapshot ids -//// image_snapshots = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].BlockDeviceMappings[0].Ebs.SnapshotId'", -//// returnStdout: true) -//// -//// String[] ami_list = image_amis.split("\n") -//// String[] snapshot_list = image_snapshots.split("\n") -//// -//// // Deregister all BYOS images -//// ami_list.each { ami -> -//// if (ami) { -//// sh(script: "${awscli} ec2 deregister-image --image-id ${ami} --region ${params.aws_region}") -//// } -//// } -//// // Delete all BYOS snapshot -//// snapshot_list.each { snapshot -> -//// if (snapshot) { -//// sh(script: "${awscli} ec2 delete-snapshot --snapshot-id ${snapshot} --region ${params.aws_region}") -//// } -//// } -//// } + "upload_latest_image": { + if (params.build_image != null || params.build_last_image) { +// stage('Clean old images') { +// // Get all image ami ids +// image_amis = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].ImageId'", +// returnStdout: true) +// // Get all snapshot ids +// image_snapshots = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=SUSE-Manager-*-BYOS*' --region ${params.aws_region} | jq -r '.Images[].BlockDeviceMappings[0].Ebs.SnapshotId'", +// returnStdout: true) // -// stage('Download last ami image') { -// sh "rm -rf ${resultdir}/images" -// sh "mkdir -p ${resultdir}/images" +// String[] ami_list = image_amis.split("\n") +// String[] snapshot_list = image_snapshots.split("\n") // -// if (params.build_last_image) { -// sh(script: "curl ${url_build_image} > images.html") -// server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() -// build_image = "${url_build_image}${server_raw_image}" +// // Deregister all BYOS images +// ami_list.each { ami -> +// if (ami) { +// sh(script: "${awscli} ec2 deregister-image --image-id ${ami} --region ${params.aws_region}") +// } +// } +// // Delete all BYOS snapshot +// snapshot_list.each { snapshot -> +// if (snapshot) { +// sh(script: "${awscli} ec2 delete-snapshot --snapshot-id ${snapshot} --region ${params.aws_region}") +// } // } -// def server_image_name = extractBuildName(build_image) -// sh "cd ${resultdir}/images; wget ${build_image}" -// sh "ec2uploadimg -a default --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --wait-count 3 --ena-support --verbose --regions '${params.aws_region}' -n '${server_image_name[0]}' -d 'build image' --ssh-key-pair 'testing-suma' --private-key-file '/home/jenkins/.ssh/testing-suma.pem' --security-group-ids '${security_group_id}' --vpc-subnet ${subnet_id} --type 't2.2xlarge' --user 'ec2-user' -e '${image_help_ami}' '${resultdir}/images/${server_image_name[1]}'" -// server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", -// returnStdout: true).trim() -// sh script:"echo SERVER_AMI = \\\"${server_ami}\\\" >> ${aws_mirror_dir}/terraform.tfvars" // } -// } -// }, -// "create_local_mirror_with_mu": { -// stage("Create local mirror with MU") { -// // Copy minimum repo list to mirror -// sh "cp ${local_mirror_dir}/salt/mirror/etc/minimum_repositories_testsuite.yaml ${local_mirror_dir}/salt/mirror/etc/minima-customize.yaml" -// // Deploy local mirror -// sh "set +x; source /home/jenkins/.credentials set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${local_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-local.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend libvirt" -// deployed_local = true -// -// } -// }, + + stage('Download last ami image') { + sh "rm -rf ${resultdir}/images" + sh "mkdir -p ${resultdir}/images" + + if (params.build_last_image) { + sh(script: "curl ${url_build_image} > images.html") + server_raw_image = sh(script: "grep -oP '(?<=href=\"./).*Manager-Server-.*BYOS.x86.*EC2-Build.*raw.xz(?=\")' images.html", returnStdout: true).trim() + build_image = "${url_build_image}${server_raw_image}" + } + def server_image_name = extractBuildName(build_image) + sh "cd ${resultdir}/images; wget ${build_image}" + sh "ec2uploadimg -a default --backing-store ssd --machine 'x86_64' --virt-type hvm --sriov-support --wait-count 3 --ena-support --verbose --regions '${params.aws_region}' -n '${server_image_name[0]}' -d 'build image' --ssh-key-pair 'testing-suma' --private-key-file '/home/jenkins/.ssh/testing-suma.pem' --security-group-ids '${security_group_id}' --vpc-subnet ${subnet_id} --type 't2.2xlarge' --user 'ec2-user' -e '${image_help_ami}' '${resultdir}/images/${server_image_name[1]}'" + server_ami = sh(script: "${awscli} ec2 describe-images --filters 'Name=name,Values=${server_image_name[0]}' --region ${params.aws_region}| jq -r '.Images[0].ImageId'", + returnStdout: true).trim() + sh script:"echo SERVER_AMI = \\\"${server_ami}\\\" >> ${aws_mirror_dir}/terraform.tfvars" + } + } + }, + "create_local_mirror_with_mu": { + stage("Create local mirror with MU") { + // Copy minimum repo list to mirror + sh "cp ${local_mirror_dir}/salt/mirror/etc/minimum_repositories_testsuite.yaml ${local_mirror_dir}/salt/mirror/etc/minima-customize.yaml" + // Deploy local mirror + sh "set +x; source /home/jenkins/.credentials set -x; export TF_VAR_CUCUMBER_GITREPO=${params.cucumber_gitrepo}; export TF_VAR_CUCUMBER_BRANCH=${params.cucumber_ref}; export TERRAFORM=${params.terraform_bin}; export TERRAFORM_PLUGINS=${params.terraform_bin_plugins}; ./terracumber-cli ${local_mirror_params} --logfile ${resultdirbuild}/sumaform-mirror-local.log --init --taint '.*(domain|main_disk|data_disk|database_disk).*' --runstep provision --sumaform-backend libvirt" + deployed_local = true + + } + }, "create_empty_aws_mirror": { stage("Create empty AWS mirror") { // Fix issue where result folder is created at the same time by local mirror and aws mirror From 5c322582772554bada6f175fae8568ae67ca2f31 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 14 May 2024 10:12:20 +1200 Subject: [PATCH 44/59] Fix upload data issue --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 1ff0f0a77..87daf1c09 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -191,7 +191,7 @@ def run(params) { sh "ssh ${ssh_option} ${user}@${mirror_hostname_local} 'scp ${ssh_option} -i /root/testing-suma.pem /root/mirror.tar.gz ec2-user@${mirror_hostname_aws_public}:/home/ec2-user/' " sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo tar -xvf /home/ec2-user/mirror.tar.gz -C /srv/mirror/' " sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/ibs/ /srv/mirror' " - sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/download/ibs/ /srv/mirror' " + sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rsync -a /srv/mirror/download/ibs/ /srv/mirror' || true" sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/ibs' " sh "ssh ${ssh_option} -i ${params.key_file} ec2-user@${mirror_hostname_aws_public} 'sudo rm -rf /srv/mirror/download/ibs' " } From ec2396aa5f32c89774a8ac9acb64eadabb1b669f Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 16 May 2024 08:17:40 +1200 Subject: [PATCH 45/59] disable route3 --- .../tf_files/SUSEManager-5.0-build-image-AWS.tf | 4 ++-- terracumber_config/tf_files/aws_mirror.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index 16287f5e8..d6e9b7c25 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -154,8 +154,8 @@ module "base" { ssh_allowed_ips = var.ALLOWED_IPS key_name = var.KEY_NAME key_file = var.KEY_FILE - route53_domain = local.domain - bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" +# route53_domain = local.domain +# bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" } } diff --git a/terracumber_config/tf_files/aws_mirror.tf b/terracumber_config/tf_files/aws_mirror.tf index 3fc1642fa..812af3074 100644 --- a/terracumber_config/tf_files/aws_mirror.tf +++ b/terracumber_config/tf_files/aws_mirror.tf @@ -140,8 +140,8 @@ module "base" { ssh_allowed_ips = var.ALLOWED_IPS key_name = var.KEY_NAME key_file = var.KEY_FILE - route53_domain = local.domain - bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" +# route53_domain = local.domain +# bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" } } From 4afcaaea8b9a39cc530949e37cbebe010693d07a Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 16 May 2024 09:22:14 +1200 Subject: [PATCH 46/59] Switch jenkins worker --- .../environments/manager-5.0-dev-acceptance-tests-AWS | 2 +- terracumber_config/tf_files/local_mirror.tf | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS index 10b1d7457..1e0b6a414 100644 --- a/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS +++ b/jenkins_pipelines/environments/manager-5.0-dev-acceptance-tests-AWS @@ -1,6 +1,6 @@ #!/usr/bin/env groovy -node('sumaform-cucumber-provo') { +node('sumaform-cucumber') { properties([ buildDiscarder(logRotator(numToKeepStr: '10', artifactNumToKeepStr: '3')), disableConcurrentBuilds(), diff --git a/terracumber_config/tf_files/local_mirror.tf b/terracumber_config/tf_files/local_mirror.tf index ad7f3df7b..175caa0aa 100644 --- a/terracumber_config/tf_files/local_mirror.tf +++ b/terracumber_config/tf_files/local_mirror.tf @@ -92,7 +92,7 @@ terraform { } provider "libvirt" { - uri = "qemu+tcp://grog.mgr.prv.suse.net/system" + uri = "qemu+tcp://suma-05.mgr.suse.de/system" } locals { @@ -107,7 +107,8 @@ module "base" { name_prefix = "mirror-mu-aws-" images = [ "opensuse155o"] - + mirror = "minima-mirror-ci-bv.mgr.suse.de" + use_mirror_images = true provider_settings = { pool = local.pool network_name = null From 197d41059f25d4a9d59c23b0a7098ecddddcf64e Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Thu, 16 May 2024 11:18:59 +1200 Subject: [PATCH 47/59] fix image ami --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index 87daf1c09..cd434cd34 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -28,7 +28,7 @@ def run(params) { // Upload image variables security_group_id = 'sg-0778949b97990ce04' subnet_id = 'subnet-05b9d049f3af01c38' - image_help_ami = 'ami-0ad2088f58aad429e' + image_help_ami = 'ami-0fd8993005af51cc4' From bb72d9f51b8640dcb19d1d27d53adbc350eb5a84 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 21 May 2024 11:59:05 +1200 Subject: [PATCH 48/59] dont install bundle --- terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf | 1 + 1 file changed, 1 insertion(+) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index d6e9b7c25..86f0739b0 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -206,6 +206,7 @@ module "server" { provider_settings = { instance_type = "m6a.xlarge" } + install_salt_bundle = true //server_additional_repos } From dc5a9697efbfa3aa409953f3e0bdd78562a837ce Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 21 May 2024 12:09:33 +1200 Subject: [PATCH 49/59] Change production version --- terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index 86f0739b0..a7e171a14 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -177,7 +177,7 @@ module "server" { mirror = null }) name = "server" - product_version = "head" + product_version = "head-build_image" repository_disk_size = 1500 image = var.SERVER_AMI # server_registration_code = var.SERVER_REGISTRATION_CODE From ffe85b2212d2d7c22614ac12fe2e16bd375a4518 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 21 May 2024 12:49:30 +1200 Subject: [PATCH 50/59] Disable venv salt bundle --- terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index a7e171a14..ca7802ade 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -206,7 +206,7 @@ module "server" { provider_settings = { instance_type = "m6a.xlarge" } - install_salt_bundle = true + install_salt_bundle = false //server_additional_repos } From 6b9f04eafc5f7870a2bff342468e198693b4c3a0 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 21 May 2024 14:31:17 +1200 Subject: [PATCH 51/59] Add back route53 and clients --- .../SUSEManager-5.0-build-image-AWS.tf | 340 +++++++++--------- terracumber_config/tf_files/aws_mirror.tf | 4 +- 2 files changed, 172 insertions(+), 172 deletions(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index ca7802ade..f7c85523a 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -154,8 +154,8 @@ module "base" { ssh_allowed_ips = var.ALLOWED_IPS key_name = var.KEY_NAME key_file = var.KEY_FILE -# route53_domain = local.domain -# bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" + route53_domain = local.domain + bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" } } @@ -211,171 +211,171 @@ module "server" { } -# module "proxy" { -# -# source = "./modules/proxy" -# base_configuration = module.base.configuration -# server_configuration = module.server.configuration -# product_version = "head" -# name = "proxy" -# proxy_registration_code = var.PROXY_REGISTRATION_CODE -# -# auto_register = false -# auto_connect_to_master = false -# download_private_ssl_key = false -# install_proxy_pattern = false -# auto_configure = false -# generate_bootstrap_script = false -# publish_private_ssl_key = false -# use_os_released_updates = false -# proxy_containerized = false -# ssh_key_path = "./salt/controller/id_rsa.pub" -# additional_packages = [ "venv-salt-minion" ] -# install_salt_bundle = true -# //proxy_additional_repos -# -# } -# -# module "suse-client" { -# -# source = "./modules/client" -# base_configuration = module.base.configuration -# name = "cli-sles15" -# image = "sles15sp4o" -# product_version = "4.3-released" -# server_configuration = module.server.configuration -# sles_registration_code = var.SLES_REGISTRATION_CODE -# auto_register = false -# use_os_released_updates = false -# ssh_key_path = "./salt/controller/id_rsa.pub" -# additional_packages = [ "venv-salt-minion" ] -# install_salt_bundle = true -# provider_settings = { -# instance_type = "t3a.medium" -# } -# //sle15sp4-client_additional_repos -# } -# -# module "suse-minion" { -# source = "./modules/minion" -# base_configuration = module.base.configuration -# product_version = "4.3-released" -# name = "min-sles15" -# image = "sles15sp4o" -# server_configuration = module.server.configuration -# sles_registration_code = var.SLES_REGISTRATION_CODE -# auto_connect_to_master = false -# use_os_released_updates = true -# ssh_key_path = "./salt/controller/id_rsa.pub" -# additional_packages = [ "venv-salt-minion" ] -# install_salt_bundle = true -# provider_settings = { -# instance_type = "t3a.medium" -# } -# //sle15sp4-minion_additional_repos -# -# } -# -# module "suse-sshminion" { -# source = "./modules/sshminion" -# base_configuration = module.base.configuration -# product_version = "4.3-released" -# name = "minssh-sles15" -# image = "sles15sp4o" -# sles_registration_code = var.SLES_REGISTRATION_CODE -# use_os_released_updates = true -# ssh_key_path = "./salt/controller/id_rsa.pub" -# gpg_keys = ["default/gpg_keys/galaxy.key"] -# additional_packages = [ "venv-salt-minion" , "iptables"] -# install_salt_bundle = true -# provider_settings = { -# instance_type = "t3a.medium" -# } -# -# } -# -# module "redhat-minion" { -# image = "rocky8" -# name = "min-rocky8" -# provider_settings = { -# // Since start of May we have problems with the instance not booting after a restart if there is only a CPU and only 1024Mb for RAM -# // Also, openscap cannot run with less than 1.25 GB of RAM -# memory = 2048 -# vcpu = 2 -# instance_type = "t3a.medium" -# } -# source = "./modules/minion" -# base_configuration = module.base.configuration -# product_version = "4.3-released" -# server_configuration = module.server.configuration -# auto_connect_to_master = false -# ssh_key_path = "./salt/controller/id_rsa.pub" -# additional_packages = [ "venv-salt-minion" ] -# install_salt_bundle = true -# } -# -# module "debian-minion" { -# name = "min-ubuntu2204" -# image = "ubuntu2204" -# source = "./modules/minion" -# base_configuration = module.base.configuration -# product_version = "4.3-released" -# server_configuration = module.server.configuration -# auto_connect_to_master = false -# ssh_key_path = "./salt/controller/id_rsa.pub" -# additional_packages = [ "venv-salt-minion" ] -# install_salt_bundle = true -# provider_settings = { -# instance_type = "t3a.medium" -# } -# } -# -# module "controller" { -# source = "./modules/controller" -# base_configuration = module.base.configuration -# name = "ctl" -# provider_settings = { -# memory = 16384 -# vcpu = 8 -# } -# swap_file_size = null -# no_mirror = true -# is_using_build_image = true -# is_using_scc_repositories = true -# // Cucumber repository configuration for the controller -# git_username = var.GIT_USER -# git_password = var.GIT_PASSWORD -# git_repo = var.CUCUMBER_GITREPO -# branch = var.CUCUMBER_BRANCH -# -# server_configuration = module.server.configuration -# proxy_configuration = module.proxy.configuration -# client_configuration = module.suse-client.configuration -# minion_configuration = module.suse-minion.configuration -# // buildhost_configuration = module.build-host.configuration -# sshminion_configuration = module.suse-sshminion.configuration -# redhat_configuration = module.redhat-minion.configuration -# debian_configuration = module.debian-minion.configuration -# -# } -# -# output "bastion_public_name" { -# value = lookup(module.base.configuration, "bastion_host", null) -# } -# -# output "aws_mirrors_private_name" { -# value = module.mirror.configuration.hostnames -# } -# -# output "aws_mirrors_public_name" { -# value = module.mirror.configuration.public_names -# } -# -# output "configuration" { -# value = { -# controller = module.controller.configuration -# bastion = { -# hostname = lookup(module.base.configuration, "bastion_host", null) -# } -# } -# } +module "proxy" { + + source = "./modules/proxy" + base_configuration = module.base.configuration + server_configuration = module.server.configuration + product_version = "head" + name = "proxy" + proxy_registration_code = var.PROXY_REGISTRATION_CODE + + auto_register = false + auto_connect_to_master = false + download_private_ssl_key = false + install_proxy_pattern = false + auto_configure = false + generate_bootstrap_script = false + publish_private_ssl_key = false + use_os_released_updates = false + proxy_containerized = false + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true + //proxy_additional_repos + +} + +module "suse-client" { + + source = "./modules/client" + base_configuration = module.base.configuration + name = "cli-sles15" + image = "sles15sp4o" + product_version = "4.3-released" + server_configuration = module.server.configuration + sles_registration_code = var.SLES_REGISTRATION_CODE + auto_register = false + use_os_released_updates = false + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true + provider_settings = { + instance_type = "t3a.medium" + } + //sle15sp4-client_additional_repos +} + +module "suse-minion" { + source = "./modules/minion" + base_configuration = module.base.configuration + product_version = "4.3-released" + name = "min-sles15" + image = "sles15sp4o" + server_configuration = module.server.configuration + sles_registration_code = var.SLES_REGISTRATION_CODE + auto_connect_to_master = false + use_os_released_updates = true + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true + provider_settings = { + instance_type = "t3a.medium" + } + //sle15sp4-minion_additional_repos + +} + +module "suse-sshminion" { + source = "./modules/sshminion" + base_configuration = module.base.configuration + product_version = "4.3-released" + name = "minssh-sles15" + image = "sles15sp4o" + sles_registration_code = var.SLES_REGISTRATION_CODE + use_os_released_updates = true + ssh_key_path = "./salt/controller/id_rsa.pub" + gpg_keys = ["default/gpg_keys/galaxy.key"] + additional_packages = [ "venv-salt-minion" , "iptables"] + install_salt_bundle = true + provider_settings = { + instance_type = "t3a.medium" + } + +} + +module "redhat-minion" { + image = "rocky8" + name = "min-rocky8" + provider_settings = { + // Since start of May we have problems with the instance not booting after a restart if there is only a CPU and only 1024Mb for RAM + // Also, openscap cannot run with less than 1.25 GB of RAM + memory = 2048 + vcpu = 2 + instance_type = "t3a.medium" + } + source = "./modules/minion" + base_configuration = module.base.configuration + product_version = "4.3-released" + server_configuration = module.server.configuration + auto_connect_to_master = false + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true +} + +module "debian-minion" { + name = "min-ubuntu2204" + image = "ubuntu2204" + source = "./modules/minion" + base_configuration = module.base.configuration + product_version = "4.3-released" + server_configuration = module.server.configuration + auto_connect_to_master = false + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true + provider_settings = { + instance_type = "t3a.medium" + } +} + +module "controller" { + source = "./modules/controller" + base_configuration = module.base.configuration + name = "ctl" + provider_settings = { + memory = 16384 + vcpu = 8 + } + swap_file_size = null + no_mirror = true + is_using_build_image = true + is_using_scc_repositories = true + // Cucumber repository configuration for the controller + git_username = var.GIT_USER + git_password = var.GIT_PASSWORD + git_repo = var.CUCUMBER_GITREPO + branch = var.CUCUMBER_BRANCH + + server_configuration = module.server.configuration + proxy_configuration = module.proxy.configuration + client_configuration = module.suse-client.configuration + minion_configuration = module.suse-minion.configuration +// buildhost_configuration = module.build-host.configuration + sshminion_configuration = module.suse-sshminion.configuration + redhat_configuration = module.redhat-minion.configuration + debian_configuration = module.debian-minion.configuration + +} + +output "bastion_public_name" { + value = lookup(module.base.configuration, "bastion_host", null) +} + +output "aws_mirrors_private_name" { + value = module.mirror.configuration.hostnames +} + +output "aws_mirrors_public_name" { + value = module.mirror.configuration.public_names +} + +output "configuration" { + value = { + controller = module.controller.configuration + bastion = { + hostname = lookup(module.base.configuration, "bastion_host", null) + } + } +} diff --git a/terracumber_config/tf_files/aws_mirror.tf b/terracumber_config/tf_files/aws_mirror.tf index 812af3074..3fc1642fa 100644 --- a/terracumber_config/tf_files/aws_mirror.tf +++ b/terracumber_config/tf_files/aws_mirror.tf @@ -140,8 +140,8 @@ module "base" { ssh_allowed_ips = var.ALLOWED_IPS key_name = var.KEY_NAME key_file = var.KEY_FILE -# route53_domain = local.domain -# bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" + route53_domain = local.domain + bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" } } From 85d729d44ee08a631937684244a92799552c7c54 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 29 May 2024 14:23:09 +1200 Subject: [PATCH 52/59] udpate deployment description --- .../SUSEManager-5.0-build-image-AWS.tf | 35 ++++++++----------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index f7c85523a..ddfb6b679 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -236,6 +236,21 @@ module "proxy" { } +# module "proxy_containerized" { +# source = "./modules/proxy_containerized" +# base_configuration = module.base_core.configuration +# product_version = "head" +# name = "pxy" +# +# server_configuration = module.server.configuration +# runtime = "podman" +# # container_repository = "registry.suse.de/suse/sle-15-sp6/update/products/manager50/containerfile/suse/manager/5.0/x86_64" +# // Most recent code. Enable again once Beta 2 will be approved: +# // container_repository = "registry.suse.de/devel/galaxy/manager/head/containerfile/suse/manager/5.0/x86_64" +# auto_configure = false +# ssh_key_path = "./salt/controller/id_rsa.pub" +# } + module "suse-client" { source = "./modules/client" @@ -294,26 +309,6 @@ module "suse-sshminion" { } -module "redhat-minion" { - image = "rocky8" - name = "min-rocky8" - provider_settings = { - // Since start of May we have problems with the instance not booting after a restart if there is only a CPU and only 1024Mb for RAM - // Also, openscap cannot run with less than 1.25 GB of RAM - memory = 2048 - vcpu = 2 - instance_type = "t3a.medium" - } - source = "./modules/minion" - base_configuration = module.base.configuration - product_version = "4.3-released" - server_configuration = module.server.configuration - auto_connect_to_master = false - ssh_key_path = "./salt/controller/id_rsa.pub" - additional_packages = [ "venv-salt-minion" ] - install_salt_bundle = true -} - module "debian-minion" { name = "min-ubuntu2204" image = "ubuntu2204" From 2b7127e4aa2e3be1653020c718ce1e0345ba494d Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 29 May 2024 14:29:06 +1200 Subject: [PATCH 53/59] comment redhat in controller --- terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index ddfb6b679..c1e6c6049 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -349,7 +349,7 @@ module "controller" { minion_configuration = module.suse-minion.configuration // buildhost_configuration = module.build-host.configuration sshminion_configuration = module.suse-sshminion.configuration - redhat_configuration = module.redhat-minion.configuration +# redhat_configuration = module.redhat-minion.configuration debian_configuration = module.debian-minion.configuration } From a07832235c761ccb97b9e09823634d6abe4177bc Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 29 May 2024 14:52:15 +1200 Subject: [PATCH 54/59] Change proxy product version --- terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index c1e6c6049..defaefe7e 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -216,7 +216,7 @@ module "proxy" { source = "./modules/proxy" base_configuration = module.base.configuration server_configuration = module.server.configuration - product_version = "head" + product_version = "4.3" name = "proxy" proxy_registration_code = var.PROXY_REGISTRATION_CODE From bc79a78c5a0285963aa1fed5cc9456bd417ffba2 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Wed, 29 May 2024 15:10:21 +1200 Subject: [PATCH 55/59] Fix proxy version --- terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index defaefe7e..a79717771 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -216,7 +216,7 @@ module "proxy" { source = "./modules/proxy" base_configuration = module.base.configuration server_configuration = module.server.configuration - product_version = "4.3" + product_version = "4.3-released" name = "proxy" proxy_registration_code = var.PROXY_REGISTRATION_CODE From 2d342c77732e88c04dad273af8706c5f15275852 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 10 Jun 2024 14:30:40 +1200 Subject: [PATCH 56/59] Add rocky8 --- .../tf_files/SUSEManager-5.0-build-image-AWS.tf | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index a79717771..8339a803e 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -325,6 +325,23 @@ module "debian-minion" { } } +module "rocky8-minion" { + source = "./modules/minion" + base_configuration = module.base.configuration + product_version = "4.3-released" + name = "min-rocky8" + image = "rocky8" + server_configuration = module.server.configuration + auto_connect_to_master = false + use_os_released_updates = false + ssh_key_path = "./salt/controller/id_rsa.pub" + additional_packages = [ "venv-salt-minion" ] + install_salt_bundle = true + provider_settings = { + instance_type = "t3a.medium" + } +} + module "controller" { source = "./modules/controller" base_configuration = module.base.configuration From db871d99c7fe8fb07ec7f9785a9921e0b99b545d Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Mon, 10 Jun 2024 14:58:03 +1200 Subject: [PATCH 57/59] Update local mirror mac address --- terracumber_config/tf_files/local_mirror.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terracumber_config/tf_files/local_mirror.tf b/terracumber_config/tf_files/local_mirror.tf index 175caa0aa..07a250d23 100644 --- a/terracumber_config/tf_files/local_mirror.tf +++ b/terracumber_config/tf_files/local_mirror.tf @@ -131,7 +131,7 @@ module "mirror" { // volume_snapshot_id = data.aws_ebs_snapshot.data_disk_snapshot.id } provider_settings = { - mac = "52:54:00:ba:b7:98" + mac = "52:54:00:ba:b7:99" memory = 4096 } } From ec71fa1d92633ec1b859831b9476481550d65b43 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Fri, 5 Jul 2024 11:15:22 +1200 Subject: [PATCH 58/59] Remove dns --- .../tf_files/SUSEManager-5.0-build-image-AWS.tf | 6 +++--- terracumber_config/tf_files/aws_mirror.tf | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index 8339a803e..f6654a955 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -146,7 +146,7 @@ module "base" { name_prefix = var.NAME_PREFIX mirror = var.MIRROR testsuite = true - images = [ "opensuse155o"] +# images = [ "opensuse155o"] # images = ["rocky8", "opensuse155o", "sles15sp5o", "sles15sp4o", "ubuntu2204"] provider_settings = { availability_zone = var.AVAILABILITY_ZONE @@ -154,8 +154,8 @@ module "base" { ssh_allowed_ips = var.ALLOWED_IPS key_name = var.KEY_NAME key_file = var.KEY_FILE - route53_domain = local.domain - bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" +# route53_domain = local.domain +# bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" } } diff --git a/terracumber_config/tf_files/aws_mirror.tf b/terracumber_config/tf_files/aws_mirror.tf index 3fc1642fa..d34f21cb6 100644 --- a/terracumber_config/tf_files/aws_mirror.tf +++ b/terracumber_config/tf_files/aws_mirror.tf @@ -133,15 +133,15 @@ module "base" { testsuite = true use_avahi = false use_eip_bastion = false - images = [ "opensuse155o"] +# images = [ "opensuse155o"] provider_settings = { availability_zone = var.AVAILABILITY_ZONE region = var.REGION ssh_allowed_ips = var.ALLOWED_IPS key_name = var.KEY_NAME key_file = var.KEY_FILE - route53_domain = local.domain - bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" +# route53_domain = local.domain +# bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" } } From f5d0a2354dfb379124746fc9e39128470942b7b2 Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Fri, 5 Jul 2024 13:04:46 +1200 Subject: [PATCH 59/59] Comment mail. Configure new parameters --- jenkins_pipelines/environments/common/pipeline-aws.groovy | 2 +- .../tf_files/SUSEManager-5.0-build-image-AWS.tf | 7 +++++-- terracumber_config/tf_files/aws_mirror.tf | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/jenkins_pipelines/environments/common/pipeline-aws.groovy b/jenkins_pipelines/environments/common/pipeline-aws.groovy index cd434cd34..bf1c1ae1f 100644 --- a/jenkins_pipelines/environments/common/pipeline-aws.groovy +++ b/jenkins_pipelines/environments/common/pipeline-aws.groovy @@ -296,7 +296,7 @@ def run(params) { // junit allowEmptyResults: true, testResults: "${junit_resultdir}/*.xml" } // Send email - sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/mail.log --runstep mail" +// sh "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/mail.log --runstep mail" // Clean up old results sh "./clean-old-results -r ${resultdir}" sh "exit ${error}" diff --git a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf index f6654a955..8f162042c 100644 --- a/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf +++ b/terracumber_config/tf_files/SUSEManager-5.0-build-image-AWS.tf @@ -146,6 +146,9 @@ module "base" { name_prefix = var.NAME_PREFIX mirror = var.MIRROR testsuite = true + use_avahi = false + use_eip_bastion = false + is_server_paygo_instance = false # images = [ "opensuse155o"] # images = ["rocky8", "opensuse155o", "sles15sp5o", "sles15sp4o", "ubuntu2204"] provider_settings = { @@ -154,8 +157,8 @@ module "base" { ssh_allowed_ips = var.ALLOWED_IPS key_name = var.KEY_NAME key_file = var.KEY_FILE -# route53_domain = local.domain -# bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" + route53_domain = local.domain + bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" } } diff --git a/terracumber_config/tf_files/aws_mirror.tf b/terracumber_config/tf_files/aws_mirror.tf index d34f21cb6..385f9bba2 100644 --- a/terracumber_config/tf_files/aws_mirror.tf +++ b/terracumber_config/tf_files/aws_mirror.tf @@ -140,8 +140,8 @@ module "base" { ssh_allowed_ips = var.ALLOWED_IPS key_name = var.KEY_NAME key_file = var.KEY_FILE -# route53_domain = local.domain -# bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" + route53_domain = local.domain + bastion_host = "${var.NAME_PREFIX}-bastion.${local.domain}" } }