Skip to content

Commit

Permalink
[CI] kind setup fails sometimes (elastic#21857)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v committed Oct 16, 2020
1 parent f531968 commit 2e5bdac
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -163,16 +163,28 @@ def cloud(Map args = [:]) {

def k8sTest(Map args = [:]) {
def versions = args.versions
node(args.label) {
versions.each{ v ->
versions.each{ v ->
node(args.label) {
stage("${args.context} ${v}"){
withEnv(["K8S_VERSION=${v}", "KIND_VERSION=v0.7.0", "KUBECONFIG=${env.WORKSPACE}/kubecfg"]){
withGithubNotify(context: "${args.context} ${v}") {
withBeatsEnv(archive: false, withModule: false) {
retryWithSleep(retries: 2, seconds: 5, backoff: true){ sh(label: "Install kind", script: ".ci/scripts/install-kind.sh") }
retryWithSleep(retries: 2, seconds: 5, backoff: true){ sh(label: "Install kubectl", script: ".ci/scripts/install-kubectl.sh") }
try {
sh(label: "Setup kind", script: ".ci/scripts/kind-setup.sh")
// Add some environmental resilience when setup does not work the very first time.
def i = 0
retryWithSleep(retries: 3, seconds: 5, backoff: true){
try {
sh(label: "Setup kind", script: ".ci/scripts/kind-setup.sh")
} catch(err) {
i++
sh(label: 'Delete cluster', script: 'kind delete cluster')
if (i > 2) {
error("Setup kind failed with error '${err.toString()}'")
}
}
}
sh(label: "Integration tests", script: "MODULE=kubernetes make -C metricbeat integration-tests")
sh(label: "Deploy to kubernetes",script: "make -C deploy/kubernetes test")
} finally {
Expand Down

0 comments on commit 2e5bdac

Please sign in to comment.