wip: c1 v2 #3
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
# # This workflow defines the e2e test related jobs. | |
# name: E2E Test | |
# on: | |
# workflow_dispatch: {} | |
# pull_request: | |
# branches: | |
# - master | |
# - release-* | |
# permissions: read-all | |
# jobs: | |
# changed-files: | |
# runs-on: ubuntu-20.04 | |
# outputs: | |
# only_changed: ${{ steps.filter.outputs.only_changed }} | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# fetch-depth: 2 | |
# - name: Get changed files | |
# uses: tj-actions/changed-files@v34 | |
# id: filter | |
# with: | |
# # Not available for frontend code for now. | |
# files: | | |
# .gitignore | |
# **.md | |
# ui/** | |
# .github/workflows/checklink.yaml | |
# .github/checklink_config.json | |
# .github/workflows/ci.yml | |
# .github/workflows/ci_skip.yml | |
# .github/workflows/codecov_unittest.yaml | |
# .github/workflows/integration_test.yml | |
# .github/workflows/license_checker.yml | |
# .github/workflows/must_update_changelog.yml | |
# .github/workflows/release_helm_chart.yml | |
# .github/workflows/stale.yml | |
# .github/workflows/upload_env_image.yml | |
# .github/workflows/upload_image.yml | |
# .github/workflows/upload_image_pr.yml | |
# .github/workflows/upload_latest_files.yml | |
# .github/workflows/upload_release_files.yml | |
# - name: Echo changed files | |
# run: echo "${{ toJSON(steps.filter.outputs) }}" | |
# build-image: | |
# needs: changed-files | |
# if: needs.changed-files.outputs.only_changed == 'false' | |
# runs-on: ubuntu-20.04 | |
# steps: | |
# - name: checkout codes | |
# uses: actions/checkout@v2 | |
# - name: Build Chaos Mesh Build Env | |
# if: ${{ github.event.pull_request }} | |
# env: | |
# IMAGE_BUILD_ENV_BUILD: ${{ contains(github.event.pull_request.labels.*.name, 'rebuild-build-env-image') }} | |
# run: | | |
# if [ "${IMAGE_BUILD_ENV_BUILD}" = "true" ] ; then | |
# export IMAGE_BUILD_ENV_BUILD=1; | |
# else | |
# export IMAGE_BUILD_ENV_BUILD=0; | |
# fi | |
# make image-build-env | |
# - name: Build Chaos Mesh Dev Env | |
# if: ${{ github.event.pull_request }} | |
# env: | |
# IMAGE_DEV_ENV_BUILD: ${{ contains(github.event.pull_request.labels.*.name, 'rebuild-dev-env-image') }} | |
# run: | | |
# if [ "${IMAGE_DEV_ENV_BUILD}" = "true" ] ; then | |
# export IMAGE_DEV_ENV_BUILD=1; | |
# else | |
# export IMAGE_DEV_ENV_BUILD=0; | |
# fi | |
# make image-dev-env | |
# # once the https://github.com/actions/cache/pull/498 gets merged, | |
# # we can switch to the official cache action | |
# - name: Restore build cache | |
# id: cache | |
# uses: martijnhols/actions-cache/restore@main | |
# with: | |
# path: cache | |
# # don't worry about the branch, the github cache | |
# # is only accessible in the same branch (or a pull_request | |
# # whose target is the branch) | |
# key: e2e-image-build-cache-${{ runner.os }} | |
# - name: build e2e images | |
# env: | |
# DOCKER_CACHE: 1 | |
# DOCKER_CACHE_DIR: ${{ github.workspace }}/cache | |
# GO_BUILD_CACHE: ${{ github.workspace }}/cache | |
# DOCKER_CLI_EXPERIMENTAL: enabled | |
# run: | | |
# docker buildx create --use --name chaos-mesh-builder | |
# make -j4 image e2e-image | |
# - name: save docker images | |
# run: | | |
# mkdir -p ./output/saved-images | |
# docker image save ghcr.io/chaos-mesh/chaos-dashboard:latest > ./output/saved-images/chaos-dashboard.tgz | |
# docker image save ghcr.io/chaos-mesh/chaos-daemon:latest > ./output/saved-images/chaos-daemon.tgz | |
# docker image save ghcr.io/chaos-mesh/chaos-mesh:latest > ./output/saved-images/chaos-mesh.tgz | |
# docker image save ghcr.io/chaos-mesh/e2e-helper:latest > ./output/saved-images/e2e-helper.tgz | |
# - name: upload saved images | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: saved-images | |
# path: ./output/saved-images | |
# retention-days: 7 | |
# build-e2e-binary: | |
# needs: changed-files | |
# if: needs.changed-files.outputs.only_changed == 'false' | |
# runs-on: ubuntu-20.04 | |
# steps: | |
# - name: checkout codes | |
# uses: actions/checkout@v2 | |
# - name: Restore build cache | |
# id: cache | |
# uses: martijnhols/actions-cache/restore@main | |
# with: | |
# path: cache | |
# key: e2e-binary-build-cache-${{ runner.os }} | |
# - name: build e2e binary | |
# env: | |
# DOCKER_CACHE: 1 | |
# DOCKER_CACHE_DIR: ${{ github.workspace }}/cache | |
# GO_BUILD_CACHE: ${{ github.workspace }}/cache | |
# run: | | |
# make e2e-build | |
# - name: upload e2e binary | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: e2e-binary | |
# path: ./e2e-test/image/e2e/bin | |
# retention-days: 7 | |
# e2e-test-matrix: | |
# needs: | |
# - build-image | |
# - build-e2e-binary | |
# runs-on: ubuntu-20.04 | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# kubernetes-version: | |
# - v1.20.15 | |
# - v1.23.4 | |
# - v1.25.1 | |
# focus: | |
# - "[Graceful-Shutdown] [IOChaos]" | |
# - "[Graceful-Shutdown] [HTTPChaos]" | |
# - "[Basic] [PodChaos]" | |
# - "[Basic] [TimeChaos]" | |
# - "[Basic] [IOChaos]" | |
# - "[Basic] [HTTPChaos]" | |
# - "[Basic] [Sidecar Config]" | |
# - "[Basic] [NetworkChaos]" | |
# - "[Basic] [DNSChaos]" | |
# - "[Basic] [StressChaos]" | |
# steps: | |
# - name: checkout codes | |
# uses: actions/checkout@v2 | |
# - name: download saved images | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: saved-images | |
# path: ./output/saved-images | |
# - name: download e2e binary | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: e2e-binary | |
# path: ./output/e2e-binary | |
# - name: move e2e binary | |
# run: | | |
# mkdir -p ./e2e-test/image/e2e/bin | |
# mv ./output/e2e-binary/ginkgo ./e2e-test/image/e2e/bin/ginkgo | |
# mv ./output/e2e-binary/e2e.test ./e2e-test/image/e2e/bin/e2e.test | |
# chmod +x ./e2e-test/image/e2e/bin/ginkgo | |
# chmod +x ./e2e-test/image/e2e/bin/e2e.test | |
# - name: Setup minikube | |
# uses: manusa/actions-setup-minikube@v2.4.3 | |
# with: | |
# driver: docker | |
# minikube version: v1.27.0 | |
# kubernetes version: ${{ matrix.kubernetes-version }} | |
# start args: --cni calico | |
# github token: ${{ secrets.GITHUB_TOKEN }} | |
# - name: load image into minikube | |
# run: | | |
# minikube image load ./output/saved-images/chaos-dashboard.tgz | |
# minikube image load ./output/saved-images/chaos-daemon.tgz | |
# minikube image load ./output/saved-images/chaos-mesh.tgz | |
# minikube image load ./output/saved-images/e2e-helper.tgz | |
# - name: Restrict access to kubeconfig # https://github.com/helm/helm/issues/9115 | |
# run: chmod 600 ~/.kube/config | |
# - name: Setup Helm | |
# uses: azure/setup-helm@v3 | |
# - name: Install Chaos Mesh | |
# run: | | |
# helm install --wait --create-namespace chaos-mesh helm/chaos-mesh --namespace=chaos-mesh --set images.tag=latest | |
# - name: e2e tests | |
# env: | |
# FOCUS: ${{ matrix.focus }} | |
# run: | | |
# # because ginkgo -focus accepts the regex expression, we should use escape to represent the squared brackets and dash | |
# export ESCAPED_FOCUS=$(echo $FOCUS | sed -e 's/\[/\\\[/g' | sed -e 's/\]/\\\]/g' | sed -e 's/\-/\\\-/g') | |
# KUBECONFIG=~/.kube/config ./e2e-test/image/e2e/bin/ginkgo -focus="${ESCAPED_FOCUS}" ./e2e-test/image/e2e/bin/e2e.test -- --e2e-image ghcr.io/chaos-mesh/e2e-helper:latest | |
# - name: post run - extract profile info from kubernetes | |
# if: always() | |
# env: | |
# PROFILE_DIRECTORY: ./output/chaos-mesh-profile | |
# run: | | |
# kubectl cluster-info dump --all-namespaces --output-directory $PROFILE_DIRECTORY/manifests -o yaml | |
# kubectl get endpoints -A -o yaml > $PROFILE_DIRECTORY/manifests/endpoints.yaml | |
# kubectl get secrets -A -o yaml > $PROFILE_DIRECTORY/manifests/secrets.yaml | |
# kubectl get configmaps -A -o yaml > $PROFILE_DIRECTORY/manifests/configmaps.yaml | |
# - name: post run - upload Chaos Mesh profile info | |
# if: always() | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: profiling-${{ matrix.focus }}-k8s-${{ matrix.kubernetes-version }} | |
# path: ./output/chaos-mesh-profile | |
# retention-days: 7 | |
# - name: post run - upload junit test reports | |
# if: always() | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: test-junit-reports-${{ matrix.focus }}-k8s-${{ matrix.kubernetes-version }} | |
# path: "**/*.xml" | |
# retention-days: 7 | |
# pass: | |
# needs: | |
# - e2e-test-matrix | |
# name: E2E Test Passed | |
# runs-on: ubuntu-20.04 | |
# steps: | |
# - run: echo "🎉 E2E Test Passed!" |