From a17db602c393c6920f9eb060ee20ef06ad10fcf9 Mon Sep 17 00:00:00 2001 From: zepan Date: Mon, 29 Jul 2024 19:04:56 +0800 Subject: [PATCH 1/3] Check url of docker image list. Signed-off-by: zepan --- .github/workflows/images_path_detection.yml | 54 +++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/images_path_detection.yml diff --git a/.github/workflows/images_path_detection.yml b/.github/workflows/images_path_detection.yml new file mode 100644 index 000000000..0252bff1b --- /dev/null +++ b/.github/workflows/images_path_detection.yml @@ -0,0 +1,54 @@ +# Copyright (C) 2024 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +name: Check for missing Dockerfile paths in repo comps + +on: + pull_request: + branches: [main] + types: [opened, reopened, ready_for_review, synchronize] + +jobs: + check-dockerfile-paths: + runs-on: ubuntu-latest + + steps: + - name: Clean Up Working Directory + run: sudo rm -rf ${{github.workspace}}/* + + - name: Checkout repo GenAIExamples + uses: actions/checkout@v4 + + - name: Clone repo GenAIComps + run: | + cd .. + git clone https://github.com/opea-project/GenAIComps.git + + - name: Check for missing Dockerfile paths in GenAIComps + run: | + cd ${{github.workspace}} + miss="FALSE" + while IFS=: read -r line link; do + http_status=$(curl -o /dev/null -s -w "%{http_code}" "$link") + if [ "$http_status" -eq 200 ]; then + echo "Valid link: $link (Line $line)" + else + echo "Broken link: $link (Line $line) (Status $http_status) " + echo "-----------------retry strat----------------------" + retry_http_status=$(curl -o /dev/null -s -w "%{http_code}" "$link") + if [ "$retry_http_status" -eq 200 ]; then + miss="FALSE" + echo "Valid link: $link (Line $line)" + echo "---------------Retry is valid---------------------" + else + miss="TRUE" + echo "Retry broken link: $link (Line $line) (Status $http_status) " + echo "-------------Retry is not valid-------------------" + fi + fi + done < <(grep -n -oP '(?<=a href=")[^"]*(?=">)' ../../docker_images_list.md) + + if [[ "$miss" == "TRUE" ]]; then + exit 1 + fi + shell: bash From 3f363ad0354c73c7aa7ec1161bdf0987cc9633c0 Mon Sep 17 00:00:00 2001 From: zepan Date: Wed, 31 Jul 2024 17:45:30 +0800 Subject: [PATCH 2/3] Change workflow name and trigger method. Signed-off-by: zepan --- .github/workflows/images_path_detection.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/images_path_detection.yml b/.github/workflows/images_path_detection.yml index 0252bff1b..b94a9b980 100644 --- a/.github/workflows/images_path_detection.yml +++ b/.github/workflows/images_path_detection.yml @@ -1,10 +1,10 @@ # Copyright (C) 2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 -name: Check for missing Dockerfile paths in repo comps +name: Check the validity of links in docker_images_list. on: - pull_request: + push: branches: [main] types: [opened, reopened, ready_for_review, synchronize] From c36df85071d87bf5a51627c0f3f330e4eb209c0d Mon Sep 17 00:00:00 2001 From: zepan Date: Wed, 31 Jul 2024 18:44:14 +0800 Subject: [PATCH 3/3] Remove invalid code. Signed-off-by: zepan --- .github/workflows/images_path_detection.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/images_path_detection.yml b/.github/workflows/images_path_detection.yml index b94a9b980..299ee4d18 100644 --- a/.github/workflows/images_path_detection.yml +++ b/.github/workflows/images_path_detection.yml @@ -19,12 +19,7 @@ jobs: - name: Checkout repo GenAIExamples uses: actions/checkout@v4 - - name: Clone repo GenAIComps - run: | - cd .. - git clone https://github.com/opea-project/GenAIComps.git - - - name: Check for missing Dockerfile paths in GenAIComps + - name: Check the validity of links run: | cd ${{github.workspace}} miss="FALSE"