|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright 2025 The KCP Authors. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +set -euo pipefail |
| 18 | + |
| 19 | +# build the image(s) |
| 20 | +export IMAGE_TAG=local |
| 21 | + |
| 22 | +echo "Building container images…" |
| 23 | +# ARCHITECTURES=amd64 DRY_RUN=yes ./hack/ci/build-image.sh |
| 24 | + |
| 25 | +# start docker so we can run kind |
| 26 | +# start-docker.sh |
| 27 | + |
| 28 | +# create a local kind cluster |
| 29 | +KIND_CLUSTER_NAME=e2e |
| 30 | + |
| 31 | +# echo "Preloading the kindest/node image…" |
| 32 | +# docker load --input /kindest.tar |
| 33 | + |
| 34 | +export KUBECONFIG=$(mktemp) |
| 35 | +export KUBECONFIG=e2e.kubeconfig |
| 36 | +echo "Creating kind cluster $KIND_CLUSTER_NAME…" |
| 37 | +kind create cluster --name "$KIND_CLUSTER_NAME" |
| 38 | +chmod 600 "$KUBECONFIG" |
| 39 | + |
| 40 | +# load the agent image into the kind cluster |
| 41 | +image="ghcr.io/kcp-dev/api-syncagent:$IMAGE_TAG" |
| 42 | +archive=agent.tar |
| 43 | + |
| 44 | +echo "Loading api-syncagent image into kind…" |
| 45 | +buildah manifest push --all "$image" "oci-archive:$archive:$image" |
| 46 | +kind load image-archive "$archive" --name "$KIND_CLUSTER_NAME" |
| 47 | + |
| 48 | +# deploy cert-manager |
| 49 | +echo "Installing cert-manager…" |
| 50 | + |
| 51 | +helm repo add jetstack https://charts.jetstack.io |
| 52 | +helm repo update |
| 53 | + |
| 54 | +kubectl apply --filename https://github.com/cert-manager/cert-manager/releases/download/v1.17.0/cert-manager.crds.yaml |
| 55 | +helm install \ |
| 56 | + --wait \ |
| 57 | + --namespace cert-manager \ |
| 58 | + --create-namespace \ |
| 59 | + --version v1.17.0 \ |
| 60 | + cert-manager jetstack/cert-manager |
| 61 | + |
| 62 | +# deploy a kcp which will live for the entire runtime of the e2e tests and be shared among all subtests |
| 63 | +echo "Installing kcp into kind…" |
| 64 | + |
| 65 | +helm repo add kcp https://kcp-dev.github.io/helm-charts |
| 66 | +helm repo update |
| 67 | + |
| 68 | +helm install \ |
| 69 | + --wait \ |
| 70 | + --namespace kcp \ |
| 71 | + --create-namespace \ |
| 72 | + --values hack/ci/testdata/kcp-kind-values.yaml \ |
| 73 | + kcp-e2e kcp/kcp |
| 74 | + |
| 75 | +# time to run the tests |
| 76 | +echo "Running e2e tests…" |
| 77 | +(set -x; go test -tags e2e -timeout 2h -v ./test/e2e/...) |
| 78 | + |
| 79 | +echo "Done. :-)" |
0 commit comments