refactor translation ci test (#438)
Signed-off-by: chensuyue <suyue.chen@intel.com>
This commit is contained in:
@@ -47,7 +47,7 @@ Then run the command `docker images`, you will have the following four Docker Im
|
||||
|
||||
### Setup Environment Variables
|
||||
|
||||
Since the `docker_compose.yaml` will consume some environment variables, you need to setup them in advance as below.
|
||||
Since the `compose.yaml` will consume some environment variables, you need to setup them in advance as below.
|
||||
|
||||
```bash
|
||||
export http_proxy=${your_http_proxy}
|
||||
@@ -65,7 +65,7 @@ Note: Please replace with `host_ip` with you external IP address, do not use loc
|
||||
### Start Microservice Docker Containers
|
||||
|
||||
```bash
|
||||
docker compose -f docker_compose.yaml up -d
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### Validate Microservices
|
||||
|
||||
@@ -54,7 +54,7 @@ Then run the command `docker images`, you will have the following Docker Images:
|
||||
|
||||
### Setup Environment Variables
|
||||
|
||||
Since the `docker_compose.yaml` will consume some environment variables, you need to setup them in advance as below.
|
||||
Since the `compose.yaml` will consume some environment variables, you need to set up them in advance as below.
|
||||
|
||||
```bash
|
||||
export http_proxy=${your_http_proxy}
|
||||
@@ -72,7 +72,7 @@ Note: Please replace with `host_ip` with you external IP address, do not use loc
|
||||
### Start Microservice Docker Containers
|
||||
|
||||
```bash
|
||||
docker compose -f docker_compose.yaml up -d
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
### Validate Microservices
|
||||
|
||||
@@ -35,9 +35,18 @@ function start_services() {
|
||||
export LLM_SERVICE_HOST_IP=${ip_address}
|
||||
export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:8888/v1/translation"
|
||||
|
||||
if [[ "$IMAGE_REPO" != "" ]]; then
|
||||
# Replace the container name with a test-specific name
|
||||
echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG"
|
||||
sed -i "s#image: opea/translation:latest#image: opea/translation:${IMAGE_TAG}#g" compose.yaml
|
||||
sed -i "s#image: opea/translation-ui:latest#image: opea/translation-ui:${IMAGE_TAG}#g" compose.yaml
|
||||
sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" compose.yaml
|
||||
echo "cat compose.yaml"
|
||||
cat compose.yaml
|
||||
fi
|
||||
|
||||
# Start Docker Containers
|
||||
# TODO: Replace the container name with a test-specific name
|
||||
docker compose -f docker_compose.yaml up -d
|
||||
docker compose up -d
|
||||
|
||||
sleep 2m # Waits 2 minutes
|
||||
}
|
||||
@@ -130,18 +139,14 @@ function validate_frontend() {
|
||||
|
||||
function stop_docker() {
|
||||
cd $WORKPATH/docker/gaudi
|
||||
container_list=$(cat docker_compose.yaml | grep container_name | cut -d':' -f2)
|
||||
for container_name in $container_list; do
|
||||
cid=$(docker ps -aq --filter "name=$container_name")
|
||||
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi
|
||||
done
|
||||
docker compose down
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
||||
stop_docker
|
||||
|
||||
build_docker_images
|
||||
if [[ "$IMAGE_REPO" == "" ]]; then build_docker_images; fi
|
||||
start_services
|
||||
|
||||
validate_microservices
|
||||
|
||||
@@ -8,6 +8,20 @@ WORKPATH=$(dirname "$PWD")
|
||||
LOG_PATH="$WORKPATH/tests"
|
||||
ip_address=$(hostname -I | awk '{print $1}')
|
||||
|
||||
function build_docker_images() {
|
||||
cd $WORKPATH
|
||||
git clone https://github.com/opea-project/GenAIComps.git
|
||||
cd GenAIComps
|
||||
docker build --no-cache -t opea/llm-tgi:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/llms/text-generation/tgi/Dockerfile .
|
||||
|
||||
cd $WORKPATH/docker
|
||||
docker build --no-cache -t opea/translation:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile .
|
||||
|
||||
cd $WORKPATH/docker/ui
|
||||
docker build --no-cache -t opea/translation-ui:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f docker/Dockerfile .
|
||||
docker images
|
||||
}
|
||||
|
||||
function start_services() {
|
||||
cd $WORKPATH/docker/xeon
|
||||
|
||||
@@ -18,15 +32,18 @@ function start_services() {
|
||||
export LLM_SERVICE_HOST_IP=${ip_address}
|
||||
export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:8888/v1/translation"
|
||||
|
||||
# Replace the container name with a test-specific name
|
||||
echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG"
|
||||
sed -i "s#image: opea/translation:latest#image: opea/translation:${IMAGE_TAG}#g" docker_compose.yaml
|
||||
sed -i "s#image: opea/translation-ui:latest#image: opea/translation-ui:${IMAGE_TAG}#g" docker_compose.yaml
|
||||
sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" docker_compose.yaml
|
||||
if [[ "$IMAGE_REPO" != "" ]]; then
|
||||
# Replace the container name with a test-specific name
|
||||
echo "using image repository $IMAGE_REPO and image tag $IMAGE_TAG"
|
||||
sed -i "s#image: opea/translation:latest#image: opea/translation:${IMAGE_TAG}#g" compose.yaml
|
||||
sed -i "s#image: opea/translation-ui:latest#image: opea/translation-ui:${IMAGE_TAG}#g" compose.yaml
|
||||
sed -i "s#image: opea/*#image: ${IMAGE_REPO}opea/#g" compose.yaml
|
||||
echo "cat compose.yaml"
|
||||
cat compose.yaml
|
||||
fi
|
||||
|
||||
# Start Docker Containers
|
||||
# TODO: Replace the container name with a test-specific name
|
||||
docker compose -f docker_compose.yaml up -d
|
||||
docker compose up -d
|
||||
|
||||
sleep 2m # Waits 2 minutes
|
||||
}
|
||||
@@ -117,17 +134,14 @@ function validate_frontend() {
|
||||
|
||||
function stop_docker() {
|
||||
cd $WORKPATH/docker/xeon
|
||||
container_list=$(cat docker_compose.yaml | grep container_name | cut -d':' -f2)
|
||||
for container_name in $container_list; do
|
||||
cid=$(docker ps -aq --filter "name=$container_name")
|
||||
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi
|
||||
done
|
||||
docker compose down
|
||||
}
|
||||
|
||||
function main() {
|
||||
|
||||
stop_docker
|
||||
|
||||
if [[ "$IMAGE_REPO" == "" ]]; then build_docker_images; fi
|
||||
start_services
|
||||
|
||||
validate_microservices
|
||||
|
||||
Reference in New Issue
Block a user