diff --git a/.buildkite/deploy/kubernetes/deploy-k8s-pipeline.yml b/.buildkite/deploy/kubernetes/deploy-k8s-pipeline.yml index a357e04b756b..9ddabb07fa79 100644 --- a/.buildkite/deploy/kubernetes/deploy-k8s-pipeline.yml +++ b/.buildkite/deploy/kubernetes/deploy-k8s-pipeline.yml @@ -3,14 +3,12 @@ env: IMAGE_UBUNTU_X86_64: "family/platform-ingest-beats-ubuntu-2204" GCP_HI_PERF_MACHINE_TYPE: "c2d-highcpu-16" - KIND_VERSION: "v0.20.0" - K8S_VERSION": "v1.29.0" KUBECONFIG: "${WORKSPACE}/kubecfg" steps: - label: "Checks" command: ".buildkite/deploy/kubernetes/scripts/make.sh" -# if: build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("GITHUB_PR_LABELS") == "kubernetes" + if: build.env("BUILDKITE_PULL_REQUEST") != "false" && build.env("GITHUB_PR_LABELS") == "kubernetes" notify: - github_commit_status: context: "Deploy K8S/Checks" @@ -20,11 +18,15 @@ steps: machineType: "${GCP_HI_PERF_MACHINE_TYPE}" - label: "K8S Test" + key: "k8s-test" env: k8sTest: "v1.29.0,v1.28.0,v1.27.3,v1.26.6" - command: - - ".buildkite/deploy/kubernetes/scripts/setup-k8s-env.sh" - - "MODULE=kubernetes make -C metricbeat integration-tests" + command: ".buildkite/deploy/kubernetes/scripts/setup-k8s-env.sh" +# - "MODULE=kubernetes make -C metricbeat integration-tests" + agents: + provider: "gcp" + image: "${IMAGE_UBUNTU_X86_64}" + machineType: "${GCP_HI_PERF_MACHINE_TYPE}" # setEnvVar('ONLY_DOCS', isGitRegionMatch(patterns: [ '(.*\\.(asciidoc|md)|deploy/kubernetes/.*-kubernetes\\.yaml)' ], shouldMatchAll: true).toString()) diff --git a/.buildkite/deploy/kubernetes/scripts/install-kind.sh b/.buildkite/deploy/kubernetes/scripts/install-kind.sh index 0da8076d0505..741ae47fba5c 100755 --- a/.buildkite/deploy/kubernetes/scripts/install-kind.sh +++ b/.buildkite/deploy/kubernetes/scripts/install-kind.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euxo pipefail +set -euo pipefail MSG="environment variable missing." DEFAULT_HOME="/usr/local" @@ -12,6 +12,8 @@ then set +e echo "--- Found Kind. Checking version.." FOUND_KIND_VERSION=$(kind --version 2>&1 >/dev/null | awk '{print $3}') + echo "--- Kind version found: $FOUND_KIND_VERSION" + echo "--- Kind version required: $KIND_VERSION" if [ "$FOUND_KIND_VERSION" == "$KIND_VERSION" ] then echo "--- Versions match. No need to install Kind. Exiting." diff --git a/.buildkite/deploy/kubernetes/scripts/install-kubectl.sh b/.buildkite/deploy/kubernetes/scripts/install-kubectl.sh index 3f12e08b2415..b6423c19dc9e 100755 --- a/.buildkite/deploy/kubernetes/scripts/install-kubectl.sh +++ b/.buildkite/deploy/kubernetes/scripts/install-kubectl.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euxo pipefail +set -euo pipefail MSG="parameter missing." DEFAULT_HOME="/usr/local" @@ -12,6 +12,8 @@ then set +e echo "--- Found kubectl. Checking version.." FOUND_KUBECTL_VERSION=$(kubectl version --client --short 2>&1 >/dev/null | awk '{print $3}') + echo "--- Kubectl version found: $(kubectl version --client --short 2>&1 >/dev/null)" + echo "--- Kubectl version required: $K8S_VERSION" if [ "${FOUND_KUBECTL_VERSION}" == "${K8S_VERSION}" ] then echo "--- Versions match. No need to install kubectl. Exiting." diff --git a/.buildkite/deploy/kubernetes/scripts/kind-setup.sh b/.buildkite/deploy/kubernetes/scripts/kind-setup.sh index 589d96619862..015afa93cdee 100755 --- a/.buildkite/deploy/kubernetes/scripts/kind-setup.sh +++ b/.buildkite/deploy/kubernetes/scripts/kind-setup.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -euo pipefail +set -euxo pipefail echo "--- Creating cluster" -kind create cluster --image kindest/node:${K8S_VERSION} +/usr/local/bin/kind create cluster --image kindest/node:${K8S_VERSION} kubectl cluster-info diff --git a/.buildkite/deploy/kubernetes/scripts/setup-k8s-env.sh b/.buildkite/deploy/kubernetes/scripts/setup-k8s-env.sh index df5b30db17d6..023e095c4f95 100755 --- a/.buildkite/deploy/kubernetes/scripts/setup-k8s-env.sh +++ b/.buildkite/deploy/kubernetes/scripts/setup-k8s-env.sh @@ -4,9 +4,9 @@ set -euo pipefail source .buildkite/env-scripts/util.sh -echo "--- Installing kind" -retry_with_count .buildkite/deploy/kubernetes/scripts/install-kind.sh -retry_with_count .buildkite/deploy/kubernetes/scripts/install-kubectl.sh +echo "--- Installing kind & kubectl" +retry_with_count 5 .buildkite/deploy/kubernetes/scripts/install-kubectl.sh +retry_with_count 5 .buildkite/deploy/kubernetes/scripts/install-kind.sh echo "--- Setting up kind" max_retries=3 @@ -15,6 +15,7 @@ retries=0 while true; do script_output=$(.buildkite/deploy/kubernetes/scripts/kind-setup.sh 2>&1) + echo "--- $script_output" exit_code=$? if [ $exit_code -eq 0 ]; then diff --git a/.buildkite/env-scripts/env.sh b/.buildkite/env-scripts/env.sh index fbbea61ee01b..c0d8d6268eba 100644 --- a/.buildkite/env-scripts/env.sh +++ b/.buildkite/env-scripts/env.sh @@ -31,6 +31,9 @@ ONLY_DOCS=$(changeset_applies "$DOCS_CHANGESET") PACKAGING_CHANGES=$(changeset_applies "$PACKAGING_CHANGESET") GO_MOD_CHANGES=$(changeset_applies "^go.mod") +KIND_VERSION="v0.20.0" +K8S_VERSION="v1.29.0" + export REPO export WORKSPACE export BIN @@ -53,3 +56,6 @@ export KUBECONFIG export ONLY_DOCS export PACKAGING_CHANGES export GO_MOD_CHANGES + +export KIND_VERSION +export K8S_VERSION