E2E - KinD #15934
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------------------------------ | |
# Copyright 2021 The Dapr Authors | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# ------------------------------------------------------------ | |
name: E2E - KinD | |
on: | |
push: | |
branches: | |
- master | |
- release-* | |
paths-ignore: | |
- '**.md' | |
schedule: | |
- cron: '0 */3 * * *' | |
- cron: '0 */6 * * *' | |
pull_request: | |
branches: | |
- master | |
- 'release-*' | |
paths-ignore: | |
- '**.md' | |
defaults: | |
run: | |
shell: bash | |
working-directory: ./src/github.com/dapr/cli | |
jobs: | |
# This workflow runs our e2e tests in a local KinD cluster. Since it | |
# does not required a paid cluster and special credentials, it does | |
# not require /ok-to-test. That allows contributors to run E2E tests | |
# in their Draft PRs without explicit approval from Dapr | |
# maintainers. | |
# | |
# One other benefit of a fully-localized workflow is that tests are | |
# running on a fresh cluster everytime, thus being decoupled from | |
# shared resource issues. | |
# | |
kubernetes-e2e: | |
name: E2E tests for K8s (KinD) | |
runs-on: ubuntu-latest | |
env: | |
DAPR_RUNTIME_PINNED_VERSION: 1.13.0-rc.2 | |
DAPR_DASHBOARD_PINNED_VERSION: 0.14.0 | |
DAPR_RUNTIME_LATEST_STABLE_VERSION: | |
DAPR_DASHBOARD_LATEST_STABLE_VERSION: | |
DAPR_TGZ: dapr-1.13.0-rc.2.tgz | |
strategy: | |
fail-fast: false # Keep running if one leg fails. | |
matrix: | |
k8s-version: | |
- v1.23.12 | |
- v1.24.6 | |
- v1.25.2 | |
mode: | |
- ha | |
- non-ha | |
# Map between K8s and KinD versions. | |
# This is attempting to make it a bit clearer what's being tested. | |
# See: https://github.com/kubernetes-sigs/kind/releases/tag/v0.16.0 | |
include: | |
- k8s-version: v1.23.12 | |
kind-version: v0.16.0 | |
kind-image-sha: sha256:9402cf1330bbd3a0d097d2033fa489b2abe40d479cc5ef47d0b6a6960613148a | |
- k8s-version: v1.24.6 | |
kind-version: v0.16.0 | |
kind-image-sha: sha256:97e8d00bc37a7598a0b32d1fabd155a96355c49fa0d4d4790aab0f161bf31be1 | |
- k8s-version: v1.25.2 | |
kind-version: v0.16.0 | |
kind-image-sha: sha256:9be91e9e9cdf116809841fc77ebdb8845443c4c72fe5218f3ae9eb57fdb4bace | |
steps: | |
- name: Check out code onto GOPATH | |
uses: actions/checkout@v3 | |
with: | |
path: ./src/github.com/dapr/cli | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
id: setup-go | |
with: | |
go-version-file: './src/github.com/dapr/cli/go.mod' | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ steps.setup-go.outputs.go-version }}- | |
- name: Configure KinD | |
# Generate a KinD configuration file that uses: | |
# (a) a couple of worker nodes: this is needed to run both | |
# ZooKeeper + Kakfa, and | |
# (b) a local registry: Due to `kind load` performance | |
# https://github.com/kubernetes-sigs/kind/issues/1165, using | |
# a local repository speeds up the image pushes into KinD | |
# significantly. | |
working-directory: ./ | |
run: | | |
cat > kind.yaml <<EOF | |
apiVersion: kind.x-k8s.io/v1alpha4 | |
kind: Cluster | |
nodes: | |
- role: control-plane | |
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }} | |
- role: worker | |
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }} | |
- role: worker | |
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }} | |
- role: worker | |
image: kindest/node:${{ matrix.k8s-version }}@${{ matrix.kind-image-sha }} | |
EOF | |
# Log the generated kind.yaml for easy reference. | |
cat kind.yaml | |
- name: Create KinD Cluster | |
uses: helm/[email protected] | |
with: | |
config: kind.yaml | |
cluster_name: kind | |
version: ${{ matrix.kind-version }} | |
- name: Get KinD info | |
run: | | |
kubectl cluster-info --context kind-kind | |
NODE_IP=$(kubectl get nodes \ | |
-lkubernetes.io/hostname!=kind-control-plane \ | |
-ojsonpath='{.items[0].status.addresses[?(@.type=="InternalIP")].address}') | |
echo "MINIKUBE_NODE_IP=$NODE_IP" >> $GITHUB_ENV | |
- name: Free up some diskspace | |
run: | | |
docker image prune -a -f | |
- name: Determine latest Dapr Runtime version including Pre-releases | |
if: github.base_ref == 'master' | |
run: | | |
export RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1) | |
if [[ -z "$RUNTIME_VERSION" ]]; then | |
echo "Could not fetch the latest Dapr Runtime version. Using pinned version $DAPR_RUNTIME_PINNED_VERSION" | |
else | |
echo "Found $RUNTIME_VERSION" | |
echo "DAPR_RUNTIME_PINNED_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: Determine latest Dapr Dashboard version including Pre-releases | |
if: github.base_ref == 'master' | |
run: | | |
export DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1) | |
if [[ -z "$DASHBOARD_VERSION" ]]; then | |
echo "Could not fetch the latest Dapr Dashboard version. Using pinned version $DAPR_DASHBOARD_PINNED_VERSION" | |
else | |
echo "Found $DASHBOARD_VERSION" | |
echo "DAPR_DASHBOARD_PINNED_VERSION=$DASHBOARD_VERSION" >> $GITHUB_ENV | |
fi | |
shell: bash | |
- name: Determine latest stable Dapr Runtime version | |
run: | | |
export LATEST_STABLE_RUNTIME_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dapr/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1) | |
echo "Found $LATEST_STABLE_RUNTIME_VERSION" | |
echo "DAPR_RUNTIME_LATEST_STABLE_VERSION=$LATEST_STABLE_RUNTIME_VERSION" >> $GITHUB_ENV | |
shell: bash | |
- name: Determine latest stable Dapr Dashboard version | |
run: | | |
export LATEST_STABLE_DASHBOARD_VERSION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/dapr/dashboard/releases/latest | grep tag_name | awk -F':' '{print $2}' | tr -d '", ' | sed '/-/! s/$/_/' | sort -V | sed 's/_$//' | tr -d 'v' | tail -1) | |
echo "Found $LATEST_STABLE_DASHBOARD_VERSION" | |
echo "DAPR_DASHBOARD_LATEST_STABLE_VERSION=$LATEST_STABLE_DASHBOARD_VERSION" >> $GITHUB_ENV | |
shell: bash | |
- name: Run tests with GHCR | |
# runs every 6hrs | |
if: github.event.schedule == '0 */6 * * *' | |
env: | |
DAPR_DEFAULT_IMAGE_REGISTRY: ghcr | |
run: | | |
export TEST_OUTPUT_FILE=$GITHUB_WORKSPACE/test-e2e-kind.json | |
echo "TEST_OUTPUT_FILE=$TEST_OUTPUT_FILE" >> $GITHUB_ENV | |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
make e2e-build-run-k8s | |
shell: bash | |
- name: Run tests with Docker hub | |
if: github.event.schedule != '0 */6 * * *' | |
run: | | |
export TEST_OUTPUT_FILE=$GITHUB_WORKSPACE/test-e2e-kind.json | |
echo "TEST_OUTPUT_FILE=$TEST_OUTPUT_FILE" >> $GITHUB_ENV | |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
make e2e-build-run-k8s | |
shell: bash | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.k8s-version }}_${{ matrix.mode }}_e2e_k8s.json | |
path: ${{ env.TEST_OUTPUT_FILE }} |