You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by zh...@apache.org on 2023/04/23 07:04:56 UTC

[apisix-ingress-controller] branch master updated: CI: add regression testing with apisix:dev (#1721)

This is an automated email from the ASF dual-hosted git repository.

zhangjintao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 2182a48c CI: add regression testing with apisix:dev (#1721)
2182a48c is described below

commit 2182a48cbca785373eca745a13d8cf2b7d9ab6c8
Author: Priyansh Singh <pr...@gmail.com>
AuthorDate: Sun Apr 23 12:34:50 2023 +0530

    CI: add regression testing with apisix:dev (#1721)
---
 .github/workflows/e2e-test-ci-v2-cron-dev.yml | 217 ++++++++++++++++++++++++++
 Makefile                                      |   9 +-
 2 files changed, 221 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/e2e-test-ci-v2-cron-dev.yml b/.github/workflows/e2e-test-ci-v2-cron-dev.yml
new file mode 100644
index 00000000..e34aa220
--- /dev/null
+++ b/.github/workflows/e2e-test-ci-v2-cron-dev.yml
@@ -0,0 +1,217 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you 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-test-ci (dev)
+
+on:
+  schedule:
+      - cron: '0 0 * * *'
+  push:
+    branches:
+      - master
+      - v1.6.0
+  pull_request:
+    branches:
+      - master
+      - v1.6.0
+    types: [opened, synchronize, reopened, review_requested]
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-dev
+  cancel-in-progress: true
+
+jobs:
+  changes:
+    if: ${{ (!github.event.pull_request.draft || github.event.schedule == '0 0 * * *') }}
+    runs-on: ubuntu-20.04
+    outputs:
+      docs: ${{ steps.filter.outputs.docs }}
+      go: ${{ steps.filter.outputs.go }}
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          submodules: recursive
+
+      - uses: ./.github/actions/paths-filter
+        id: filter
+        with:
+          token: ${{ secrets.GITHUB_TOKEN }}
+          filters: |
+            docs:
+              - 'docs/**/*'
+              - '*.md'
+            go:
+              - '*.go'
+              - '**/*.go'
+              - 'go.mod'
+              - 'go.sum'
+              - 'Makefile'
+              - 'Dockerfile'
+              - 'test/e2e/**/*'
+              - 'conf/**'
+              - 'utils/**'
+              - ".github/**"
+  build:
+    name: Build
+    runs-on: ubuntu-20.04
+    needs: changes
+    if: needs.changes.outputs.go == 'true'
+
+    steps:
+
+      - name: Checkout
+        uses: actions/checkout@v3 # v3.0.2
+
+      - name: Setup Go Env
+        id: go
+        uses: actions/setup-go@v3 # v3.2.0
+        with:
+          go-version: '1.19'
+
+      - name: Set up QEMU
+        uses: docker/setup-qemu-action@v2 #v2.0.0
+
+      - name: Set up Docker Buildx
+        id: buildx
+        uses: docker/setup-buildx-action@v2 # v2.0.0
+        with:
+          version: latest
+
+      - name: Prepare Host
+        run: |
+          curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-linux-amd64
+          chmod +x ./kind
+          sudo mv kind /usr/local/bin
+
+      - name: Build images
+        env:
+          APISIX_ADMIN_API_VERSION: "v3"
+          TAG: dev
+          ARCH: amd64
+          REGISTRY: localhost:5000
+          ENABLE_PROXY: "false"
+        run: |
+          echo "building images..."
+          TARGET_APISIX_VERSION=dev make clean-image build-images
+
+          echo "creating images cache..."
+          docker save \
+            ${REGISTRY}/apisix:dev \
+            ${REGISTRY}/etcd:dev \
+            ${REGISTRY}/apisix-ingress-controller:dev \
+            ${REGISTRY}/httpbin:dev \
+            ${REGISTRY}/test-backend:dev \
+            ${REGISTRY}/echo-server:dev \
+            ${REGISTRY}/busybox:dev \
+            | pigz > docker-dev.tar.gz
+
+      - name: cache
+        uses: actions/upload-artifact@v3 # v3.1.0
+        with:
+          name: docker-dev.tar.gz
+          path: docker-dev.tar.gz
+
+  prepare:
+    needs: changes
+    if: needs.changes.outputs.go == 'true'
+    runs-on: ubuntu-20.04
+    steps:
+      - uses: actions/checkout@v3
+        with:
+          submodules: recursive
+
+      - name: Check e2e test cases' naming
+        run: make e2e-names-check
+
+      - name: List test suites and set the matrix
+        id: set-matrix
+        run: |
+          SUITES=($(find test/e2e -type d -iname 'suite-*' | grep -E -o '(\w|\-)*' | grep -v 'test' | grep -v 'e2e' | sort | uniq -u))
+          echo $SUITES
+          echo -n "matrix=$(jq --compact-output --null-input '$ARGS.positional' --args "${SUITES[@]}")" >> $GITHUB_OUTPUT
+    outputs:
+      matrix: ${{ steps.set-matrix.outputs.matrix }}
+
+  e2e-test:
+    needs:
+      - changes
+      - prepare
+      - build
+    runs-on: ubuntu-20.04
+    strategy:
+      fail-fast: false # If false, GitHub will not cancels all in-progress jobs in the matrix if any matrix job fails.
+      matrix:
+        suite: ${{ fromJson(needs.prepare.outputs.matrix) }}
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          submodules: recursive
+      - name: Setup Go Env
+        uses: actions/setup-go@v3
+        with:
+          go-version: "1.19"
+
+      - name: Install ginkgo
+        run: |
+          go install github.com/onsi/ginkgo/v2/ginkgo@v2.9.0
+          sudo cp ~/go/bin/ginkgo /usr/local/bin
+
+      - name: cache
+        uses: actions/download-artifact@v3 # v3
+        with:
+          name: docker-dev.tar.gz
+
+      - name: Create K8s cluster
+        shell: bash
+        run: |
+          make kind-up
+          kubectl wait --for=condition=Ready nodes --all
+
+      - name: Load images from cache
+        run: |
+          echo "loading docker images..."
+          pigz -dc docker-dev.tar.gz | docker load
+          make push-images
+
+      - name: Run E2E test suite
+        shell: bash
+        env:
+          APISIX_ADMIN_API_VERSION: "v3"
+          E2E_FOCUS: "${{ matrix.suite }}"
+          ENABLE_PROXY: "false"
+          E2E_SKIP_BUILD: "1"
+          E2E_FLAKE_ATTEMPTS: "2"
+          E2E_ENV: "ci"
+        run: |
+          make e2e-test
+
+      - name: Run E2E test suite
+        shell: bash
+        env:
+          E2E_FOCUS: "${{ matrix.suite }}"
+          ENABLE_PROXY: "false"
+          INGRESS_CLASS: "${{ matrix.ingress-class-values }}"
+          E2E_SKIP_BUILD: "1"
+          E2E_FLAKE_ATTEMPTS: "2"
+          E2E_ENV: "ci"
+        run: |
+          echo ${E2E_FOCUS} | grep "suite-cluster" && export E2E_NODES=1
+          make e2e-test
diff --git a/Makefile b/Makefile
index 819e0799..118531f5 100644
--- a/Makefile
+++ b/Makefile
@@ -18,13 +18,12 @@ default: help
 
 VERSION ?= 1.6.0
 
-# 2.15 image: "2.15.0-alpine"
+
 TARGET_APISIX_VERSION ?= "3.1.0-centos"
 APISIX_ADMIN_API_VERSION ?= "v3"
-ifneq ($(APISIX_ADMIN_API_VERSION), "v3")
-ifeq ($(TARGET_APISIX_VERSION), "3.1.0-centos")
-	TARGET_APISIX_VERSION = "2.15.0-alpine"
-endif
+
+ifeq ($(APISIX_ADMIN_API_VERSION),"v2")
+    TARGET_APISIX_VERSION ?= "2.15.3-centos"
 endif
 
 RELEASE_SRC = apache-apisix-ingress-controller-${VERSION}-src