Skip to content

Commit

Permalink
[CI] Add resilience when peak loads (elastic#22674) (elastic#22710)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Nov 23, 2020
1 parent 71abed3 commit 5744c87
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def generateStages(Map args = [:]) {
}

def cloud(Map args = [:]) {
node(args.label) {
withNode(args.label) {
startCloudTestEnv(name: args.directory, dirs: args.dirs)
}
withCloudTestEnv() {
Expand All @@ -227,7 +227,7 @@ def cloud(Map args = [:]) {
def k8sTest(Map args = [:]) {
def versions = args.versions
versions.each{ v ->
node(args.label) {
withNode(args.label) {
stage("${args.context} ${v}"){
withEnv(["K8S_VERSION=${v}", "KIND_VERSION=v0.7.0", "KUBECONFIG=${env.WORKSPACE}/kubecfg"]){
withGithubNotify(context: "${args.context} ${v}") {
Expand Down Expand Up @@ -272,7 +272,7 @@ def target(Map args = [:]) {
def directory = args.get('directory', '')
def withModule = args.get('withModule', false)
def isMage = args.get('isMage', false)
node(args.label) {
withNode(args.label) {
withGithubNotify(context: "${context}") {
withBeatsEnv(archive: true, withModule: withModule, directory: directory, id: args.id) {
dumpVariables()
Expand All @@ -286,6 +286,16 @@ def target(Map args = [:]) {
}
}

/**
* This method wraps the node call with some latency to avoid the known issue with the scalabitity in gobld.
*/
def withNode(String label, Closure body) {
sleep randomNumber(min: 10, max: 200)
node(label) {
body()
}
}

/**
* This method wraps all the environment setup and pre-requirements to run any commands.
*/
Expand Down

0 comments on commit 5744c87

Please sign in to comment.