Optimize building pytest image workflow (#6928)

Signed-off-by: quicksilver <zhifeng.zhang@zilliz.com>
This commit is contained in:
quicksilver 2021-08-01 16:14:25 +08:00 committed by GitHub
parent 8133bfc4cf
commit 2faa7d0376
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 7 deletions

2
.env
View File

@ -2,7 +2,7 @@ IMAGE_REPO=milvusdb
IMAGE_ARCH=amd64
OS_NAME=ubuntu18.04
DATE_VERSION=20210715
LATEST_DATE_VERSION=latest
LATEST_DATE_VERSION=20210715
MINIO_ADDRESS=minio:9000
PULSAR_ADDRESS=pulsar://pulsar:6650
ETCD_ENDPOINTS=etcd:2379

View File

@ -36,12 +36,13 @@ jobs:
- name: Docker Pull
shell: bash
run: |
DATE_VERSION=latest docker-compose pull --ignore-pull-failures builder
docker-compose pull --ignore-pull-failures builder
- name: Docker Build
shell: bash
run: |
DATE_VERSION=latest docker-compose build builder
DATE_VERSION=${{ steps.extracter.outputs.version }} docker-compose build builder
export LATEST_DATE_VERSION=${{ steps.extracter.outputs.version }}
DATE_VERSION=latest docker-compose build builder
- name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
continue-on-error: true
@ -49,14 +50,15 @@ jobs:
run: |
docker login -u ${{ secrets.DOCKERHUB_USER }} \
-p ${{ secrets.DOCKERHUB_TOKEN }}
DATE_VERSION=latest docker-compose push builder
DATE_VERSION=${{ steps.extracter.outputs.version }} docker-compose push builder
DATE_VERSION=latest docker-compose push builder
- name: Update Builder Image Changes
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
continue-on-error: true
shell: bash
run: |
sed -i "s#^DATE_VERSION=.*#DATE_VERSION=${{ steps.extracter.outputs.version }}#g" .env
sed -i "s#^LATEST_DATE_VERSION=.*#LATEST_DATE_VERSION=${{ steps.extracter.outputs.version }}#g" .env
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .env

View File

@ -35,13 +35,13 @@ jobs:
shell: bash
working-directory: tests/docker
run: |
IMAGE_TAG=latest docker-compose pull --ignore-pull-failures pytest
docker-compose pull --ignore-pull-failures pytest
- name: Docker Build
shell: bash
working-directory: tests/docker
run: |
docker-compose pull --ignore-pull-failures pytest
IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }} docker-compose build pytest
export LATEST_IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}
IMAGE_TAG=latest docker-compose build pytest
- name: Docker Push
if: success() && github.event_name == 'push' && github.repository == 'milvus-io/milvus'
@ -61,6 +61,7 @@ jobs:
working-directory: tests/docker
run: |
sed -i "s#^IMAGE_TAG=.*#IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}#g" .env
sed -i "s#^LATEST_IMAGE_TAG=.*#LATEST_IMAGE_TAG=${{ steps.extracter.outputs.version }}-${{ steps.extracter.outputs.sha_short }}#g" .env
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .env

View File

@ -4,3 +4,4 @@ MILVUS_PYTEST_WORKSPACE=/milvus/tests/python_test
MILVUS_PYTEST_LOG_PATH=/milvus/_artifacts/tests/pytest_logs
IMAGE_REPO=milvusdb
IMAGE_TAG=20210727-964af81
LATEST_IMAGE_TAG=20210727-964af81

View File

@ -7,7 +7,7 @@ services:
context: ../..
dockerfile: tests/docker/Dockerfile
cache_from:
- ${IMAGE_REPO}/pytest:latest
- ${IMAGE_REPO}/pytest:${LATEST_IMAGE_TAG}
shm_size: 2G
environment:
MILVUS_SERVICE_IP: ${MILVUS_SERVICE_IP}

View File

@ -55,6 +55,10 @@ fi
pushd "${ROOT}/tests/docker"
docker-compose pull --ignore-pull-failures pytest
if [[ -z "${SKIP_CHECK_PYTEST_ENV:-}" ]]; then
docker-compose build pytest
fi
if [[ "${TEST_ENV:-}" =~ ^kind* ]]; then
export PRE_EXIST_NETWORK="true"
export PYTEST_NETWORK="kind"