diff --git a/.buildkite/deploy/kubernetes/deploy-k8s-pipeline.yml b/.buildkite/deploy/kubernetes/deploy-k8s-pipeline.yml index a357e04b756b..cae1207644c2 100644 --- a/.buildkite/deploy/kubernetes/deploy-k8s-pipeline.yml +++ b/.buildkite/deploy/kubernetes/deploy-k8s-pipeline.yml @@ -3,9 +3,6 @@ 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" @@ -20,11 +17,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..828680d10ae8 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." @@ -21,6 +23,7 @@ then fi echo "--- UNMET DEP: Installing Kind" +mkdir -p "${HOME}/bin" OS=$(uname -s| tr '[:upper:]' '[:lower:]') ARCH=$(uname -m| tr '[:upper:]' '[:lower:]') diff --git a/.buildkite/deploy/kubernetes/scripts/install-kubectl.sh b/.buildkite/deploy/kubernetes/scripts/install-kubectl.sh index 3f12e08b2415..c274c5bf734d 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" @@ -7,11 +7,15 @@ K8S_VERSION=${K8S_VERSION:?$MSG} HOME=${HOME:?$DEFAULT_HOME} KUBECTL_CMD="${HOME}/bin/kubectl" +echo "--- KUBECONFIG: ${KUBECONFIG}" + if command -v kubectl 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..1c92fb3ecd6b 100644 --- a/.buildkite/env-scripts/env.sh +++ b/.buildkite/env-scripts/env.sh @@ -25,12 +25,15 @@ SETUP_WIN_PYTHON_VERSION="3.11.0" # Docker & DockerHub DOCKER_COMPOSE_VERSION="1.21.0" DOCKER_REGISTRY="docker.elastic.co" -KUBECONFIG="${WORKSPACE}/kubecfg" - 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" +KUBECONFIG="${WORKSPACE}/kubecfg" + export REPO export WORKSPACE export BIN @@ -48,8 +51,11 @@ export SETUP_WIN_PYTHON_VERSION export DOCKER_COMPOSE_VERSION export DOCKER_REGISTRY -export KUBECONFIG export ONLY_DOCS export PACKAGING_CHANGES export GO_MOD_CHANGES + +export KIND_VERSION +export K8S_VERSION +export KUBECONFIG