Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def run(params) {
// Declare lock resource use during node bootstrap
mgrCreateBootstrapRepo = 'share resource to avoid running mgr create bootstrap repo in parallel'
retailProxyConfigurationLock = 'lock proxy retail setup'
def muLockSlots = [].asSynchronized()
// Variables to store none critical stage run status
def monitoring_stage_result_fail = false
def client_stage_result_fail = false
Expand Down Expand Up @@ -587,13 +588,15 @@ def clientTestingStages(params) {
if (params.confirm_before_continue) {
input 'Press any key to start adding Maintenance Update repositories'
}
echo 'Add custom channels and MU repositories'
res_mu_repos = runCucumberRakeTarget("cucumber:build_validation_add_maintenance_update_repositories_${nodeTag}", true, temporaryList)
echoHtmlReportPath("build_validation_add_maintenance_update_repositories_${nodeTag}")
echo "Custom channels and MU repositories status code: ${res_mu_repos}"
if (res_mu_repos != 0) {
required_custom_channel_status[node] = 'FAIL'
error("Add custom channels and MU repositories failed with status code: ${res_mu_repos}")
withThrottle(muLockSlots, 5) {
echo 'Add custom channels and MU repositories'
res_mu_repos = runCucumberRakeTarget("cucumber:build_validation_add_maintenance_update_repositories_${nodeTag}", true, temporaryList)
echoHtmlReportPath("build_validation_add_maintenance_update_repositories_${nodeTag}")
echo "Custom channels and MU repositories status code: ${res_mu_repos}"
if (res_mu_repos != 0) {
required_custom_channel_status[node] = 'FAIL'
error("Add custom channels and MU repositories failed with status code: ${res_mu_repos}")
}
}
}
}
Expand All @@ -611,13 +614,15 @@ def clientTestingStages(params) {
if (params.confirm_before_continue) {
input 'Press any key to start adding common channels'
}
echo 'Add non MU Repositories'
res_non_MU_repositories = runCucumberRakeTarget("cucumber:${build_validation_non_MU_script}", true, temporaryList)
echo "Non MU Repositories status code: ${res_non_MU_repositories}"
echoHtmlReportPath(build_validation_non_MU_script)
if (res_non_MU_repositories != 0) {
required_custom_channel_status[node] = 'FAIL'
error("Add common channels failed with status code: ${res_non_MU_repositories}")
withThrottle(muLockSlots, 5) {
echo 'Add non MU Repositories'
res_non_MU_repositories = runCucumberRakeTarget("cucumber:${build_validation_non_MU_script}", true, temporaryList)
echo "Non MU Repositories status code: ${res_non_MU_repositories}"
echoHtmlReportPath(build_validation_non_MU_script)
if (res_non_MU_repositories != 0) {
required_custom_channel_status[node] = 'FAIL'
error("Add common channels failed with status code: ${res_non_MU_repositories}")
}
}
}
}
Expand Down Expand Up @@ -922,4 +927,29 @@ def echoHtmlReportPath(String rake_target) {
}
}

@NonCPS
def tryAcquireSlot(slots, int max) {
int current = slots.get()
if (current < max) {
return slots.compareAndSet(current, current + 1)
}
return false
}

@NonCPS
def releaseSlot(slots) {
slots.decrementAndGet()
}

def withThrottle = { slots, int max = 5, Closure body ->
waitUntil {
tryAcquireSlot(slots, max)
}
try {
body()
} finally {
releaseSlot(slots)
}
}

return this