Optimize regression workflow

Signed-off-by: quicksilver <zhifeng.zhang@zilliz.com>
This commit is contained in:
quicksilver 2021-03-11 18:34:26 +08:00 committed by yefu.chen
parent 5610a021fb
commit ddb37fe498
10 changed files with 27 additions and 108 deletions

View File

@ -6,12 +6,14 @@ on:
push: push:
# file paths to consider in the event. Optional; defaults to all. # file paths to consider in the event. Optional; defaults to all.
paths: paths:
- 'build/docker/test/**' - 'build/docker/test/Dockerfile'
- 'tests/python_test/requirements.txt'
- '.github/workflows/publish-test-images.yaml' - '.github/workflows/publish-test-images.yaml'
pull_request: pull_request:
# file paths to consider in the event. Optional; defaults to all. # file paths to consider in the event. Optional; defaults to all.
paths: paths:
- 'build/docker/test/**' - 'build/docker/test/Dockerfile'
- 'tests/python_test/requirements.txt'
- '.github/workflows/publish-test-images.yaml' - '.github/workflows/publish-test-images.yaml'
jobs: jobs:
@ -33,24 +35,19 @@ jobs:
run: | run: |
echo "::set-output name=version::$(date +%Y%m%d)" echo "::set-output name=version::$(date +%Y%m%d)"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Docker Pull
shell: bash
working-directory: build/docker/test
run: |
docker-compose pull --ignore-pull-failures regression_standalone
- name: Docker Build - name: Docker Build
shell: bash shell: bash
working-directory: build/docker/test working-directory: tests/python_test
run: | run: |
TARGET_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker-compose build regression_standalone docker build -t milvusdb/pytest:${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} .
TARGET_TAG=latest docker-compose build regression_standalone docker tag milvusdb/pytest:${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} milvusdb/pytest:latest
- name: Docker Push - name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'zilliztech/milvus-distributed' if: success() && github.event_name == 'push' && github.repository == 'zilliztech/milvus-distributed'
continue-on-error: true continue-on-error: true
shell: bash shell: bash
working-directory: build/docker/test
run: | run: |
docker login -u ${{ secrets.DOCKERHUB_USER }} \ docker login -u ${{ secrets.DOCKERHUB_USER }} \
-p ${{ secrets.DOCKERHUB_TOKEN }} -p ${{ secrets.DOCKERHUB_TOKEN }}
TARGET_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker-compose push regression_standalone docker push milvusdb/pytest:${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}
TARGET_TAG=latest docker-compose push regression_standalone docker push milvusdb/pytest:latest
echo "Push milvusdb/pytest:${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} Succeeded"

View File

@ -48,6 +48,7 @@ timeout(time: 60, unit: 'MINUTES') {
container('test-env') { container('test-env') {
try { try {
dir ('tests/python_test') { dir ('tests/python_test') {
sh "python3 -m pip install --no-cache-dir pymilvus-distributed==${env.PYMILVUS_VERSION}"
sh "pytest --tags=0331 --ip ${env.HELM_RELEASE_NAME}-milvus-ha.${env.HELM_RELEASE_NAMESPACE}.svc.cluster.local" sh "pytest --tags=0331 --ip ${env.HELM_RELEASE_NAME}-milvus-ha.${env.HELM_RELEASE_NAMESPACE}.svc.cluster.local"
} }
} catch (exc) { } catch (exc) {

View File

@ -84,6 +84,7 @@ pipeline {
} }
environment { environment {
HELM_BRANCH = "main" HELM_BRANCH = "main"
PYMILVUS_VERSION = "0.0.42"
HELM_RELEASE_NAMESPACE = "dev" HELM_RELEASE_NAMESPACE = "dev"
HELM_RELEASE_NAME = "${PROJECT_NAME}-${SEMVER}-${env.BUILD_NUMBER}-${REGRESSION_SERVICE_TYPE}".replaceAll("\\.", "-").replaceAll("_", "-").toLowerCase() HELM_RELEASE_NAME = "${PROJECT_NAME}-${SEMVER}-${env.BUILD_NUMBER}-${REGRESSION_SERVICE_TYPE}".replaceAll("\\.", "-").replaceAll("_", "-").toLowerCase()
DEV_TEST_ARTIFACTS_PATH = "artifacts" DEV_TEST_ARTIFACTS_PATH = "artifacts"

View File

@ -7,7 +7,7 @@ metadata:
spec: spec:
containers: containers:
- name: test-env - name: test-env
image: milvusdb/pytest:20210311-2afcc45 image: milvusdb/pytest:20210311-bfdffdd
command: command:
- cat - cat
tty: true tty: true

View File

@ -1,4 +0,0 @@
SOURCE_REPO=milvusdb
TARGET_REPO=milvusdb
SOURCE_TAG=20210311-2afcc45
TARGET_TAG=20210311-2afcc45

View File

@ -1,18 +0,0 @@
# Copyright (C) 2019-2020 Zilliz. All rights reserved.
#
# 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.
FROM python:3.6.8-jessie
COPY ./tests/python_test/requirements.txt /requirements.txt
RUN python3 -m pip install --no-cache-dir -r /requirements.txt
CMD ["tail", "-f", "/dev/null"]

View File

@ -1,35 +0,0 @@
version: '3.5'
services:
regression_distributed:
image: ${TARGET_REPO}/pytest:${TARGET_TAG}
build:
context: ../../../
dockerfile: build/docker/test/Dockerfile
cache_from:
- ${SOURCE_REPO}/pytest:${SOURCE_TAG}
volumes:
- ../../..:/milvus-distributed:delegated
working_dir: "/milvus-distributed/tests/python_test"
command: >
/bin/bash -c "sleep 10s && pytest --tags=0331 --reruns=1 --ip proxynode"
networks:
- milvus
regression_standalone:
image: ${TARGET_REPO}/pytest:${TARGET_TAG}
build:
context: ../../../
dockerfile: build/docker/test/Dockerfile
cache_from:
- ${SOURCE_REPO}/pytest:${SOURCE_TAG}
volumes:
- ../../..:/milvus-distributed:delegated
working_dir: "/milvus-distributed/tests/python_test"
command: >
/bin/bash -c "sleep 10s && pytest --tags=0331 --reruns=1 --ip standalone"
networks:
- milvus
networks:
milvus:

View File

@ -1,15 +1,18 @@
# Copyright (C) 2019-2020 Zilliz. All rights reserved.
#
# 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.
FROM python:3.6.8-jessie FROM python:3.6.8-jessie
LABEL Name=megasearch_engine_test Version=0.0.1 COPY ./requirements.txt /requirements.txt
WORKDIR /app RUN python3 -m pip install --no-cache-dir -r /requirements.txt
COPY . /app
RUN apt-get update && apt-get install -y --no-install-recommends \ CMD ["tail", "-f", "/dev/null"]
libc-dev build-essential && \
python3 -m pip install -r requirements.txt && \
apt-get remove --purge -y && \
rm -rf /var/lib/apt/lists/*
ENTRYPOINT [ "/app/docker-entrypoint.sh" ]
CMD [ "start" ]

View File

@ -2,7 +2,6 @@ grpcio==1.26.0
grpcio-tools==1.26.0 grpcio-tools==1.26.0
numpy==1.18.1 numpy==1.18.1
pytest-cov==2.8.1 pytest-cov==2.8.1
pymilvus-distributed==0.0.42
sklearn==0.0 sklearn==0.0
pytest==6.2.2 pytest==6.2.2
pytest-timeout==1.3.3 pytest-timeout==1.3.3

View File

@ -1,25 +0,0 @@
astroid==2.2.5
atomicwrites==1.3.0
attrs==19.1.0
importlib-metadata==0.15
isort==4.3.20
lazy-object-proxy==1.4.1
mccabe==0.6.1
more-itertools==7.0.0
numpy==1.16.3
pluggy==0.12.0
py==1.8.0
pylint==2.5.0
pytest==4.5.0
pytest-timeout==1.3.3
pytest-repeat==0.8.0
allure-pytest==2.7.0
pytest-print==0.1.2
pytest-level==0.1.1
six==1.12.0
thrift==0.11.0
typed-ast==1.3.5
wcwidth==0.1.7
wrapt==1.11.1
zipp==0.5.1
pymilvus>=0.2.0