From 71363a6b9df60d0fe92ca5117a70c98598e7167e Mon Sep 17 00:00:00 2001 From: Ying Chun Guo Date: Fri, 16 Aug 2024 21:57:28 +0800 Subject: [PATCH] change microservice tags in CD workflow (#612) Signed-off-by: Yingchun Guo --- .github/workflows/_example-workflow.yml | 1 + .github/workflows/_manifest-e2e.yml | 6 ++++++ ChatQnA/tests/test_manifest_on_gaudi.sh | 9 +++++++-- ChatQnA/tests/test_manifest_on_xeon.sh | 9 +++++++-- CodeGen/tests/test_manifest_on_gaudi.sh | 9 +++++++-- CodeGen/tests/test_manifest_on_xeon.sh | 9 +++++++-- CodeTrans/tests/test_manifest_on_gaudi.sh | 9 +++++++-- CodeTrans/tests/test_manifest_on_xeon.sh | 9 +++++++-- DocSum/tests/test_manifest_on_gaudi.sh | 9 +++++++-- DocSum/tests/test_manifest_on_xeon.sh | 9 +++++++-- 10 files changed, 63 insertions(+), 16 deletions(-) diff --git a/.github/workflows/_example-workflow.yml b/.github/workflows/_example-workflow.yml index fc9b74668..f28426805 100644 --- a/.github/workflows/_example-workflow.yml +++ b/.github/workflows/_example-workflow.yml @@ -146,4 +146,5 @@ 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 d8127ae5a..5ada482e0 100644 --- a/.github/workflows/_manifest-e2e.yml +++ b/.github/workflows/_manifest-e2e.yml @@ -20,6 +20,11 @@ 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: @@ -55,6 +60,7 @@ 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/ChatQnA/tests/test_manifest_on_gaudi.sh b/ChatQnA/tests/test_manifest_on_gaudi.sh index 12a5a6feb..ca7c55794 100755 --- a/ChatQnA/tests/test_manifest_on_gaudi.sh +++ b/ChatQnA/tests/test_manifest_on_gaudi.sh @@ -12,8 +12,13 @@ IMAGE_TAG=${IMAGE_TAG:-latest} 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" {} \; - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/chatqna:latest#image: opea/chatqna:${IMAGE_TAG}#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" {} \; # set huggingface token diff --git a/ChatQnA/tests/test_manifest_on_xeon.sh b/ChatQnA/tests/test_manifest_on_xeon.sh index b33337b8a..c755f36e6 100755 --- a/ChatQnA/tests/test_manifest_on_xeon.sh +++ b/ChatQnA/tests/test_manifest_on_xeon.sh @@ -12,8 +12,13 @@ IMAGE_TAG=${IMAGE_TAG:-latest} 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" {} \; - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/chatqna:latest#image: opea/chatqna:${IMAGE_TAG}#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" {} \; # set huggingface token diff --git a/CodeGen/tests/test_manifest_on_gaudi.sh b/CodeGen/tests/test_manifest_on_gaudi.sh index 84fe53e4e..c251768b7 100755 --- a/CodeGen/tests/test_manifest_on_gaudi.sh +++ b/CodeGen/tests/test_manifest_on_gaudi.sh @@ -13,8 +13,13 @@ 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" {} \; - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/codegen:latest#image: opea/codegen:${IMAGE_TAG}#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" {} \; # set huggingface token diff --git a/CodeGen/tests/test_manifest_on_xeon.sh b/CodeGen/tests/test_manifest_on_xeon.sh index 46724742d..597b7e036 100755 --- a/CodeGen/tests/test_manifest_on_xeon.sh +++ b/CodeGen/tests/test_manifest_on_xeon.sh @@ -13,8 +13,13 @@ 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" {} \; - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/codegen:latest#image: opea/codegen:${IMAGE_TAG}#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" {} \; # set huggingface token diff --git a/CodeTrans/tests/test_manifest_on_gaudi.sh b/CodeTrans/tests/test_manifest_on_gaudi.sh index 2a9f9846b..e4bbafe77 100755 --- a/CodeTrans/tests/test_manifest_on_gaudi.sh +++ b/CodeTrans/tests/test_manifest_on_gaudi.sh @@ -13,8 +13,13 @@ 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" {} \; - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/codetrans:latest#image: opea/codetrans:${IMAGE_TAG}#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" {} \; # set huggingface token diff --git a/CodeTrans/tests/test_manifest_on_xeon.sh b/CodeTrans/tests/test_manifest_on_xeon.sh index a9f40984e..d21d3bd6a 100755 --- a/CodeTrans/tests/test_manifest_on_xeon.sh +++ b/CodeTrans/tests/test_manifest_on_xeon.sh @@ -13,8 +13,13 @@ 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" {} \; - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/codetrans:latest#image: opea/codetrans:${IMAGE_TAG}#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" {} \; # set huggingface token diff --git a/DocSum/tests/test_manifest_on_gaudi.sh b/DocSum/tests/test_manifest_on_gaudi.sh index 5a8a9c8f2..f58aa2c0d 100755 --- a/DocSum/tests/test_manifest_on_gaudi.sh +++ b/DocSum/tests/test_manifest_on_gaudi.sh @@ -13,8 +13,13 @@ 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" {} \; - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/docsum:latest#image: opea/docsum:${IMAGE_TAG}#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" {} \; # set huggingface token diff --git a/DocSum/tests/test_manifest_on_xeon.sh b/DocSum/tests/test_manifest_on_xeon.sh index 4a52661ea..f9a01d5dd 100755 --- a/DocSum/tests/test_manifest_on_xeon.sh +++ b/DocSum/tests/test_manifest_on_xeon.sh @@ -13,8 +13,13 @@ 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" {} \; - # replace megaservice image tag - find . -name '*.yaml' -type f -exec sed -i "s#image: opea/docsum:latest#image: opea/docsum:${IMAGE_TAG}#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" {} \; # set huggingface token