diff --git a/.github/workflows/branch-build.yaml b/.github/workflows/branch-build.yaml index 7f883bba0..beb1d51c7 100644 --- a/.github/workflows/branch-build.yaml +++ b/.github/workflows/branch-build.yaml @@ -257,6 +257,9 @@ jobs: name: Integration tests runs-on: ubuntu-latest needs: [ entry-tests, build-app, build-tests ] + strategy: + matrix: + cluster: [ kind, k3d ] permissions: contents: read steps: @@ -282,6 +285,8 @@ jobs: ARTIFACTS: "output/" DISABLE_MONITORING_INSTALLATION: "true" CAPACT_BINARY: "./capact" + CLUSTER_TYPE: ${{ matrix.cluster }} + DISABLE_K3D_REGISTRY: "true" run: | make test-integration - name: Upload artifacts diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml index 15a7dd00c..382210c1b 100644 --- a/.github/workflows/pr-build.yaml +++ b/.github/workflows/pr-build.yaml @@ -461,6 +461,9 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.draft == false needs: [ push-apps, push-tests, build-cli ] + strategy: + matrix: + cluster: [ kind, k3d ] permissions: contents: read env: @@ -497,6 +500,8 @@ jobs: BUILD_IMAGES: "false" ARTIFACTS: "output/" DISABLE_MONITORING_INSTALLATION: "true" + CLUSTER_TYPE: ${{ matrix.cluster }} + DISABLE_K3D_REGISTRY: "true" run: | make test-integration - name: Upload artifacts diff --git a/hack/lib/const.sh b/hack/lib/const.sh index 4baeef414..b45cce7d5 100644 --- a/hack/lib/const.sh +++ b/hack/lib/const.sh @@ -24,6 +24,7 @@ readonly CAPACT_NAMESPACE="capact-system" readonly CAPACT_RELEASE_NAME="capact" readonly DEV_CLUSTER_NAME="dev-capact" readonly KIND_CI_CLUSTER_NAME="kind-ci-capact" +readonly K3D_CI_CLUSTER_NAME="k3d-ci-capact" # # OCF diff --git a/hack/test-integration.sh b/hack/test-integration.sh index 005a8fb09..cf3f72ec2 100755 --- a/hack/test-integration.sh +++ b/hack/test-integration.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# This script provisions testing environment using 'kind'(kubernetes-in-docker) +# This script provisions testing environment using 'kind'(kubernetes-in-docker) or 'k3d' (Rancher Lab's minimal Kubernetes distribution) # and execute end-to-end Capact tests. # # It requires Docker to be installed. @@ -23,6 +23,8 @@ source "${CURRENT_DIR}/lib/utilities.sh" || { echo 'Cannot load CI utilities.'; # shellcheck source=./hack/lib/const.sh source "${CURRENT_DIR}/lib/const.sh" || { echo 'Cannot load constant values.'; exit 1; } +CLUSTER_TYPE=${CLUSTER_TYPE:-"kind"} + SKIP_DEPS_INSTALLATION=${SKIP_DEPS_INSTALLATION:-true} DUMP_CLUSTER_INFO="${DUMP_CLUSTER_INFO:-false}" @@ -58,15 +60,21 @@ main() { export HELM_VERSION=${STABLE_HELM_VERSION} host::install::helm else - echo "Skipping kind and helm installation cause SKIP_DEPS_INSTALLATION is set to true." + echo "Skipping $CLUSTER_TYPE and helm installation cause SKIP_DEPS_INSTALLATION is set to true." fi export REPO_DIR=$REPO_ROOT_DIR - export CLUSTER_TYPE=${CLUSTER_TYPE:-"kind"} + export CLUSTER_TYPE export KUBECONFIG="${TMP_DIR}/kubeconfig" - export CLUSTER_NAME=${CLUSTER_NAME:-${KIND_CI_CLUSTER_NAME}} + + if [ "$CLUSTER_TYPE" == "kind" ]; then + export CLUSTER_NAME=${CLUSTER_NAME:-${KIND_CI_CLUSTER_NAME}} + else + export CLUSTER_NAME=${CLUSTER_NAME:-${K3D_CI_CLUSTER_NAME}} + fi + export HELM_VERSION=${STABLE_HELM_VERSION} capact::create_cluster