Created
January 25, 2021 03:59
-
-
Save handlerww/2e97a48907e3252eb65e521a280b0715 to your computer and use it in GitHub Desktop.
TiDB Operator E2E improvement
This file contains hidden or 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
name: e2e | |
on: | |
push: | |
branches: | |
- e2e-playground-20 | |
workflow_dispatch: | |
# on: | |
# pull_request: | |
# branches: | |
# - master | |
# - release-* | |
jobs: | |
e2e-image-build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.13 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.13 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
path: go/src/github.com/${{ github.repository }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
go/src/github.com/${{ github.repository }}/go/pkg/mod | |
go/src/github.com/${{ github.repository }}/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build binary | |
run: | | |
make e2e-build | |
[ -d tests/images/e2e/tidb-operator ] && rm -r tests/images/e2e/tidb-operator || true | |
[ -d tests/images/e2e/tidb-cluster ] && rm -r tests/images/e2e/tidb-cluster || true | |
[ -d tests/images/e2e/tidb-backup ] && rm -r tests/images/e2e/tidb-backup || true | |
[ -d tests/images/e2e/manifests ] && rm -r tests/images/e2e/manifests || true | |
cp -r charts/tidb-operator tests/images/e2e | |
cp -r charts/tidb-cluster tests/images/e2e | |
cp -r charts/tidb-backup tests/images/e2e | |
cp -r charts/tidb-drainer tests/images/e2e | |
cp -r manifests tests/images/e2e | |
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/tests/images/e2e | |
file: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/tests/images/e2e/Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
ghcr.io/handlerww/tidb-operator/tidb-operator-e2e:${{ github.sha }} | |
operator-image-build: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Set up Go 1.13 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.13 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
path: go/src/github.com/${{ github.repository }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
go/src/github.com/${{ github.repository }}/go/pkg/mod | |
go/src/github.com/${{ github.repository }}/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Build binary | |
run: | | |
echo $GOCACHE | |
make build | |
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/images/tidb-backup-manager | |
file: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/images/tidb-backup-manager/Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
ghcr.io/handlerww/tidb-operator/tidb-backup-manager:${{ github.sha }} | |
- name: Build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/images/tidb-operator | |
file: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/images/tidb-operator/Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
ghcr.io/handlerww/tidb-operator/tidb-operator:${{ github.sha }} | |
- name: Get matrix jobs | |
id: set-matrix | |
# run: | | |
# echo "::set-output name=matrix::{\"include\":[{\"job\":\"TiCDC.should.finish.sink.job\"}]}" | |
# run: | | |
# echo "::set-output name=matrix::{\"include\":[{\"job\":\"when.deploy,.scale,.update.config.should.work.in.v3.1.1\"},{\"job\":\"when.stores.number.is.equal.to.3.forbid.to.scale.in.TiKV.and.the.state.of.all.stores.are.up\"},{\"job\":\"TiKV.should.mount.multiple.pvc\"},{\"job\":\"should.adopt.helm.created.pump.with.TidbCluster.CR\"},{\"job\":\"should.keep.tidb.service.in.sync\"},{\"job\":\"should.upgrade.TidbCluster.with.webhook.enabled\"},{\"job\":\"[Feature:.AutoFailover].should.clear.TiDB.failureMembers.when.scale.TiDB.to.zero\"},{\"job\":\"should.ensure.changing.TiDB.service.annotations.won't.change.TiDB.service.type.NodePort\"},{\"job\":\"[Feature:.AutoScaling].should.auto.scale.TiKV.pods\"},{\"job\":\"[Feature:.Heterogeneous.Cluster].should.join.heterogeneous.cluster.into.an.existing.cluster\"},{\"job\":\"should.manage.tidb.monitor.normally\"},{\"job\":\"can.be.paused.and.resumed\"},{\"job\":\"should.switch.between.pod.network.and.host.network\"},{\"job\":\"should.backup.and.restore.TiDB.Cluster\"},{\"job\":\"TiCDC.should.finish.sink.job\"},{\"job\":\"when.deploy,.scale,.update.config.should.work.in.v4.0.4\"},{\"job\":\"should.migrate.from.helm.to.CR\"},{\"job\":\"[Feature:.TLS].should.enable.TLS.for.MySQL.Client.and.between.Heterogeneous.TiDB.components\"},{\"job\":\"[Feature:.AutoScaling].should.auto.scale.TiDB.pods\"},{\"job\":\"[Feature:.TLS].should.enable.TLS.for.MySQL.Client.and.between.TiDB.components\"},{\"job\":\"Up.–.tidb-operator\"},{\"job\":\"DumpClusterLogs.–.tidb-operator\"},{\"job\":\"Down.–.tidb-operator\"}]}" | |
# run: | | |
# echo "::set-output name=matrix::{\"include\":[{\"job\":\"should.backup.and.restore.TiDB.Cluster\"},{\"job\":\"should.migrate.from.helm.to.CR\"},{\"job\":\"should.upgrade.TidbCluster.with.webhook.enabled\"},{\"job\":\"should.keep.tidb.service.in.sync\"}]}" | |
run: | | |
echo "::set-output name=matrix::{\"include\":[{\"job\":\"should.switch.between.pod.network.and.host.network\"}]}" | |
e2e-cases: | |
needs: ["operator-image-build", "e2e-image-build"] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.operator-image-build.outputs.matrix)}} | |
steps: | |
- name: Set up Go 1.13 | |
uses: actions/setup-go@v1 | |
with: | |
go-version: 1.13 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
path: go/src/github.com/${{ github.repository }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.CR_PAT }} | |
- name: Creating kind cluster | |
run: | | |
SKIP_DOWN=y SKIP_BUILD=y SKIP_IMAGE_BUILD=y SKIP_TEST=y KUBE_WORKERS=0 ./hack/e2e.sh | |
echo "info: waiting for all nodes to be ready" | |
kubectl wait --for=condition=Ready nodes --all --timeout=120s | |
echo "info: waiting for all pods in kube-system namespace to be ready" | |
kubectl -n kube-system wait --for=condition=Ready pods --all | |
echo "info: print cluster information" | |
kubectl get nodes | |
kubectl get pods -n kube-system | |
helm version | |
kubectl version | |
echo "info: create pingcap namespace for configurations" | |
kubectl create ns pingcap | |
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} | |
- name: continue tmate | |
run: | | |
sudo touch /continue | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
- name: e2e(${{ matrix.job }}) | |
# continue-on-error: true2 | |
run: | | |
SKIP_BUILD=y SKIP_IMAGE_BUILD=y SKIP_UP=y DOCKER_REPO=ghcr.io/handlerww/tidb-operator IMAGE_TAG=${{ github.sha }} ./hack/e2e.sh -- --ginkgo.focus="${{ matrix.job }}" | |
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} | |
# e2e-clean-images: | |
# if: always() | |
# needs: ["e2e-cases"] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Login to GitHub Container Registry | |
# uses: docker/login-action@v1 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.repository_owner }} | |
# password: ${{ secrets.CR_PAT }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment