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

ci: simplify kind/kubectl environment #22

Merged
merged 3 commits into from
Feb 8, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
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@test/k8s') _
v1v marked this conversation as resolved.
Show resolved Hide resolved

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.