From a9a1d2cfb150aef44e020048b48a9c32759c2851 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 17:16:20 +0800 Subject: [PATCH 01/40] update ci and status sh --- .github/workflows/simple-test.yml | 10 ++++++---- script/get-CI-result.sh | 31 ++++++++++++++++++++++++++++++- script/trigger-CI.sh | 12 +++++++++--- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/.github/workflows/simple-test.yml b/.github/workflows/simple-test.yml index f679a26..dd0d9bb 100644 --- a/.github/workflows/simple-test.yml +++ b/.github/workflows/simple-test.yml @@ -34,12 +34,14 @@ jobs: # Runs trigger CI - name: Make the script files executable - run: chmod +x trigger-CI.sh get-CI-result.sh + run: chmod +x trigger-CI.sh - name: trigger a CI run: | - curl -v -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.CI_SECRET }}" -d '{"commitId":"${{ github.sha }}","repositoryUrl":"https://github.com/alibaba/rtp-llm.git","taskId":"9180024","type":"CREATE-TASK"}' "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run" + ./trigger-CI.sh "${{ github.sha }}" "${{ secrets.CI_SECRET }}" +# curl -v -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.CI_SECRET }}" -d '{"commitId":"${{ github.sha }}","repositoryUrl":"https://github.com/alibaba/rtp-llm.git","taskId":"9180024","type":"CREATE-TASK"}' "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run" # Runs get CI result - - name: get a CI result + - name: Get CI result run: | - ./get-CI-result.sh ${{ steps.script-output.outputs.result }} + chmod +x get-CI-result.sh + ./get-CI-result.sh "${{ github.sha }}" "${{ secrets.CI_SECRET }}" \ No newline at end of file diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 8997733..18b0a48 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -1,3 +1,32 @@ #!/bin/bash -echo "hello world" +# 检查参数 +if [ $# -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +COMMIT_ID=$1 +SECURITY=$2 + +QUERY_URL="https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run/query?commitId=${COMMIT_ID}" + +while true; do + echo "Querying CI status for commitId: ${COMMIT_ID} ..." + + response=${curl -s -H "Content-Type: application/json" \ + -H "Authorization: Basic ${SECURITY}" \ + -d "{\"commitId\": \"${COMMIT_ID}\"}" + "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run"} + # response=$(curl -s -H "Authorization: Basic ${SECURITY}" "${QUERY_URL}") + status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') + + echo "Current status: $status" + + if [[ "$status" == "DONE" || "$status" == "FAILED" || "$status" == "UNKNOWN" ]]; then + echo "CI finished with status: $status" + break + fi + + sleep 5 +done \ No newline at end of file diff --git a/script/trigger-CI.sh b/script/trigger-CI.sh index 00dac33..c9f0141 100644 --- a/script/trigger-CI.sh +++ b/script/trigger-CI.sh @@ -1,4 +1,3 @@ - #!/bin/bash # Check if two arguments are provided @@ -7,9 +6,10 @@ if [ $# -ne 2 ]; then exit 1 fi -# Read the two parameters +# Read commitId, repositoryUrl, and security from parameters or environment variables COMMIT_ID=$1 SECURITY=$2 +REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git" # Get current timestamp timestamp=$(date +%s) @@ -26,4 +26,10 @@ echo "MD5 hash of '${COMMIT_ID}' and '${SECURITY}' combined with timestamp is: $ # Return the MD5 hash as the script's exit code echo "${SECURITY}" -curl -v -H "Content-Type: application/json" -H "Authorization: Basic '${SECURITY}'" -d '{"message": "Hello"}' "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run" +# curl -v -H "Content-Type: application/json" -H "Authorization: Basic '${SECURITY}'" -d '{"Type": "CREATE-TASK", "commitId":"5c8dd25af56304cdcd358eccbf5778dcd442c5e0","repositoryUrl": "https://github.com/alibaba/rtp-llm.git"}' "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run" + +# 发送 CREATE-TASK 请求 +curl -v -H "Content-Type: application/json" \ + -H "Authorization: Basic ${SECURITY}" \ + -d "{\"type\": \"CREATE-TASK\", \"commitId\": \"${COMMIT_ID}\", \"repositoryUrl\": \"${REPO_URL}\"}" \ + "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run" \ No newline at end of file From 8c2183e3cd649cac22de9c6b15a6e81c27321e9a Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 17:54:05 +0800 Subject: [PATCH 02/40] Update get-CI-result.sh to fix curl command --- script/get-CI-result.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 18b0a48..0f6c6d5 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -17,8 +17,7 @@ while true; do response=${curl -s -H "Content-Type: application/json" \ -H "Authorization: Basic ${SECURITY}" \ -d "{\"commitId\": \"${COMMIT_ID}\"}" - "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run"} - # response=$(curl -s -H "Authorization: Basic ${SECURITY}" "${QUERY_URL}") + "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run"} status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') echo "Current status: $status" From fff24b3975b97bf79449905658e34f94edfecdd1 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 18:03:57 +0800 Subject: [PATCH 03/40] Update get-CI-result.sh --- script/get-CI-result.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 0f6c6d5..027e3e2 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -14,10 +14,10 @@ QUERY_URL="https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run/query?commit while true; do echo "Querying CI status for commitId: ${COMMIT_ID} ..." - response=${curl -s -H "Content-Type: application/json" \ + response=$(curl -s -H "Content-Type: application/json" \ -H "Authorization: Basic ${SECURITY}" \ -d "{\"commitId\": \"${COMMIT_ID}\"}" - "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run"} + "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') echo "Current status: $status" From f3b9fedf1ee1285c0dbf5e8f2bea87261a5e74e3 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 18:05:10 +0800 Subject: [PATCH 04/40] Update get-CI-result.sh to correctly fetch CI status --- script/get-CI-result.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 027e3e2..07e0606 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -16,8 +16,7 @@ while true; do response=$(curl -s -H "Content-Type: application/json" \ -H "Authorization: Basic ${SECURITY}" \ - -d "{\"commitId\": \"${COMMIT_ID}\"}" - "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") + -d "{\"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') echo "Current status: $status" From af007f4df318ebe1703850bb4589a685a218226a Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 20:07:13 +0800 Subject: [PATCH 05/40] Update get-CI-result.sh to correctly fetch CI status --- script/get-CI-result.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 07e0606..6597aad 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -9,14 +9,13 @@ fi COMMIT_ID=$1 SECURITY=$2 -QUERY_URL="https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run/query?commitId=${COMMIT_ID}" while true; do echo "Querying CI status for commitId: ${COMMIT_ID} ..." response=$(curl -s -H "Content-Type: application/json" \ -H "Authorization: Basic ${SECURITY}" \ - -d "{\"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") + -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') echo "Current status: $status" From 95ed1678dfecbad0f283eb5220924f72f121a0eb Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 20:14:32 +0800 Subject: [PATCH 06/40] test --- public-dir/test | 1 + 1 file changed, 1 insertion(+) diff --git a/public-dir/test b/public-dir/test index 9daeafb..33a709b 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1 +1,2 @@ test +fasdfkjbs \ No newline at end of file From f00fb86927dda0d421651963c1bb348bb8112e97 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 20:24:47 +0800 Subject: [PATCH 07/40] test --- public-dir/test | 2 +- public-dir/testpr | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index 33a709b..8744c2c 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbs \ No newline at end of file +fasdfkjbsdsa \ No newline at end of file diff --git a/public-dir/testpr b/public-dir/testpr index ff642b4..1a5f74f 100644 --- a/public-dir/testpr +++ b/public-dir/testpr @@ -1 +1,2 @@ fwelflmvc +dsa \ No newline at end of file From cc11e802401220936266a773dfd7270b53adbd8a Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 20:37:50 +0800 Subject: [PATCH 08/40] fail return -1 --- script/get-CI-result.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 6597aad..91e7736 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -21,7 +21,15 @@ while true; do echo "Current status: $status" if [[ "$status" == "DONE" || "$status" == "FAILED" || "$status" == "UNKNOWN" ]]; then - echo "CI finished with status: $status" + echo "CI running with status: $status" + if [[ "$status" == "DONE" ]]; then + echo "CI completed successfully" + return 0 + fi + else then + echo "CI failed or status unknown" + return -1 + fi break fi From 120830a3ed92b29c280488d0d7e0c983bbf271d2 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 20:39:22 +0800 Subject: [PATCH 09/40] fix a bug in CI status check --- script/get-CI-result.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 91e7736..cf2a1d4 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -25,8 +25,7 @@ while true; do if [[ "$status" == "DONE" ]]; then echo "CI completed successfully" return 0 - fi - else then + else echo "CI failed or status unknown" return -1 fi From c319a482eba0395d89a7608c40ef09a75dbf5172 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 20:43:54 +0800 Subject: [PATCH 10/40] test --- public-dir/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index 8744c2c..7d56f06 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbsdsa \ No newline at end of file +fasdfkjbsdsafdsf \ No newline at end of file From 9d33316fd2dc5674669deef2491b67c2bad9399f Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 20:50:16 +0800 Subject: [PATCH 11/40] test --- public-dir/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index 7d56f06..77c2062 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbsdsafdsf \ No newline at end of file +fasdfkjbsdsafdsf3 \ No newline at end of file From 2f7457396a78391006c5e84be4de6a2eccfba675 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 20:52:59 +0800 Subject: [PATCH 12/40] test --- script/get-CI-result.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index cf2a1d4..2fe10e4 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -24,10 +24,8 @@ while true; do echo "CI running with status: $status" if [[ "$status" == "DONE" ]]; then echo "CI completed successfully" - return 0 else echo "CI failed or status unknown" - return -1 fi break fi From 40c6ded5f6e3c97fe3dc551c89aee168eab0a74c Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 21:00:01 +0800 Subject: [PATCH 13/40] test --- public-dir/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index 77c2062..37fa509 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbsdsafdsf3 \ No newline at end of file +fasdfkjbsdsafdsf3d \ No newline at end of file From 663f0e181358842cbf0676e7e01b13a898d50444 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 21:03:43 +0800 Subject: [PATCH 14/40] test --- public-dir/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index 37fa509..e7d976f 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbsdsafdsf3d \ No newline at end of file +fasdfkjbsdsafdsf3ddfsa \ No newline at end of file From e73a807fb5ed0d9276b0725f49d6663dcfaa6ae0 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 21:21:20 +0800 Subject: [PATCH 15/40] test --- public-dir/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index e7d976f..e5049dc 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbsdsafdsf3ddfsa \ No newline at end of file +fasdfkjbsdsafdsf3ddfsad \ No newline at end of file From 7b7e6bf3d5d15a59f8fb446ded1e81c736969726 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 21:24:32 +0800 Subject: [PATCH 16/40] test --- public-dir/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index e5049dc..3bef33d 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbsdsafdsf3ddfsad \ No newline at end of file +fasdfkjbsdsafdsf3ddfsaddsa \ No newline at end of file From 8d71336d1fc9679fabd55bc4b07e050478bed563 Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 21:26:15 +0800 Subject: [PATCH 17/40] test --- script/get-CI-result.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 2fe10e4..75ecad9 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -24,8 +24,12 @@ while true; do echo "CI running with status: $status" if [[ "$status" == "DONE" ]]; then echo "CI completed successfully" + elif [[ "$status" == "FAILED" ]]; then + echo "CI failed" + elif [[ "$status" == "UNKNOWN" ]]; then + echo "CI status is unknown" else - echo "CI failed or status unknown" + echo "Unexpected status: $status" fi break fi From cd79a7c9f702ceadeca7ed7ababd9d7c635af6eb Mon Sep 17 00:00:00 2001 From: luoxi Date: Thu, 11 Sep 2025 21:27:25 +0800 Subject: [PATCH 18/40] test --- script/get-CI-result.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 75ecad9..8cd771c 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -21,7 +21,6 @@ while true; do echo "Current status: $status" if [[ "$status" == "DONE" || "$status" == "FAILED" || "$status" == "UNKNOWN" ]]; then - echo "CI running with status: $status" if [[ "$status" == "DONE" ]]; then echo "CI completed successfully" elif [[ "$status" == "FAILED" ]]; then From 80a90ff640db2131b0b37b27341a63c24314da4f Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 16:15:02 +0800 Subject: [PATCH 19/40] support for merge tasks, update trigger and get scripts --- .github/workflows/post-merge.yml | 29 +++++++++++++----- .github/workflows/simple-test.yml | 4 +-- script/get-CI-result.sh | 2 +- script/get-merge-result.sh | 29 ++++++++++++++++++ script/trigger-CI.sh | 13 ++++++-- script/trigger-merge.sh | 51 +++++++++++++++++++++++++++++++ 6 files changed, 113 insertions(+), 15 deletions(-) create mode 100644 script/get-merge-result.sh create mode 100644 script/trigger-merge.sh diff --git a/.github/workflows/post-merge.yml b/.github/workflows/post-merge.yml index de49e0c..97d027e 100644 --- a/.github/workflows/post-merge.yml +++ b/.github/workflows/post-merge.yml @@ -1,4 +1,4 @@ -name: Trigger on PR Merge +name: Trigger Aone Merge on PR Merge on: pull_request: @@ -8,12 +8,25 @@ on: jobs: trigger-on-merge: runs-on: ubuntu-latest + if: github.event.pull_request.merged == true + steps: - - name: Check if PR was merged + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Make scripts executable + run: chmod +x trigger-merge.sh get-merge-result.sh + + - name: Trigger Aone Merge Task + id: trigger + run: | + echo "Triggering Aone merge for commit ${{ github.event.pull_request.head.sha }}" + ./trigger-merge.sh "${{ github.event.pull_request.head.sha }}" "${{ secrets.CI_SECRET }}" + env: + AONE_PROJECT_ID: "3512232" + GITHUB_REPOSITORY: ${{ github.repository }} + + - name: Get Merge Result run: | - if [ "${{ github.event.pull_request.merged }}" = "true" ]; then - echo "PR was merged" - # 在这里添加你想要执行的命令 - else - echo "PR was not merged" - fi + echo "Polling for merge result of commit ${{ github.event.pull_request.head.sha }}" + ./get-merge-result.sh "${{ github.event.pull_request.head.sha }}" "${{ secrets.CI_SECRET }}" \ No newline at end of file diff --git a/.github/workflows/simple-test.yml b/.github/workflows/simple-test.yml index dd0d9bb..c2e36f5 100644 --- a/.github/workflows/simple-test.yml +++ b/.github/workflows/simple-test.yml @@ -34,14 +34,12 @@ jobs: # Runs trigger CI - name: Make the script files executable - run: chmod +x trigger-CI.sh + run: chmod +x trigger-CI.sh get-CI-result.sh - name: trigger a CI run: | ./trigger-CI.sh "${{ github.sha }}" "${{ secrets.CI_SECRET }}" -# curl -v -H "Content-Type: application/json" -H "Authorization: Basic ${{ secrets.CI_SECRET }}" -d '{"commitId":"${{ github.sha }}","repositoryUrl":"https://github.com/alibaba/rtp-llm.git","taskId":"9180024","type":"CREATE-TASK"}' "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run" # Runs get CI result - name: Get CI result run: | - chmod +x get-CI-result.sh ./get-CI-result.sh "${{ github.sha }}" "${{ secrets.CI_SECRET }}" \ No newline at end of file diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 8cd771c..a5a74b5 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -15,7 +15,7 @@ while true; do response=$(curl -s -H "Content-Type: application/json" \ -H "Authorization: Basic ${SECURITY}" \ - -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") + -d "{\"type\": \"RETRIEVE-MERGE-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') echo "Current status: $status" diff --git a/script/get-merge-result.sh b/script/get-merge-result.sh new file mode 100644 index 0000000..d354cd2 --- /dev/null +++ b/script/get-merge-result.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# 检查参数 +if [ $# -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +COMMIT_ID=$1 +SECURITY=$2 + + +while true; do + echo "Querying merge status for commitId: ${COMMIT_ID} ..." + + response=$(curl -s -H "Content-Type: application/json" \ + -H "Authorization: Basic ${SECURITY}" \ + -d "{\"type\": \"RETRIEVE-MERGE-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") + status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') + + echo "Current status: $status" + + if [ "$status" != "PENDING" ]; then + echo "Merge process completed with status: $status" + break + fi + + sleep 5 +done \ No newline at end of file diff --git a/script/trigger-CI.sh b/script/trigger-CI.sh index c9f0141..4924df9 100644 --- a/script/trigger-CI.sh +++ b/script/trigger-CI.sh @@ -10,6 +10,9 @@ fi COMMIT_ID=$1 SECURITY=$2 REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git" +PROJECT_ID="3512232" +BRANCH_REF="main" +BRANCH_NAME="open_merge_${COMMIT_ID}" # Get current timestamp timestamp=$(date +%s) @@ -26,10 +29,14 @@ echo "MD5 hash of '${COMMIT_ID}' and '${SECURITY}' combined with timestamp is: $ # Return the MD5 hash as the script's exit code echo "${SECURITY}" -# curl -v -H "Content-Type: application/json" -H "Authorization: Basic '${SECURITY}'" -d '{"Type": "CREATE-TASK", "commitId":"5c8dd25af56304cdcd358eccbf5778dcd442c5e0","repositoryUrl": "https://github.com/alibaba/rtp-llm.git"}' "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run" - # 发送 CREATE-TASK 请求 curl -v -H "Content-Type: application/json" \ -H "Authorization: Basic ${SECURITY}" \ - -d "{\"type\": \"CREATE-TASK\", \"commitId\": \"${COMMIT_ID}\", \"repositoryUrl\": \"${REPO_URL}\"}" \ + -d "{ + \"type\": \"CREATE-TASK\", + \"commitId\": \"${COMMIT_ID}\", + \"repositoryUrl\": \"${REPO_URL}\", + \"aone\": { \"projectId\": \"${PROJECT_ID}\" }, + \"newBranch\": { \"name\": \"${BRANCH_NAME}\", \"ref\": \"${BRANCH_REF}\" } + }" \ "https://triggerid-to-mq-wjrdhcgbie.cn-hangzhou.fcapp.run" \ No newline at end of file diff --git a/script/trigger-merge.sh b/script/trigger-merge.sh new file mode 100644 index 0000000..fe66b8b --- /dev/null +++ b/script/trigger-merge.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +if [ $# -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +COMMIT_ID=$1 +SECURITY=$2 +REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git" +AONE_PROJECT_ID="${AONE_PROJECT_ID}" +SRC_BRANCH="open_merge_${COMMIT_ID}" +DEST_BRANCH="main" + +# Get current timestamp +timestamp=$(date +%s) + +# Concatenate the parameters with timestamp +combined="${COMMIT_ID}${SECURITY}${timestamp}" + +# Calculate the MD5 hash +base64_hash=$(echo -n "${combined}" | base64) + +# Output the MD5 hash +echo "MD5 hash of '${COMMIT_ID}' and '${SECURITY}' combined with timestamp is: ${md5_hash}" + +# Return the MD5 hash as the script's exit code +echo "${SECURITY}" + + +JSON_BODY=$(cat < Date: Fri, 12 Sep 2025 16:37:10 +0800 Subject: [PATCH 20/40] test --- script/trigger-merge.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/script/trigger-merge.sh b/script/trigger-merge.sh index fe66b8b..a182729 100644 --- a/script/trigger-merge.sh +++ b/script/trigger-merge.sh @@ -9,8 +9,12 @@ COMMIT_ID=$1 SECURITY=$2 REPO_URL="https://github.com/${GITHUB_REPOSITORY}.git" AONE_PROJECT_ID="${AONE_PROJECT_ID}" -SRC_BRANCH="open_merge_${COMMIT_ID}" -DEST_BRANCH="main" +AUTHOR_EMAIL="yanan.yn@alibaba-inc.com" +AUTHOR_NAME="隆宇" +MERGE_MESSAGE="foo" +MERGE_TYPE="SQUASH" +SOURCE_BRANCH="open_merge_${COMMIT_ID}" +TARGET_BRANCH="main" # Get current timestamp timestamp=$(date +%s) @@ -33,11 +37,15 @@ JSON_BODY=$(cat < Date: Fri, 12 Sep 2025 16:53:21 +0800 Subject: [PATCH 21/40] test --- public-dir/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index 3bef33d..0a7f8e8 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbsdsafdsf3ddfsaddsa \ No newline at end of file +fasdfkjbsdsafdsf3ddfsaddsafdsa \ No newline at end of file From 8fa9e3e08dfb94fd0b8a4ce076c393e0535db73b Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 16:57:10 +0800 Subject: [PATCH 22/40] test --- script/get-CI-result.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index a5a74b5..8cd771c 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -15,7 +15,7 @@ while true; do response=$(curl -s -H "Content-Type: application/json" \ -H "Authorization: Basic ${SECURITY}" \ - -d "{\"type\": \"RETRIEVE-MERGE-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") + -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') echo "Current status: $status" From c2824f400b54d6b59fd30be8db3e05533f80bbe0 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:01:55 +0800 Subject: [PATCH 23/40] test --- public-dir/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index 0a7f8e8..e6ddbcb 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbsdsafdsf3ddfsaddsafdsa \ No newline at end of file +fasdfkjbsdsafdsf3ddfsaddsafdsa1 \ No newline at end of file From 22913621270e12b3f6c2c9cd3443f02e29d1a0b4 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:06:21 +0800 Subject: [PATCH 24/40] test --- script/get-CI-result.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 8cd771c..0458892 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -16,6 +16,7 @@ while true; do response=$(curl -s -H "Content-Type: application/json" \ -H "Authorization: Basic ${SECURITY}" \ -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") + echo "Response: $response" status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') echo "Current status: $status" From 5056708a73f9983ac4c9329dfc159a26af425c37 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:09:48 +0800 Subject: [PATCH 25/40] test --- public-dir/test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/test b/public-dir/test index e6ddbcb..72c7cb5 100644 --- a/public-dir/test +++ b/public-dir/test @@ -1,2 +1,2 @@ test -fasdfkjbsdsafdsf3ddfsaddsafdsa1 \ No newline at end of file +fasdfkjbsdsafdsf3ddfsaddsafdsa11 \ No newline at end of file From d61cc2cbdada2d913f3a0d5b9a0749038a3aa767 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:27:10 +0800 Subject: [PATCH 26/40] tewq --- public-dir/testpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/testpr b/public-dir/testpr index 1a5f74f..970bbff 100644 --- a/public-dir/testpr +++ b/public-dir/testpr @@ -1,2 +1,2 @@ fwelflmvc -dsa \ No newline at end of file +dsa1 \ No newline at end of file From 1c2da4a5fc6d3cfa1da28e9831dcc50adb40620d Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:35:58 +0800 Subject: [PATCH 27/40] test --- public-dir/testpr | 2 +- script/get-CI-result.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public-dir/testpr b/public-dir/testpr index 970bbff..02bb9d0 100644 --- a/public-dir/testpr +++ b/public-dir/testpr @@ -1,2 +1,2 @@ fwelflmvc -dsa1 \ No newline at end of file +dsa1123 \ No newline at end of file diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 0458892..2dc3cef 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -21,13 +21,15 @@ while true; do echo "Current status: $status" - if [[ "$status" == "DONE" || "$status" == "FAILED" || "$status" == "UNKNOWN" ]]; then + if [[ "$status" == "DONE" || "$status" == "FAILED" || "$status" == "UNKNOWN" || "$status" == "CANCELED"]]; then if [[ "$status" == "DONE" ]]; then echo "CI completed successfully" elif [[ "$status" == "FAILED" ]]; then echo "CI failed" elif [[ "$status" == "UNKNOWN" ]]; then echo "CI status is unknown" + elif [[ "$status" == "CANCELED" ]]; then + echo "CI was canceled" else echo "Unexpected status: $status" fi From 07077be978b4aad3cddddc6aef75e827c705c325 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:37:52 +0800 Subject: [PATCH 28/40] test --- script/get-CI-result.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 2dc3cef..c3110cf 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -21,7 +21,7 @@ while true; do echo "Current status: $status" - if [[ "$status" == "DONE" || "$status" == "FAILED" || "$status" == "UNKNOWN" || "$status" == "CANCELED"]]; then + if [[ "$status" == "DONE" || "$status" == "FAILED" || "$status" == "UNKNOWN" || "$status" == "CANCELED" ]]; then if [[ "$status" == "DONE" ]]; then echo "CI completed successfully" elif [[ "$status" == "FAILED" ]]; then From e64cad9cdf0191ad4a63c3e924620531612efaa8 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:39:53 +0800 Subject: [PATCH 29/40] test --- script/get-CI-result.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index c3110cf..27622f1 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -17,7 +17,7 @@ while true; do -H "Authorization: Basic ${SECURITY}" \ -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") echo "Response: $response" - status=$(echo "$response" | grep -o '"status":"[^"]*"' | cut -d':' -f2 | tr -d '"') + status=$(echo "$response" | grep -o '"status":"{[^}]*}"' | sed 's/.*"status":"{\(.*\)}".*/\1/' | grep -o 'status":"[^"]*"' | head -n1 | cut -d':' -f2 | tr -d '"') echo "Current status: $status" From c5061731a70e0802708c59ffab2a0128b82752c0 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:44:53 +0800 Subject: [PATCH 30/40] test --- script/get-CI-result.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 27622f1..024665e 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -17,7 +17,7 @@ while true; do -H "Authorization: Basic ${SECURITY}" \ -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") echo "Response: $response" - status=$(echo "$response" | grep -o '"status":"{[^}]*}"' | sed 's/.*"status":"{\(.*\)}".*/\1/' | grep -o 'status":"[^"]*"' | head -n1 | cut -d':' -f2 | tr -d '"') + status=$(echo "$response" | sed -n 's/.*"status":"{.*\"status\":\"\([A-Z]*\)\".*}".*/\1/p') echo "Current status: $status" From 8a1e63b74cf500fdbfd034d4f49902a6af0006c6 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:49:24 +0800 Subject: [PATCH 31/40] test --- script/get-CI-result.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 024665e..18842f5 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -17,7 +17,7 @@ while true; do -H "Authorization: Basic ${SECURITY}" \ -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") echo "Response: $response" - status=$(echo "$response" | sed -n 's/.*"status":"{.*\"status\":\"\([A-Z]*\)\".*}".*/\1/p') + status=$(echo "$response" | sed 's/.*"status":"\([^"]*\)".*/\1/') echo "Current status: $status" From e41f93efac6d9074c62d3b9e0fb219ec013c3d80 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:52:30 +0800 Subject: [PATCH 32/40] test --- public-dir/testpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/testpr b/public-dir/testpr index 02bb9d0..467de66 100644 --- a/public-dir/testpr +++ b/public-dir/testpr @@ -1,2 +1,2 @@ fwelflmvc -dsa1123 \ No newline at end of file +dsa1123s \ No newline at end of file From bc88de8731da9c6e9ce535cbba5c82b00f56d7b4 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:53:17 +0800 Subject: [PATCH 33/40] test --- public-dir/testpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/testpr b/public-dir/testpr index 467de66..f920148 100644 --- a/public-dir/testpr +++ b/public-dir/testpr @@ -1,2 +1,2 @@ -fwelflmvc +fwelflmvc213 dsa1123s \ No newline at end of file From e464e66996aba6cf1dc7392458776a5361419877 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:56:31 +0800 Subject: [PATCH 34/40] test --- script/get-CI-result.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 18842f5..83c4213 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -17,7 +17,7 @@ while true; do -H "Authorization: Basic ${SECURITY}" \ -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") echo "Response: $response" - status=$(echo "$response" | sed 's/.*"status":"\([^"]*\)".*/\1/') + status=$(echo "$response" | jq -r '.status' | jq -r '.status') echo "Current status: $status" From 08586a001f633aacd094144c60a50429ed56b468 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:58:03 +0800 Subject: [PATCH 35/40] test --- script/get-CI-result.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 83c4213..dae3c48 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -17,7 +17,7 @@ while true; do -H "Authorization: Basic ${SECURITY}" \ -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") echo "Response: $response" - status=$(echo "$response" | jq -r '.status' | jq -r '.status') + status=$(echo "$response" | jq -r '.status | try(fromjson | .status) catch .') echo "Current status: $status" From d943af805dca0756e2770d384869481a5a70eeba Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 17:59:27 +0800 Subject: [PATCH 36/40] test --- script/get-CI-result.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index dae3c48..11f9a3d 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -17,7 +17,7 @@ while true; do -H "Authorization: Basic ${SECURITY}" \ -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") echo "Response: $response" - status=$(echo "$response" | jq -r '.status | try(fromjson | .status) catch .') + status=$(echo "$response" | jq -r '.status | if test("^\\{") then fromjson.status else . end') echo "Current status: $status" From a7c9cf44da8e0c57c929d67a760522554b168464 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 18:00:49 +0800 Subject: [PATCH 37/40] test --- public-dir/testpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/testpr b/public-dir/testpr index f920148..aa240a3 100644 --- a/public-dir/testpr +++ b/public-dir/testpr @@ -1,2 +1,2 @@ -fwelflmvc213 +fwelflmvc213q dsa1123s \ No newline at end of file From 55be08c02bddc429f6ed4a73a77387a111935422 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 18:02:06 +0800 Subject: [PATCH 38/40] test --- public-dir/testpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/testpr b/public-dir/testpr index aa240a3..ceef470 100644 --- a/public-dir/testpr +++ b/public-dir/testpr @@ -1,2 +1,2 @@ fwelflmvc213q -dsa1123s \ No newline at end of file +dsa1123s1 \ No newline at end of file From 5bdd262be8051264676a27838309ef1e691fb828 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 18:04:00 +0800 Subject: [PATCH 39/40] test --- script/get-CI-result.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/script/get-CI-result.sh b/script/get-CI-result.sh index 11f9a3d..3133f67 100644 --- a/script/get-CI-result.sh +++ b/script/get-CI-result.sh @@ -17,11 +17,11 @@ while true; do -H "Authorization: Basic ${SECURITY}" \ -d "{\"type\": \"RETRIEVE-TASK-STATUS\", \"commitId\": \"${COMMIT_ID}\"}" "https://get-tasend-back-twkvcdsbpj.cn-hangzhou.fcapp.run") echo "Response: $response" - status=$(echo "$response" | jq -r '.status | if test("^\\{") then fromjson.status else . end') - echo "Current status: $status" + status=$(echo "$response" | jq -r '.status | if test("^\\{") then fromjson.status else . end') if [[ "$status" == "DONE" || "$status" == "FAILED" || "$status" == "UNKNOWN" || "$status" == "CANCELED" ]]; then + echo "Current status: $status" if [[ "$status" == "DONE" ]]; then echo "CI completed successfully" elif [[ "$status" == "FAILED" ]]; then From 82da8ce5b51a9a18f5296252d67fba3cbd3d7479 Mon Sep 17 00:00:00 2001 From: luoxi Date: Fri, 12 Sep 2025 18:08:12 +0800 Subject: [PATCH 40/40] finish 1 2, test 3 --- public-dir/testpr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public-dir/testpr b/public-dir/testpr index ceef470..eaa3612 100644 --- a/public-dir/testpr +++ b/public-dir/testpr @@ -1,2 +1,2 @@ fwelflmvc213q -dsa1123s1 \ No newline at end of file +dsa1123s11 \ No newline at end of file