From eeced9b31c9291eee7bae329663576c1e0944fb2 Mon Sep 17 00:00:00 2001 From: "chen, suyue" Date: Thu, 17 Oct 2024 14:33:58 +0800 Subject: [PATCH] Enhance CI/CD image build (#961) Signed-off-by: chensuyue --- .github/workflows/_example-workflow.yml | 6 ++- .github/workflows/_manifest-e2e.yml | 8 +-- .github/workflows/manual-image-build.yml | 57 +++++++++++++++++++++ .github/workflows/pr-bum_list_check.yml | 50 ------------------ .github/workflows/push-image-build.yml | 6 +-- ChatQnA/tests/test_manifest_on_gaudi.sh | 15 ++---- ChatQnA/tests/test_manifest_on_xeon.sh | 15 ++---- CodeGen/tests/test_manifest_on_gaudi.sh | 15 ++---- CodeGen/tests/test_manifest_on_xeon.sh | 15 ++---- CodeTrans/tests/test_manifest_on_gaudi.sh | 15 ++---- CodeTrans/tests/test_manifest_on_xeon.sh | 15 ++---- DocSum/tests/test_manifest_on_gaudi.sh | 15 ++---- DocSum/tests/test_manifest_on_xeon.sh | 13 ++--- Translation/tests/test_manifest_on_gaudi.sh | 15 ++---- Translation/tests/test_manifest_on_xeon.sh | 15 ++---- 15 files changed, 114 insertions(+), 161 deletions(-) create mode 100644 .github/workflows/manual-image-build.yml delete mode 100644 .github/workflows/pr-bum_list_check.yml diff --git a/.github/workflows/_example-workflow.yml b/.github/workflows/_example-workflow.yml index adf17fa53..07e857d61 100644 --- a/.github/workflows/_example-workflow.yml +++ b/.github/workflows/_example-workflow.yml @@ -12,6 +12,10 @@ on: example: required: true type: string + services: + default: "" + required: false + type: string tag: default: "latest" required: false @@ -77,6 +81,7 @@ jobs: with: work_dir: ${{ github.workspace }}/${{ inputs.example }}/docker_image_build docker_compose_path: ${{ github.workspace }}/${{ inputs.example }}/docker_image_build/build.yaml + service_list: ${{ inputs.services }} registry: ${OPEA_IMAGE_REPO}opea tag: ${{ inputs.tag }} @@ -105,7 +110,6 @@ jobs: example: ${{ inputs.example }} hardware: ${{ inputs.node }} tag: ${{ inputs.tag }} - context: "CD" secrets: inherit #################################################################################################### diff --git a/.github/workflows/_manifest-e2e.yml b/.github/workflows/_manifest-e2e.yml index b0c61b1d9..69a080506 100644 --- a/.github/workflows/_manifest-e2e.yml +++ b/.github/workflows/_manifest-e2e.yml @@ -20,11 +20,6 @@ on: description: "Tag to apply to images, default is latest" required: false type: string - context: - default: "CI" - description: "CI or CD" - required: false - type: string jobs: manifest-test: @@ -51,7 +46,7 @@ jobs: - name: Set variables run: | - echo "IMAGE_REPO=$OPEA_IMAGE_REPO" >> $GITHUB_ENV + echo "IMAGE_REPO=${OPEA_IMAGE_REPO}opea" >> $GITHUB_ENV echo "IMAGE_TAG=${{ inputs.tag }}" >> $GITHUB_ENV lower_example=$(echo "${{ inputs.example }}" | tr '[:upper:]' '[:lower:]') echo "NAMESPACE=$lower_example-$(tr -dc a-z0-9 > $GITHUB_ENV @@ -60,7 +55,6 @@ jobs: echo "continue_test=true" >> $GITHUB_ENV echo "should_cleanup=false" >> $GITHUB_ENV echo "skip_validate=true" >> $GITHUB_ENV - echo "CONTEXT=${{ inputs.context }}" >> $GITHUB_ENV echo "NAMESPACE=$NAMESPACE" - name: Kubectl install diff --git a/.github/workflows/manual-image-build.yml b/.github/workflows/manual-image-build.yml new file mode 100644 index 000000000..4544fa57b --- /dev/null +++ b/.github/workflows/manual-image-build.yml @@ -0,0 +1,57 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Build specific images on manual event +on: + workflow_dispatch: + inputs: + nodes: + default: "gaudi,xeon" + description: "Hardware to run test" + required: true + type: string + example: + default: "ChatQnA" + description: 'Build images belong to which example?' + required: true + type: string + services: + default: "chatqna,chatqna-without-rerank" + description: 'Service list to build' + required: true + type: string + tag: + default: "latest" + description: "Tag to apply to images" + required: true + type: string + opea_branch: + default: "main" + description: 'OPEA branch for image build' + required: false + type: string +jobs: + get-test-matrix: + runs-on: ubuntu-latest + outputs: + nodes: ${{ steps.get-matrix.outputs.nodes }} + steps: + - name: Create Matrix + id: get-matrix + run: | + nodes=($(echo ${{ inputs.nodes }} | tr ',' ' ')) + nodes_json=$(printf '%s\n' "${nodes[@]}" | sort -u | jq -R '.' | jq -sc '.') + echo "nodes=$nodes_json" >> $GITHUB_OUTPUT + + image-build: + needs: job1 + strategy: + matrix: + node: ${{ fromJson(needs.get-test-matrix.outputs.nodes) }} + fail-fast: false + uses: ./.github/workflows/_example-workflow.yml + with: + node: ${{ matrix.node }} + example: ${{ inputs.example }} + services: ${{ inputs.services }} + secrets: inherit diff --git a/.github/workflows/pr-bum_list_check.yml b/.github/workflows/pr-bum_list_check.yml deleted file mode 100644 index 198de07af..000000000 --- a/.github/workflows/pr-bum_list_check.yml +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 2024 Intel Corporation -# SPDX-License-Identifier: Apache-2.0 - -name: Check Requirements - -on: [pull_request] - -jobs: - check-requirements: - runs-on: ubuntu-latest - steps: - - name: Checkout PR branch - uses: actions/checkout@v4 - - - name: Save PR requirements - run: | - find . -name "requirements.txt" -exec cat {} \; | \ - grep -v '^\s*#' | \ - grep -v '^\s*$' | \ - grep -v '^\s*-' | \ - sed 's/^\s*//' | \ - awk -F'[>=<]' '{print $1}' | \ - sort -u > pr-requirements.txt - cat pr-requirements.txt - - - name: Checkout main branch - uses: actions/checkout@v4 - with: - ref: main - path: main-branch - - - name: Save main branch requirements - run: | - find ./main-branch -name "requirements.txt" -exec cat {} \; | \ - grep -v '^\s*#' | \ - grep -v '^\s*$' | \ - grep -v '^\s*-' | \ - sed 's/^\s*//' | \ - awk -F'[>=<]' '{print $1}' | \ - sort -u > main-requirements.txt - cat main-requirements.txt - - - name: Compare requirements - run: | - comm -23 pr-requirements.txt main-requirements.txt > added-packages.txt - if [ -s added-packages.txt ]; then - echo "New packages found in PR:" && cat added-packages.txt - else - echo "No new packages found😊." - fi diff --git a/.github/workflows/push-image-build.yml b/.github/workflows/push-image-build.yml index 0481159d4..8afd2f614 100644 --- a/.github/workflows/push-image-build.yml +++ b/.github/workflows/push-image-build.yml @@ -23,12 +23,10 @@ jobs: image-build: needs: job1 strategy: - matrix: - example: ${{ fromJSON(needs.job1.outputs.run_matrix).include.*.example }} - node: ["gaudi","xeon"] + matrix: ${{ fromJSON(needs.job1.outputs.run_matrix) }} fail-fast: false uses: ./.github/workflows/_example-workflow.yml with: - node: ${{ matrix.node }} + node: ${{ matrix.hardware }} example: ${{ matrix.example }} secrets: inherit diff --git a/ChatQnA/tests/test_manifest_on_gaudi.sh b/ChatQnA/tests/test_manifest_on_gaudi.sh index a012981d7..2716efa4b 100755 --- a/ChatQnA/tests/test_manifest_on_gaudi.sh +++ b/ChatQnA/tests/test_manifest_on_gaudi.sh @@ -6,7 +6,7 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} ROLLOUT_TIMEOUT_SECONDS="1800s" @@ -15,15 +15,10 @@ KUBECTL_TIMEOUT_SECONDS="60s" function init_chatqna() { # replace the mount dir "path: /mnt/opea-models" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/chatqna:latest#image: \"opea/chatqna:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi - # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; + # replace the repository "image: opea/*" with "image: $IMAGE_REPO/" + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; } diff --git a/ChatQnA/tests/test_manifest_on_xeon.sh b/ChatQnA/tests/test_manifest_on_xeon.sh index fbdb25e16..d913421a6 100755 --- a/ChatQnA/tests/test_manifest_on_xeon.sh +++ b/ChatQnA/tests/test_manifest_on_xeon.sh @@ -6,7 +6,7 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} ROLLOUT_TIMEOUT_SECONDS="1800s" @@ -15,15 +15,10 @@ KUBECTL_TIMEOUT_SECONDS="60s" function init_chatqna() { # replace the mount dir "path: /mnt/opea-models" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/chatqna:latest#image: \"opea/chatqna:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi - # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; + # replace the repository "image: opea/*" with "image: $IMAGE_REPO/" + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; } diff --git a/CodeGen/tests/test_manifest_on_gaudi.sh b/CodeGen/tests/test_manifest_on_gaudi.sh index 5aa2b558c..596e77b7c 100755 --- a/CodeGen/tests/test_manifest_on_gaudi.sh +++ b/CodeGen/tests/test_manifest_on_gaudi.sh @@ -6,22 +6,17 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} function init_codegen() { # executed under path manifest/codegen/xeon # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/codegen:latest#image: \"opea/codegen:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi - # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; + # replace the repository "image: opea/*" with "image: $IMAGE_REPO/" + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; } diff --git a/CodeGen/tests/test_manifest_on_xeon.sh b/CodeGen/tests/test_manifest_on_xeon.sh index c6eea80ac..412978010 100755 --- a/CodeGen/tests/test_manifest_on_xeon.sh +++ b/CodeGen/tests/test_manifest_on_xeon.sh @@ -6,22 +6,17 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} function init_codegen() { # executed under path manifest/codegen/xeon # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/codegen:latest#image: \"opea/codegen:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi - # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; + # replace the repository "image: opea/*" with "image: $IMAGE_REPO/" + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; } diff --git a/CodeTrans/tests/test_manifest_on_gaudi.sh b/CodeTrans/tests/test_manifest_on_gaudi.sh index 1c1b02e96..1f4add5df 100755 --- a/CodeTrans/tests/test_manifest_on_gaudi.sh +++ b/CodeTrans/tests/test_manifest_on_gaudi.sh @@ -6,22 +6,17 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} function init_codetrans() { # executed under path manifest/codetrans/xeon # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/codetrans:latest#image: \"opea/codetrans:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi - # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; + # replace the repository "image: opea/*" with "image: $IMAGE_REPO/" + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; } diff --git a/CodeTrans/tests/test_manifest_on_xeon.sh b/CodeTrans/tests/test_manifest_on_xeon.sh index 6a8290ef0..e6fdeab1d 100755 --- a/CodeTrans/tests/test_manifest_on_xeon.sh +++ b/CodeTrans/tests/test_manifest_on_xeon.sh @@ -6,22 +6,17 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} function init_codetrans() { # executed under path manifest/codetrans/xeon # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/codetrans:latest#image: \"opea/codetrans:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi - # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; + # replace the repository "image: opea/*" with "image: $IMAGE_REPO/" + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; } diff --git a/DocSum/tests/test_manifest_on_gaudi.sh b/DocSum/tests/test_manifest_on_gaudi.sh index fd3d38a50..72fa4e47c 100755 --- a/DocSum/tests/test_manifest_on_gaudi.sh +++ b/DocSum/tests/test_manifest_on_gaudi.sh @@ -6,22 +6,17 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} function init_docsum() { # executed under path manifest/docsum/xeon # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/docsum:latest#image: \"opea/docsum:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi - # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; + # replace the repository "image: opea/*" with "image: $IMAGE_REPO/" + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; } diff --git a/DocSum/tests/test_manifest_on_xeon.sh b/DocSum/tests/test_manifest_on_xeon.sh index 8f218469c..115b28446 100755 --- a/DocSum/tests/test_manifest_on_xeon.sh +++ b/DocSum/tests/test_manifest_on_xeon.sh @@ -6,22 +6,17 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} function init_docsum() { # executed under path manifest/docsum/xeon # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/docsum:latest#image: \"opea/docsum:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; } diff --git a/Translation/tests/test_manifest_on_gaudi.sh b/Translation/tests/test_manifest_on_gaudi.sh index 6e4edbeb4..ea1f113cd 100755 --- a/Translation/tests/test_manifest_on_gaudi.sh +++ b/Translation/tests/test_manifest_on_gaudi.sh @@ -6,22 +6,17 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} function init_translation() { # executed under path manifest/translation/xeon # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/translation:latest#image: \"opea/translation:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi - # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; + # replace the repository "image: opea/*" with "image: $IMAGE_REPO/" + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; } diff --git a/Translation/tests/test_manifest_on_xeon.sh b/Translation/tests/test_manifest_on_xeon.sh index 34f04f5ab..d32eb4a22 100755 --- a/Translation/tests/test_manifest_on_xeon.sh +++ b/Translation/tests/test_manifest_on_xeon.sh @@ -6,22 +6,17 @@ set -xe USER_ID=$(whoami) LOG_PATH=/home/$(whoami)/logs MOUNT_DIR=/home/$USER_ID/.cache/huggingface/hub -IMAGE_REPO=${IMAGE_REPO:-} +IMAGE_REPO=${IMAGE_REPO:-opea} IMAGE_TAG=${IMAGE_TAG:-latest} function init_translation() { # executed under path manifest/translation/xeon # replace the mount dir "path: /mnt/model" with "path: $CHART_MOUNT" find . -name '*.yaml' -type f -exec sed -i "s#path: /mnt/opea-models#path: $MOUNT_DIR#g" {} \; - if [ $CONTEXT == "CI" ]; then - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/translation:latest#image: \"opea/translation:${IMAGE_TAG}#g" {} \; - else - # replace microservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; - fi - # replace the repository "image: opea/*" with "image: $IMAGE_REPO/opea/" - find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}opea/#g" {} \; + # replace microservice image tag + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/\(.*\):latest#image: \"opea/\1:${IMAGE_TAG}#g" {} \; + # replace the repository "image: opea/*" with "image: $IMAGE_REPO/" + find . -name '*.yaml' -type f -exec sed -i "s#image: \"opea/*#image: \"${IMAGE_REPO}/#g" {} \; # set huggingface token find . -name '*.yaml' -type f -exec sed -i "s#insert-your-huggingface-token-here#$(cat /home/$USER_ID/.cache/huggingface/token)#g" {} \; }