Skip to content

Commit

Permalink
ci: simplify kind/kubectl environment (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored Feb 8, 2022
1 parent c3f8c8d commit 109c689
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 140 deletions.
33 changes: 3 additions & 30 deletions .ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env groovy

@Library('apm@feature/use-internal-ci') _
@Library('apm@current') _

pipeline {
agent { label 'ubuntu-20.04 && immutable' }
Expand Down Expand Up @@ -100,13 +100,9 @@ pipeline {
steps {
withGithubNotify(context: "K8s-${PLATFORM}") {
withMageEnv(){
withEnv(["K8S_VERSION=v1.23.0", "KIND_VERSION=v0.11.1", "KUBECONFIG=${env.WORKSPACE}/kubecfg"]){
withKindEnv(k8sVersion: 'v1.23.0', kindVersion: 'v0.11.1') {
dir("${BASE_DIR}"){
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") }
withKindEnv() {
sh(label: "Deploy to kubernetes",script: "make -C deploy/kubernetes test")
}
sh(label: "Deploy to kubernetes",script: "make -C deploy/kubernetes test")
}
}
}
Expand Down Expand Up @@ -155,29 +151,6 @@ pipeline {
}
}

// See https://github.com/elastic/beats/pull/21857
def withKindEnv(Closure body) {
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()}'")
}
}
}
body()
} finally {
sh(label: 'Delete cluster', script: 'kind delete cluster')
}
}

def withPackageEnv(platform, Closure body) {
if (isUnix()) {
if (platform.contains('macosx')) {
Expand Down
43 changes: 0 additions & 43 deletions .ci/scripts/install-kind.sh

This file was deleted.

44 changes: 0 additions & 44 deletions .ci/scripts/install-kubectl.sh

This file was deleted.

23 changes: 0 additions & 23 deletions .ci/scripts/kind-setup.sh

This file was deleted.

0 comments on commit 109c689

Please sign in to comment.