Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Paygo aws pipeline #1021

Merged
merged 10 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def run(params) {
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" +
"NAME_PREFIX = \"${NAME_PREFIX}-\"\n" +
"KEY_FILE = \"${params.key_file}\"\n" +
"KEY_NAME = \"${params.key_name}\"\n" +
"ALLOWED_IPS = [ \n"
Expand Down Expand Up @@ -181,15 +181,14 @@ 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' "
}

}
}
}
else {
} else {
stage("Get mirror private IP") {
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()
Expand Down Expand Up @@ -288,6 +287,29 @@ def run(params) {

/** Proxy stages end **/

/** PAYGO stages begin **/
if (params.paygo_stages) {
// Call the minion testing.
try {
stage('Clients paygo stages') {
clientTestingStages(capybara_timeout, default_timeout, 'paygo')
}

} catch (Exception ex) {
println('ERROR: one or more clients have failed')
maximenoel8 marked this conversation as resolved.
Show resolved Hide resolved
client_paygo_stage_result_fail = true
}
stage('Paygo testing') {
if (params.confirm_before_continue) {
input 'Press any key to start paygo related tests'
}
res_paygo_testing = sh(script: "./terracumber-cli ${common_params} --logfile ${resultdirbuild}/testsuite.log --runstep cucumber --cucumber-cmd '${env.exports} cd /root/spacewalk/testsuite; rake cucumber:build_validation_paygo_testing'")
echo "PAYGO testing status code: ${res_paygo_testing}"
}
}

/** PAYGO stages end **/

/** Monitoring stages begin **/
// Hide monitoring for qe update pipeline
if (params.enable_monitoring_stages) {
Expand Down Expand Up @@ -434,6 +456,10 @@ 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 paygo client stages failed
if (client_paygo_stage_result_fail) {
error("Paygo client stage failed")
}
// Fail pipeline if client stages failed
if (client_stage_result_fail) {
error("Client stage failed")
Expand All @@ -458,16 +484,15 @@ def run(params) {

// Develop a function that outlines the various stages of a minion.
// These stages will be executed concurrently.
def clientTestingStages(capybara_timeout, default_timeout) {
def clientTestingStages(capybara_timeout, default_timeout, minion_type = 'default') {

// Implement a hash map to store the various stages of nodes.
def tests = [:]

// Load JSON matching non MU repositories data
def json_matching_non_MU_data = readJSON(file: env.non_MU_channels_tasks_file)

//Get minion list from terraform state list command
def nodesHandler = getNodesHandler()
def nodesHandler = getNodesHandler(minion_type)
def mu_sync_status = nodesHandler.MUSyncStatus

// Construct a stage list for each node.
Expand Down Expand Up @@ -597,7 +622,7 @@ def clientTestingStages(capybara_timeout, default_timeout) {
parallel tests
}

def getNodesHandler() {
def getNodesHandler(minionType = 'default') {
// Employ the terraform state list command to generate the list of nodes.
// Due to the disparity between the node names in the test suite and those in the environment variables of the controller, two separate lists are maintained.
Set<String> nodeList = new HashSet<String>()
Expand All @@ -608,7 +633,11 @@ def getNodesHandler() {
String[] moduleList = modules.split("\n")
moduleList.each { lane ->
def instanceList = lane.tokenize(".")
if (instanceList[1].contains('minion') || instanceList[1].contains('client')) {
maximenoel8 marked this conversation as resolved.
Show resolved Hide resolved
if ( minionType == 'default' && (instanceList[1].contains('minion') || instanceList[1].contains('client'))) {
nodeList.add(instanceList[1].replaceAll('-', '_').replaceAll('sshminion', 'ssh_minion').replaceAll('sles', 'sle'))
envVar.add(instanceList[1].replaceAll('-', '_').replaceAll('sles', 'sle').toUpperCase())
}
else if (( minionType == 'paygo' && (instanceList[1].contains('paygo') || instanceList[1].contains('byos')))) {
nodeList.add(instanceList[1].replaceAll('-', '_').replaceAll('sshminion', 'ssh_minion').replaceAll('sles', 'sle'))
envVar.add(instanceList[1].replaceAll('-', '_').replaceAll('sles', 'sle').toUpperCase())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

node('sumaform-cucumber-provo') {
def minionList = 'sle12sp4_client, sle12sp4_minion, sle12sp4_ssh_minion, ' +
'sle12sp5_client, sle12sp5_minion, sle12sp5_ssh_minion, ' +
'sle12sp5_client, sle12sp5_minion, sle12sp5_ssh_minion, sle12sp5_paygo_minion, ' +
'sle15sp1_client, sle15sp1_minion, sle15sp1_ssh_minion, ' +
'sle15sp2_client, sle15sp2_minion, sle15sp2_ssh_minion, ' +
'sle15sp3_client, sle15sp3_minion, sle15sp3_ssh_minion, ' +
'sle15sp4_client, sle15sp4_minion, sle15sp4_ssh_minion, ' +
'sle15sp4_client, sle15sp4_minion, sle15sp4_ssh_minion, sle15sp4_byos_minion, ' +
'sle15sp5_client, sle15sp5_minion, sle15sp5_ssh_minion, sle15sp5_paygo_minion, ' +
'alma9_minion, alma9_ssh_minion, ' +
'centos7_client, centos7_minion, centos7_ssh_minion, ' +
'liberty9_minion, liberty9_ssh_minion, ' +
Expand Down
Loading