已开启
[例子]gitcode-pipeline触发流水线,间隔60s查询状态,自动下载日志,解决编译报错,push后重新触发CI #4
黄桂军创建于  5月13日
黄桂军
黄桂军成员
5月13日 创建

PR 2789 触发 CI

Created: 2026/5/13 09:22:26
Updated: 2026/5/13 09:49:46


user

pr 2789 触发ci

assistant

使用 gitcode-pipeline 触发 PR 2789 的 CI。

执行计划

步骤 操作 说明
1 检查 PR Label 查询 PR labels,判断 ci-pipeline-passed 是否存在
2 查询流水线状态 仅当无 ci-pipeline-passed label 时执行
3 触发流水线 优先 API retry,不适用时评论触发
4 循环查询状态 每 60 秒查询一次,直到完成
5 处理结果 成功/失败处理

开始执行:

Tool Call: bash

Input:

{
  "command": "repo_url=$(git remote get-url origin)\nif [[ $repo_url == git@* ]]; then\n  owner=$(echo $repo_url | sed 's|.*:\\([^/]*\\)/\\([^/]*\\)\\.git$|\\1|')\n  repo=$(echo $repo_url | sed 's|.*:\\([^/]*\\)/\\([^/]*\\)\\.git$|\\2|')\nelse\n  owner=$(echo $repo_url | sed 's|.*gitcode\\.com/\\([^/]*\\)/\\([^/]*\\)\\.git$|\\1|')\n  repo=$(echo $repo_url | sed 's|.*gitcode\\.com/\\([^/]*\\)/\\([^/]*\\)\\.git$|\\2|')\nfi\necho \"owner=$owner\"\necho \"repo=$repo\"\nencoded_repo=$(printf '%s' \"${owner}/${repo}\" | jq -sRr @uri)\necho \"encoded_repo=$encoded_repo\"",
  "description": "Extract repo info from git remote"
}

Output:

owner=cann
repo=ge
encoded_repo=cann%2Fge

Tool Call: bash

Input:

{
  "command": "curl -s \"https://api.gitcode.com/api/v5/repos/cann/ge/pulls/2789?access_token=${GITCODE_API_TOKEN}\" | jq -r '.labels[]?.name'",
  "description": "Check PR 2789 labels"
}

Output:

cann-cla/yes

assistant

✅ 步骤 1 完成:PR labels 中无 ci-pipeline-passed,需要检查流水线

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-list.sh 2789",
  "description": "Query PR 2789 pipeline status"
}

Output:

(no output)

assistant

✅ 步骤 2 完成:无流水线记录,需要触发流水线

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-trigger.sh 2789 \"触发CI\"",
  "description": "Trigger CI for PR 2789"
}

Output:

错误: 不接受额外参数,评论内容固定为 compile

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-trigger.sh 2789",
  "description": "Trigger CI for PR 2789"
}

Output:

ok

assistant

✅ 步骤 3 完成:已触发流水线,等待启动...

Tool Call: bash

Input:

{
  "command": "sleep 15 && bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-list.sh 2789",
  "description": "Wait and check pipeline status"
}

Output:

id=568852 status=running sha=6460f9b5fa09 ref=master created=2026-05-13T09:23:06.688+08:00 pipeline_id=c85338dd05464b82b0a098dacc32415d pipeline_run_id=8c960d4e559a494c803141abab73b312 pipeline_detail={"hook_id":"42205","hook_type":"project","job_log_url":null,"job_run_time":null,"pipeline_total_time":null,"project_id":"8e3ae2e30c3a4cf4a75e4cdc75d41bac","pipeline_host":"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com"}

assistant

✅ 流水线 #568852 已启动,状态: RUNNING

开始轮询流水线状态(每 60 秒查询一次)...

Tool Call: bash

Input:

{
  "command": "while true; do\n  sleep 60\n  result=$(bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-list.sh 2789)\n  echo \"$(date '+%Y-%m-%d %H:%M:%S') - $result\"\n  status=$(echo \"$result\" | grep -oP 'status=\\K[^\\s]+' | head -1)\n  if [[ \"$status\" == \"success\" ]] || [[ \"$status\" == \"failed\" ]] || [[ \"$status\" == \"canceled\" ]]; then\n    echo \"流水线已完成,最终状态: $status\"\n    break\n  fi\ndone",
  "description": "Poll pipeline status until completion",
  "timeout": 600000
}

Output:

2026-05-13 09:24:29 - id=568852 status=running
2026-05-13 09:25:30 - id=568852 status=running
2026-05-13 09:26:30 - id=568852 status=running
2026-05-13 09:27:31 - id=568852 status=running
2026-05-13 09:28:31 - id=568852 status=running
2026-05-13 09:29:32 - id=568852 status=failed 
流水线已完成,最终状态: failed

assistant

❌ 流水线 #568852 失败,正在分析...

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-detail.sh c85338dd05464b82b0a098dacc32415d 8c960d4e559a494c803141abab73b312 '{\"hook_id\":\"42205\",\"hook_type\":\"project\",\"job_log_url\":null,\"job_run_time\":null,\"pipeline_total_time\":380,\"project_id\":\"8e3ae2e30c3a4cf4a75e4cdc75d41bac\",\"pipeline_host\":\"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com\"}'",
  "description": "Get pipeline detail for failed jobs"
}

Output:

pipeline_name=cann_ge_all status=FAILED
[stage] 获取pr文件: COMPLETED
[stage] 子流水线: FAILED
[stage] 后处理阶段: FAILED
[job]   执行shell: COMPLETED id=1c39b82d3ee94ad89f06bf150afe2bd4 task=official_shell_plugin
[job]   get_pr_file: COMPLETED id=fd14d95aaeaf45a1bce35850725cf014 task=official_devcloud_cloudBuild
[job]   static-check: COMPLETED id=6192cc4ac8004e5085a66e157120fff9 task=official_devcloud_subPipeline step_id=4ce64604a5d542958f8cc505185d38ab
[job]   compile: FAILED id=d0083448be374f93877c259c4d49b852 task=official_devcloud_subPipeline step_id=a77d4e2f6ef84f1a84ea620dd842db79 msg=步骤compile执行失败,错误信息:点击任务查看详情
[job]   llt: FAILED id=b07fb84ffc144bfb925c22b66af706ac task=official_devcloud_subPipeline step_id=78518adbad314ec4bbb622ec9edac007 msg=步骤llt执行失败,错误信息:点击任务查看详情
[job]   last_comment: FAILED id=c55bd7366e0347cdb32856aa6da6702b task=official_devcloud_cloudBuild msg=步骤last_comment执行失败,错误信息:{"errorMessage":" 构建任务执行失败!","errorCode":"DEV-CODECI-35002"}

assistant

发现失败 Job:compile 和 llt。正在获取 compile 子流水线详情...

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-sub-output.sh c85338dd05464b82b0a098dacc32415d 8c960d4e559a494c803141abab73b312 '{\"hook_id\":\"42205\",\"hook_type\":\"project\",\"job_log_url\":null,\"job_run_time\":null,\"pipeline_total_time\":380,\"project_id\":\"8e3ae2e30c3a4cf4a75e4cdc75d41bac\",\"pipeline_host\":\"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com\"}' a77d4e2f6ef84f1a84ea620dd842db79",
  "description": "Get compile sub-pipeline info"
}

Output:

sub_pipeline_run_id=5a369428242b47d39bef677a4663e467 sub_manifest_version=3.0 sub_component_id= sub_pipeline_id=dcd161850837402293f0c47cda6b9921 sub_project_id=8e3ae2e30c3a4cf4a75e4cdc75d41bac sub_region=cn-north-4

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-sub-output.sh c85338dd05464b82b0a098dacc32415d 8c960d4e559a494c803141abab73b312 '{\"hook_id\":\"42205\",\"hook_type\":\"project\",\"job_log_url\":null,\"job_run_time\":null,\"pipeline_total_time\":380,\"project_id\":\"8e3ae2e30c3a4cf4a75e4cdc75d41bac\",\"pipeline_host\":\"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com\"}' 78518adbad314ec4bbb622ec9edac007",
  "description": "Get llt sub-pipeline info"
}

Output:

sub_pipeline_run_id=74e3178becbd4787b958692cf845b480 sub_manifest_version=3.0 sub_component_id= sub_pipeline_id=24a7e27bfa544c43bd467b7e5ad83531 sub_project_id=8e3ae2e30c3a4cf4a75e4cdc75d41bac sub_region=cn-north-4

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-detail.sh dcd161850837402293f0c47cda6b9921 5a369428242b47d39bef677a4663e467 '{\"hook_id\":\"42205\",\"hook_type\":\"project\",\"job_log_url\":null,\"job_run_time\":null,\"pipeline_total_time\":380,\"project_id\":\"8e3ae2e30c3a4cf4a75e4cdc75d41bac\",\"pipeline_host\":\"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com\"}'",
  "description": "Get compile sub-pipeline detail"
}

Output:

pipeline_name=cann_ge_compile status=FAILED
[stage] Image: COMPLETED
[stage] 编译构建: FAILED
[stage] PreSmoke: INIT
[stage] 后处理阶段: COMPLETED
[job]   解析image: COMPLETED id=deb7f49134b640a5a18de1c9362e1e57 task=analyze_image@0.0.5
[job]   pre_comment: COMPLETED id=ccd550d8736e4db8a586826ee13cdd19 task=official_devcloud_cloudBuild
[job]   Compile_X86_compiler_ubuntu24: FAILED id=eecace5686c7491e92be6c6bbdaa8a22 task=official_devcloud_cloudBuild msg=步骤Compile_X86_compiler_ubuntu24执行失败,错误信息:{"errorMessage":" 构建任务执行失败!","errorCode":"DEV-CODECI-35002"}
[job]   Compile_X86_executor_ubuntu24: COMPLETED id=6368e43bc5974a02bdc72671d77e647b task=official_devcloud_cloudBuild
[job]   Compile_X86_dflow_ubuntu24: COMPLETED id=077aafa68f214d69b99c0021447b1301 task=official_devcloud_cloudBuild
[job]   Compile_ARM_compiler_ubuntu24: FAILED id=968e626827324344aa0499069411d3b1 task=official_devcloud_cloudBuild msg=步骤Compile_ARM_compiler_ubuntu24执行失败,错误信息:{"errorMessage":" 构建任务执行失败!","errorCode":"DEV-CODECI-35002"}
[job]   Compile_ARM_executor_ubuntu24: COMPLETED id=74e5e83a79414e24b24f8c7b46d5bc24 task=official_devcloud_cloudBuild
[job]   Compile_ARM_dflow_ubuntu24: COMPLETED id=af79e50bd7804c26977caac4ce45f461 task=official_devcloud_cloudBuild
[job]   Compile_ARM_compiler: FAILED id=f18206f2e22b459897d4354e54eddce3 task=official_devcloud_cloudBuild msg=步骤Compile_ARM_compiler执行失败,错误信息:{"errorMessage":" 构建任务执行失败!","errorCode":"DEV-CODECI-35002"}
[job]   Compile_ARM_executor: COMPLETED id=0d67e4bdb5074231adaa545ddaff7364 task=official_devcloud_cloudBuild
[job]   Compile_ARM_dflow: COMPLETED id=354954f44a884194be1f9ad5c80df6c2 task=official_devcloud_cloudBuild
[job]   API_Check: INIT id=86c5db0c37c049a3b9ddb83896cce6be task=official_devcloud_cloudBuild
[job]   PreSmoke_A900_npupool: INIT id=647658958177485590112598e7b55a2e task=official_devcloud_cloudBuild
[job]   last_comment: COMPLETED id=3e91a34e5d614b9a848d973f8a4160fa task=official_devcloud_cloudBuild
[job]   Resouce Clean: COMPLETED id=7cf27cfb8fbf4ac09edb684c738c1f0f task=official_devcloud_cloudBuild

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-detail.sh 24a7e27bfa544c43bd467b7e5ad83531 74e3178becbd4787b958692cf845b480 '{\"hook_id\":\"42205\",\"hook_type\":\"project\",\"job_log_url\":null,\"job_run_time\":null,\"pipeline_total_time\":380,\"project_id\":\"8e3ae2e30c3a4cf4a75e4cdc75d41bac\",\"pipeline_host\":\"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com\"}'",
  "description": "Get llt sub-pipeline detail"
}

Output:

pipeline_name=cann_ge_llt status=FAILED
[stage] Image: COMPLETED
[stage] 编译构建: FAILED
[stage] LLT: INIT
[stage] lcov: INIT
[stage] 后处理阶段: COMPLETED
[job]   解析image: COMPLETED id=3d977ffbddbb4ecc8bfa9cc65089aaff task=analyze_image@0.0.5
[job]   pre_comment: COMPLETED id=d910faac8e12493aa460e686f7b4e76d task=official_devcloud_cloudBuild
[job]   Compile_X86_compiler: FAILED id=55a8f6ec594845f6ab338308883b3947 task=official_devcloud_cloudBuild msg=步骤Compile_X86_compiler执行失败,错误信息:{"errorMessage":" 构建任务执行失败!","errorCode":"DEV-CODECI-35002"}
[job]   Compile_X86_executor: COMPLETED id=db4e8bf0ffb54927970297e9db0b0bf2 task=official_devcloud_cloudBuild
[job]   Compile_X86_dflow: COMPLETED id=78fd4197a3cb45fcb747e27137dc03e5 task=official_devcloud_cloudBuild
[job]   UT_Test_dflow: INIT id=da138e2ac4db4d6c882e5bf8a06ef3de task=official_devcloud_cloudBuild
[job]   UT_Test_ge_common: INIT id=fbc4b0ca45c74828a717ae394d8b9469 task=official_devcloud_cloudBuild
[job]   UT_Test_parser: INIT id=dc19aec451fb4e809c7e17781a599a9e task=official_devcloud_cloudBuild
[job]   UT_Test_python: INIT id=e4adbe6e1b1641409296dc29f7d82cb6 task=official_devcloud_cloudBuild
[job]   UT_Test_rt: INIT id=0403818bfdf84dac8501358fe1ea1530 task=official_devcloud_cloudBuild
[job]   UT_Test_acl: INIT id=6e97669ec3794ac3bffad5861a7c1adf task=official_devcloud_cloudBuild
[job]   UT_Test_autofuse: INIT id=bc3649be2633446197d8ba25b03c35f6 task=official_devcloud_cloudBuild
[job]   UT_Test_executor: INIT id=86083c41af7d43acb882de2d44bcfca4 task=official_devcloud_cloudBuild
[job]   UT_Test_autofuse_ascendc_api: INIT id=3eda195b77df4e9cb0882fe7ca8c8bcb task=official_devcloud_cloudBuild
[job]   ST_Test_dflow: INIT id=13d8b19a7fc74e39a0a4749aba09cffc task=official_devcloud_cloudBuild
[job]   ST_Test_ge_common: INIT id=8c2af8739a334a18b9c401f919484408 task=official_devcloud_cloudBuild
[job]   ST_Test_parser: INIT id=5b00b772d06f47c4bf85bc6919398d59 task=official_devcloud_cloudBuild
[job]   ST_Test_python: INIT id=f5e81043e8114993ace5f678204f366f task=official_devcloud_cloudBuild
[job]   ST_Test_rt: INIT id=ba6b28a19c6547359c26b7ef6fc99b65 task=official_devcloud_cloudBuild
[job]   ST_Test_autofuse: INIT id=bc6130ccff4c4de58839755c0ab8bfff task=official_devcloud_cloudBuild
[job]   ST_Test_executor: INIT id=5142011ef0244889a0d14ceba3848554 task=official_devcloud_cloudBuild
[job]   ST_Test_hetero: INIT id=214e820d825b431dbba91a7ac3697d7d task=official_devcloud_cloudBuild
[job]   ST_Test_autofuse_ascendc_api: INIT id=e4a6722964d54c4996efbb35926b177a task=official_devcloud_cloudBuild
[job]   ST_Test_autofuse_e2e: INIT id=29740bc69a4f4abd8841cacf5ac62e88 task=official_devcloud_cloudBuild
[job]   UT_Test_fe: INIT id=72a6c49cbb1442a8905266118e2a1849 task=official_devcloud_cloudBuild
[job]   UT_Test_tefusion: INIT id=43b0168d573842d1ad48ed8f635f4eed task=official_devcloud_cloudBuild
[job]   ST_Test_fe: INIT id=c99c368a1651407b859a23f6065c23ee task=official_devcloud_cloudBuild
[job]   ST_Test_tefusion: INIT id=57d9a8df064f40db835ee50d58d52324 task=official_devcloud_cloudBuild
[job]   UT_Test_Report_graphengine: INIT id=f6d6346f6e44468fade4f2b106fa3ccd task=official_devcloud_cloudBuild
[job]   UT_Test_Report_ge_executor_c: INIT id=9e3e27b12c454bf4894b9e92cc82aeef task=official_devcloud_cloudBuild
[job]   UT_Test_Report_ge_autofuse: INIT id=bb7c038b452c42ef9acd1225321faa32 task=official_devcloud_cloudBuild
[job]   ST_Test_Report_graphengine: INIT id=aadd2291a885486d94211e4320246876 task=official_devcloud_cloudBuild
[job]   ST_Test_Report_ge_executor_c: INIT id=a483fbe0d3314d0ca9d390c35459688e task=official_devcloud_cloudBuild
[job]   ST_Test_Report_ge_autofuse: INIT id=15c27681729a4a288b24a1c5494b3419 task=official_devcloud_cloudBuild
[job]   UT_Test_Report_fe: INIT id=ad544a935b7e467393ff1bdeeba07adf task=official_devcloud_cloudBuild
[job]   ST_Test_Report_fe: INIT id=d62e8bbaf54741bd9962aa36e412f982 task=official_devcloud_cloudBuild
[job]   last_comment: COMPLETED id=6849162f6c0c42df83e8f66c7106c382 task=official_devcloud_cloudBuild

assistant

发现编译失败(compiler 包在多个平台编译失败)。正在获取编译错误日志...

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-log.sh dcd161850837402293f0c47cda6b9921 5a369428242b47d39bef677a4663e467 eecace5686c7491e92be6c6bbdaa8a22 '{\"hook_id\":\"42205\",\"hook_type\":\"project\",\"job_log_url\":null,\"job_run_time\":null,\"pipeline_total_time\":380,\"project_id\":\"8e3ae2e30c3a4cf4a75e4cdc75d41bac\",\"pipeline_host\":\"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com\"}' 50",
  "description": "Get compile error log for X86 compiler"
}

Output:

[2026/05/13 09:25:57.987 GMT+08:00] ***//api/session/session/ge_session_impl.cc:41:3: error: expected primary-expression before ‘}’ token
[2026/05/13 09:25:57.987 GMT+08:00] ***//api/session/session/ge_session_impl.cc:41:3: error: returning a value from a constructor
[2026/05/13 09:25:57.987 GMT+08:00] ***//api/session/session/ge_session_impl.cc:40:11: error: expected ‘;’ before ‘}’ token
[2026/05/13 09:25:57.987 GMT+08:00] make[2]: *** [api/session/CMakeFiles/ge_runner_v2.dir/build.make:93: api/session/CMakeFiles/ge_runner_v2.dir/session/ge_session_impl.cc.o] Error 1
[2026/05/13 09:25:57.987 GMT+08:00] make[1]: *** [CMakeFiles/Makefile2:3735: api/session/CMakeFiles/ge_runner_v2.dir/all] Error 2
[2026/05/13 09:25:57.987 GMT+08:00] make: *** [Makefile:159: all] Error 2
[2026/05/13 09:25:57.987 GMT+08:00] Failed command: make all  -j8
[2026/05/13 09:25:57.987 GMT+08:00] + LOG_ERROR 'Build ge is failed.'
[2026/05/13 09:25:57.987 GMT+08:00] + local 'assert_msg=Build ge is failed.'
[2026/05/13 09:25:57.987 GMT+08:00] + echo -e '\e[1;31m[ERROR] 20260513-092556 Build ge is failed.\e[0m'
[2026/05/13 09:25:57.987 GMT+08:00] [1;31m[ERROR] 20260513-092556 Build ge is failed.[0m
[2026/05/13 09:25:57.988 GMT+08:00] [CloudCache] 2026/05/13 09:25:56 build failed, cmd: [bash -c bash -x CI/pipeline/scripts/build_gitcode.sh] err: exit status 1
[2026/05/13 09:25:58.000 GMT+08:00] [ERROR]  : script returned exit code 1, exitMessage is: command run failed
[2026/05/13 09:26:21.251 GMT+08:00] Finished: FAILURE

assistant

✅ 步骤 5 完成:发现编译错误

失败分析摘要

Job 失败原因 类型 是否需要修复
Compile_X86_compiler_ubuntu24 api/session/session/ge_session_impl.cc:40-41 语法错误:缺少分号或多余 } 编译错误 是
Compile_ARM_compiler_ubuntu24 同上(级联失败) 编译错误 是
Compile_ARM_compiler 同上(级联失败) 编译错误 是
llt Compile_X86_compiler 同上(级联失败) 编译错误 是

具体错误:

api/session/session/ge_session_impl.cc:41:3: error: expected primary-expression before '}' token
api/session/session/ge_session_impl.cc:40:11: error: expected ';' before '}' token

正在拉取 PR 分支代码进行修复...

Tool Call: bash

Input:

{
  "command": "curl -s \"https://api.gitcode.com/api/v5/repos/cann/ge/pulls/2789?access_token=${GITCODE_API_TOKEN}\" | jq -r '.head.ref, .head.sha, .head.repo.full_name'",
  "description": "Get PR 2789 branch info"
}

Output:

master
6460f9b5fa09c243c074a091b3e42029003e4043
stevenaw0/ge

assistant

PR 2789 来自 fork stevenaw0/ge,分支为 master。正在检查本地代码状态...

Tool Call: bash

Input:

{
  "command": "git log --oneline -5",
  "description": "Check recent commits"
}

Output:

6460f9b5 修改ge session
cf5d6c0d !2759 merge develop into master
923e78cf 【feat】: acl_mdl 模块支持 OM2
2197d3d0 !2736 merge develop into master
4c968732 【PR】: 添加dvpp接口废弃声明打印。

Tool Call: read

Input:

{
  "filePath": "/home/ge/code/open/3ge/api/session/session/ge_session_impl.cc",
  "offset": 35,
  "limit": 15
}

Output:

<path>/home/ge/code/open/3ge/api/session/session/ge_session_impl.cc</path>
<type>file</type>
<content>
35: GeSession::Impl::Impl(const std::map<std::string, std::string> &options) {
36:   const auto next_session_id = SessionIdManager::GetNextSessionId();
37:   SessionPtr sessionPtr = MakeShared<InnerSession>(next_session_id, options);
38:   if (sessionPtr == nullptr) {
39:     GELOGE(GE_CLI_INIT_FAILED, "[Init][Create]GeSession failed");
40:     return
41:   }
42:   Status ret = sessionPtr->Initialize();
43:   if (ret != SUCCESS) {
44:     GELOGE(ret, "Construct session failed, error code:%u.", ret);
45:     return;
46:   }
47:   session_id_ = next_session_id;
48:   inner_session_ = sessionPtr;
49:   // 注册到全局 Registry,用于 GEFinalizeV2 时清理

(Showing lines 35-49 of 214. Use offset=50 to continue.)
</content>

assistant

找到问题:第 40 行 return 后缺少分号。正在修复...

Tool Call: bash

Input:

{
  "command": "git remote -v",
  "description": "Check git remotes"
}

Output:

hgjupstream	git@gitcode.com:stevenaw0/ge.git (fetch)
hgjupstream	git@gitcode.com:stevenaw0/ge.git (push)
origin	git@gitcode.com:cann/ge.git (fetch)
origin	git@gitcode.com:cann/ge.git (push)

Tool Call: edit

Input:

{
  "filePath": "/home/ge/code/open/3ge/api/session/session/ge_session_impl.cc",
  "oldString": "if (sessionPtr == nullptr) {\n    GELOGE(GE_CLI_INIT_FAILED, \"[Init][Create]GeSession failed\");\n    return\n  }",
  "newString": "if (sessionPtr == nullptr) {\n    GELOGE(GE_CLI_INIT_FAILED, \"[Init][Create]GeSession failed\");\n    return;\n  }"
}

Output:

Edit applied successfully.
Tool Call: bash

Input:

{
  "command": "git add api/session/session/ge_session_impl.cc && git commit -m \"fix: 补充 return 后缺失的分号\" && git push hgjupstream master",
  "description": "Commit and push fix to fork"
}

Output:

[master 9cf4af93] fix: 补充 return 后缺失的分号
 1 file changed, 1 insertion(+), 1 deletion(-)
remote: Start Git Hooks Checking 					[PASSED]        
To gitcode.com:stevenaw0/ge.git
   6460f9b5..9cf4af93  master -> master

assistant

✅ 步骤 7 完成:已修复代码并 push

正在等待 15 秒后重新触发 CI...

Tool Call: bash

Input:

{
  "command": "sleep 15 && bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-trigger.sh 2789",
  "description": "Trigger CI after push"
}

Output:

ok

assistant

✅ 步骤 3 完成:已重新触发流水线,等待启动...

Tool Call: bash

Input:

{
  "command": "sleep 15 && bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-list.sh 2789",
  "description": "Check new pipeline status"
}

Output:

id=568913 status=running sha=9cf4af932073 ref=master created=2026-05-13T09:31:41.539+08:00 pipeline_id=c85338dd05464b82b0a098dacc32415d pipeline_run_id=c2c5364089af467d953fac8866773373 pipeline_detail={"hook_id":"42205","hook_type":"project","job_log_url":null,"job_run_time":null,"pipeline_total_time":null,"project_id":"8e3ae2e30c3a4cf4a75e4cdc75d41bac","pipeline_host":"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com"}

assistant

✅ 流水线 #568913 已启动(SHA: 9cf4af93),状态: RUNNING

开始轮询流水线状态...

Tool Call: bash

Input:

{
  "command": "while true; do\n  sleep 60\n  result=$(bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-list.sh 2789)\n  echo \"$(date '+%Y-%m-%d %H:%M:%S') - $result\"\n  status=$(echo \"$result\" | grep -oP 'status=\\K[^\\s]+' | head -1)\n  if [[ \"$status\" == \"success\" ]] || [[ \"$status\" == \"failed\" ]] || [[ \"$status\" == \"canceled\" ]]; then\n    echo \"流水线已完成,最终状态: $status\"\n    break\n  fi\ndone",
  "description": "Poll pipeline status until completion",
  "timeout": 600000
}

Output:

2026-05-13 09:33:09 - id=568913 status=running 
2026-05-13 09:34:10 - id=568913 status=running 
2026-05-13 09:35:10 - id=568913 status=running 
2026-05-13 09:36:11 - id=568913 status=running 
2026-05-13 09:37:12 - id=568913 status=running 
2026-05-13 09:38:12 - id=568913 status=running 
2026-05-13 09:39:12 - id=568913 status=running 
2026-05-13 09:40:13 - id=568913 status=running 
2026-05-13 09:41:13 - id=568913 status=running 

<bash_metadata>
bash tool terminated command after exceeding timeout 600000 ms. If this command is expected to take longer and is not waiting for interactive input, retry with a larger timeout value in milliseconds.
</bash_metadata>

assistant

轮询超时,正在检查最新状态...

Tool Call: bash

Input:

{
  "command": "bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-list.sh 2789",
  "description": "Check current pipeline status"
}

Output:

id=568913 status=running sha=9cf4af932073 ref=master created=2026-05-13T09:31:41.539+08:00 pipeline_id=c85338dd05464b82b0a098dacc32415d pipeline_run_id=c2c5364089af467d953fac8866773373 pipeline_detail={"hook_id":"42205","hook_type":"project","job_log_url":null,"job_run_time":null,"pipeline_total_time":null,"project_id":"8e3ae2e30c3a4cf4a75e4cdc75d41bac","pipeline_host":"https://cloudpipeline-ext.cn-north-4.myhuaweicloud.com"}

assistant

流水线仍在运行,继续轮询...

Tool Call: bash

Input:

{
  "command": "while true; do\n  sleep 60\n  result=$(bash /home/ge/code/open/3ge/.claude/skills/_remote/gitcode-pipeline/scripts/gp-list.sh 2789)\n  echo \"$(date '+%Y-%m-%d %H:%M:%S') - $result\"\n  status=$(echo \"$result\" | grep -oP 'status=\\K[^\\s]+' | head -1)\n  if [[ \"$status\" == \"success\" ]] || [[ \"$status\" == \"failed\" ]] || [[ \"$status\" == \"canceled\" ]]; then\n    echo \"流水线已完成,最终状态: $status\"\n    break\n  fi\ndone",
  "description": "Continue polling pipeline status",
  "timeout": 600000
}

Output:

2026-05-13 09:43:24 - id=568913 status=running 
2026-05-13 09:44:25 - id=568913 status=running 
2026-05-13 09:45:25 - id=568913 status=running 
2026-05-13 09:46:26 - id=568913 status=running 
2026-05-13 09:47:26 - id=568913 status=running 
2026-05-13 09:48:27 - id=568913 status=running 
2026-05-13 09:49:27 - id=568913 status=success 
流水线已完成,最终状态: success

assistant

✅ 流水线 #568913 通过!

正在验证 PR label...

Tool Call: bash

Input:

{
  "command": "curl -s \"https://api.gitcode.com/api/v5/repos/cann/ge/pulls/2789?access_token=${GITCODE_API_TOKEN}\" | jq -r '.labels[]?.name'",
  "description": "Verify ci-pipeline-passed label"
}

Output:

cann-cla/yes
stat/needs-squash
ci-pipeline-passed

assistant

执行完成

✅ PR 2789 CI 通过

项目 结果
流水线 ID #568913
状态 SUCCESS
运行时间 1017 秒 (~17 分钟)
PR Label ci-pipeline-passed 已添加

修复摘要:

  • 发现编译错误:api/session/session/ge_session_impl.cc:40 第 return 后缺失分号
  • 已修复并 push 到 fork (stevenaw0/ge)
  • 重新触发 CI 后成功通过
likedislike
黄桂军黄桂军成员
5月13日 将 stevenaw0 设为负责人
黄桂军黄桂军成员
5月13日 修改标题为 “[例子]gitcode-pipeline触发流水线,间隔60s查询状态,自动下载日志,解决编译报错,push后重新触发CI”,原标题为“gitcode-pipeline触发流水线,间隔60s查询状态,自动下载日志,解决编译报错,push后重新触发CI”