diff --git a/.github/workflows/publish-builder.yaml b/.github/workflows/publish-builder.yaml index d700af6b6a..812aced6d5 100644 --- a/.github/workflows/publish-builder.yaml +++ b/.github/workflows/publish-builder.yaml @@ -6,12 +6,12 @@ on: push: # file paths to consider in the event. Optional; defaults to all. paths: - - 'build/docker/**' + - 'build/docker/env/**' - '.github/workflows/publish-builder.yaml' pull_request: # file paths to consider in the event. Optional; defaults to all. paths: - - 'build/docker/**' + - 'build/docker/env/**' - '.github/workflows/publish-builder.yaml' jobs: diff --git a/.jenkins/modules/Publish/Publish.groovy b/.jenkins/modules/Publish/Publish.groovy index 06d18d906c..f504d3dd5d 100644 --- a/.jenkins/modules/Publish/Publish.groovy +++ b/.jenkins/modules/Publish/Publish.groovy @@ -12,12 +12,15 @@ dir ('build/docker/deploy') { try { withCredentials([usernamePassword(credentialsId: "${env.DOCKER_CREDENTIALS_ID}", usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) { sh 'docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} ${DOKCER_REGISTRY_URL}' + sh 'docker pull ${SOURCE_REPO}/master:${SOURCE_TAG} || true' sh 'docker-compose build --force-rm master' sh 'docker-compose push master' + sh 'docker pull ${SOURCE_REPO}/proxy:${SOURCE_TAG} || true' sh 'docker-compose build --force-rm proxy' sh 'docker-compose push proxy' + sh 'docker pull ${SOURCE_REPO}/querynode:${SOURCE_TAG} || true' sh 'docker-compose build --force-rm querynode' sh 'docker-compose push querynode' diff --git a/.jenkins/modules/Regression/PythonRegression.groovy b/.jenkins/modules/Regression/PythonRegression.groovy new file mode 100644 index 0000000000..56d7aa2843 --- /dev/null +++ b/.jenkins/modules/Regression/PythonRegression.groovy @@ -0,0 +1,37 @@ +try { + + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} up -d etcd' + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} up -d pulsar' + dir ('build/docker/deploy') { + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} pull' + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} up -d' + } + + dir ('build/docker/test') { + sh 'docker pull ${SOURCE_REPO}/pytest:${SOURCE_TAG} || true' + sh 'docker-compose build --force-rm regression' + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} run --rm regression || true' + try { + withCredentials([usernamePassword(credentialsId: "${env.DOCKER_CREDENTIALS_ID}", usernameVariable: 'DOCKER_USERNAME', passwordVariable: 'DOCKER_PASSWORD')]) { + sh 'docker login -u ${DOCKER_USERNAME} -p ${DOCKER_PASSWORD} ${DOKCER_REGISTRY_URL}' + sh 'docker-compose push regression' + } + } catch (exc) { + throw exc + } finally { + sh 'docker logout ${DOKCER_REGISTRY_URL}' + } + } +} catch(exc) { + throw exc +} finally { + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} rm -f -s -v pulsar' + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} rm -f -s -v etcd' + dir ('build/docker/deploy') { + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} down --rmi all -v || true' + } + dir ('build/docker/test') { + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} run --rm regression /bin/bash -c "rm -rf __pycache__ && rm -rf .pytest_cache"' + sh 'docker-compose -p ${DOCKER_COMPOSE_PROJECT_NAME} down --rmi all -v || true' + } +} diff --git a/build/ci/jenkins/Jenkinsfile b/build/ci/jenkins/Jenkinsfile index 679a2f27ac..17c3ce39a7 100644 --- a/build/ci/jenkins/Jenkinsfile +++ b/build/ci/jenkins/Jenkinsfile @@ -18,6 +18,11 @@ pipeline { PACKAGE_ARTFACTORY_URL = "${JFROG_ARTFACTORY_URL}/${PROJECT_NAME}/package/${PACKAGE_NAME}" DOCKER_CREDENTIALS_ID = "ba070c98-c8cc-4f7c-b657-897715f359fc" DOKCER_REGISTRY_URL = "registry.zilliz.com" + SOURCE_REPO = "${DOKCER_REGISTRY_URL}/milvus-distributed" + TARGET_REPO = "${DOKCER_REGISTRY_URL}/milvus-distributed" + SOURCE_TAG = "${CHANGE_TARGET ? CHANGE_TARGET : SEMVER}-${LOWER_BUILD_TYPE}" + TARGET_TAG = "${SEMVER}-${LOWER_BUILD_TYPE}" + DOCKER_BUILDKIT = 1 } stages { stage ('Build and UnitTest') { @@ -51,18 +56,28 @@ pipeline { yamlFile "build/ci/jenkins/pod/docker-pod.yaml" } } - environment{ - SOURCE_REPO = "${DOKCER_REGISTRY_URL}/milvus-distributed" - TARGET_REPO = "${DOKCER_REGISTRY_URL}/milvus-distributed" - SOURCE_TAG = "${CHANGE_TARGET ? CHANGE_TARGET : SEMVER}-${LOWER_BUILD_TYPE}" - TARGET_TAG = "${SEMVER}-${LOWER_BUILD_TYPE}" - DOCKER_BUILDKIT = 1 - } steps { container('publish-images') { MPLModule('Publish') } } } + + stage ('Dev Test') { + agent { + label "performance" + } + environment { + DOCKER_COMPOSE_PROJECT_NAME = "${PROJECT_NAME}-${SEMVER}-${env.BUILD_NUMBER}".replaceAll("\\.", "-").replaceAll("_", "-") + } + steps { + MPLModule('Python Regression') + } + post { + cleanup { + deleteDir() /* clean up our workspace */ + } + } + } } } diff --git a/build/docker/deploy/docker-compose.yml b/build/docker/deploy/docker-compose.yml index e8b5044ebc..01d050c0a4 100644 --- a/build/docker/deploy/docker-compose.yml +++ b/build/docker/deploy/docker-compose.yml @@ -13,8 +13,6 @@ services: ETCD_ADDRESS: ${ETCD_ADDRESS} networks: - milvus - ports: - - "53100:53100" proxy: image: ${TARGET_REPO}/proxy:${TARGET_TAG} @@ -26,8 +24,6 @@ services: environment: PULSAR_ADDRESS: ${PULSAR_ADDRESS} MASTER_ADDRESS: ${MASTER_ADDRESS} - ports: - - "19530:19530" networks: - milvus diff --git a/build/docker/test/Dockerfile b/build/docker/test/Dockerfile new file mode 100644 index 0000000000..36bdeadf54 --- /dev/null +++ b/build/docker/test/Dockerfile @@ -0,0 +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 + +COPY ./tests/python/requirements.txt /requirements.txt + +RUN python3 -m pip install -r /requirements.txt + +CMD ["tail", "-f", "/dev/null"] diff --git a/build/docker/test/docker-compose.yml b/build/docker/test/docker-compose.yml new file mode 100644 index 0000000000..24c4fafe87 --- /dev/null +++ b/build/docker/test/docker-compose.yml @@ -0,0 +1,20 @@ +version: '3.5' + +services: + regression: + 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" + command: > + /bin/bash -c "pytest --ip proxy" + networks: + - milvus + +networks: + milvus: diff --git a/docker-compose.yml b/docker-compose.yml index ca58279960..a1b1edc8c2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,16 +59,12 @@ services: etcd: image: quay.io/coreos/etcd:v3.4.13 command: etcd -advertise-client-urls=http://127.0.0.1:2379 -listen-client-urls http://0.0.0.0:2379 - ports: - - "2379:2379" networks: - milvus pulsar: image: apachepulsar/pulsar:2.6.1 command: bin/pulsar standalone - ports: - - "6650:6650" networks: - milvus