service-deployer

Service deployer: automatically deploy two async-type navi-guide services (target branch and baseline branch) locally on a physical machine. Built by adapting install.sh to auto-derive the baseline branch and auto-detect free ports, for invocation by qa-integration-pipeline Phase 0.

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "service-deployer" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-2a2b45febcf3c10c1ad465e6cd7231516b1c14241c4f93165caef6710b1799a9. Verify the upstream source and version against https://skillhub.cn/skills/user_3ddd765c/service-deployer before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Service deployer: automatically deploy two async-type navi-guide services (target branch and baseline branch) locally on a physical machine. Built by adapting install.sh to auto-derive the baseline branch and auto-detect free ports, for invocation by qa-integration-pipeline Phase 0.

0 Downloads

Introduction source: third_party · user_3ddd765c · 1.0.17 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Inputs and outputs
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: service-deployer
description: 在物理机本地自动部署目标分支与基线分支两个 async 类型 navi-guide 服务。基于 install.sh 改造,自动推导基线分支、自动探测空闲端口。qa-integration-pipeline Phase 0 调用。
slug: service-deployer
version: 1.0.17
changelog:
- '1.0.17: 部署后写入配置时使用本机 IP(hostname -I)作为 host/host_baseline 的 IP 部分'
- '1.0.16: 修复基线分支推导逻辑:merge commit 场景下取第二个父提交作为基准,避免 diff 包含目标分支新提交'
- '1.0.15: 增加 Step 0 知识库查询功能'
- '1.0.14: deploy_dual.sh增加入口端口重探测逻辑,install_target/install_baseline内部删除重复检查,统一依赖入口探测;SKILL.md步骤5更新为解析实际端口写入config'
- '1.0.13: mock_data_manager.py改为python3版本,deploy_dual.sh同步使用python3启动'
- '1.0.12: deploy_dual.sh dual模式自动检查/启动灵犀mock脚本(自动获取版本号、端口检测、失败阻断)'
- '1.0.11: 补充灵犀mock脚本完整用法:版本号获取、启动顺序、切换版本流程'
- '1.0.10: 增加mock_data_manager.py灵犀脚本,dual模式road_data_manager地址修正为127.0.0.1:8098/api/machine/status'
- '1.0.9: 增加data_mode参数(single/dual),支持双版本数据部署(enable_road_data_manager=1 + 本地灵犀127.0.0.1)'
displayName: Service Deployer

Service Deployer

在物理机本地部署目标分支 + 基线分支两个 async 类型 navi-guide 服务。

参数

参数 必填 默认值 说明
feature ✅ - 功能名
home ❌ /home/xiaoju/map-spec-deploy 基线服务部署根目录(目标服务使用当前工作目录)
data_mode ❌ single 数据加载模式:single(单版本,默认)/dual(双版本,需本地灵犀脚本)

target_branch 自动读取当前分支,baseline_branch 自动推导,type 固定为 async。均无需传入。

数据模式说明:

  • single:enable_road_data_manager = 0,使用远程数据管理 10.74.92.51:9012

  • dual:enable_road_data_manager = 1,road_data_manager = "127.0.0.1:8098/api/machine/status",加载双版本数据。启动顺序:先启动灵犀 mock 脚本 → 再启动服务。

    获取数据版本号:

    ls /home/xiaoju/data_ng_master_90001/ | grep -E '^[0-9]+$' | sort -rn | head -2

    启动灵犀 mock 脚本(以版本 2026062912 和 2026062999 为例,2026062999 为稳定版):

    python testing/service-deployer/mock_data_manager.py \
      --port 8098 \
      --data_list "2026062912,2026062999" \
      --stable_version "2026062999"

    脚本位置:testing/service-deployer/mock_data_manager.py

    • 服务默认优先使用稳定版(stable_version)
    • 切换数据版本时:杀掉 mock 脚本 → 修改 --stable_version → 重新启动 mock 脚本,服务无需重启

返回 JSON

{
  "status": "success",
  "target": { "branch": "...", "host": "ip:port", "brpc_port": ... },
  "baseline": { "branch": "...", "host": "ip:port", "brpc_port": ... }
}

执行流程

Step 0: 知识库查询(可选)

在部署服务前,可查询 LLM-Wiki 知识库获取服务部署配置和环境设置经验:

POST http://10.190.56.84:8080/search
Content-Type: application/json

{
  "collection": "navi-guide-qa-knowledge",
  "query": "navi-guide 服务部署 async 端口配置 环境设置",
  "limit": 5
}

查询时机:

  • 部署前:查询历史部署配置参数、端口使用规范、data_mode 设置经验
  • 部署失败时:查询常见部署错误和解决方案(如端口占用、分支推导失败等)
  • dual 模式部署时:查询灵犀 mock 脚本使用经验和双版本数据配置

检索结果应用:

  • 参考历史部署经验,优化端口探测和参数配置
  • 借鉴历史故障处理方案,加速部署问题恢复

Step 1: 获取当前分支

target_branch=$(git rev-parse --abbrev-ref HEAD)

Step 2: 推导基线分支

CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
REMOTE_BRANCH_COMMIT=$(git rev-parse origin/${CURRENT_BRANCH})

# 检查远程分支最新提交是否是 merge commit(feature 分支可能被 rebase 到了目标分支最新提交)
PARENTS=$(git show --no-patch --format="%P" ${REMOTE_BRANCH_COMMIT} | wc -w)

if [ "${PARENTS}" -eq 2 ]; then
  # merge commit 的第二个父提交是 feature 分支原始的基线提交
  # 避免使用被 rebase 后的最新共同祖先(会包含目标分支的新提交)
  BASELINE_COMMIT=$(git show --no-patch --format="%P" ${REMOTE_BRANCH_COMMIT} | awk '{print $2}')
  baseline_branch=$(git branch -r --contains ${BASELINE_COMMIT} | grep -E 'p-docker-dev|master' | head -1 | sed 's|origin/||')
else
  # 非 merge commit,使用原有逻辑:找最新共同祖先
  BASE_COMMIT=$(git merge-base origin/p-docker-dev HEAD)
  baseline_branch=$(git branch -r --contains ${BASE_COMMIT} | grep -E 'p-docker-dev|master' | head -1 | sed 's|origin/||')
fi

Step 3: 本地探测端口

find_free_port() {
  local start=$1 port=$start
  while ss -tln | awk '{print $4}' | grep -q ":$port "; do
    ((port++)); [ "$port" -gt "$((start+500))" ] && { echo "NO_FREE_PORT"; return 1; }
  done
  echo "$port"
}
PORT_TARGET=$(find_free_port 10100)
BRPC_TARGET=$((PORT_TARGET+100))
PORT_BASE=$(find_free_port $((PORT_TARGET+2)))
BRPC_BASE=$((PORT_BASE+100))

Step 4: 执行部署脚本

bash deploy_dual.sh "${home}" "${target_branch}" "${baseline_branch}" \
  "${PORT_TARGET}" "${BRPC_TARGET}" "${PORT_BASE}" "${BRPC_BASE}" "${data_mode}"

脚本位置:testing/service-deployer/deploy_dual.sh

data_mode 默认 single,由调用方根据需求是否涉及数据版本切换传入。

Step 5: 更新配置

deploy_dual.sh 执行完成后,解析其标准输出中的实际端口:

# 从输出中提取实际端口(deploy_dual.sh 内部可能因端口抢占自动重选)
ACTUAL_PORT_TARGET=$(echo "$deploy_output" | grep '^TARGET: port=' | sed 's/.*port=//;s/ brpc=.*//')
ACTUAL_PORT_BASE=$(echo "$deploy_output" | grep '^BASELINE: port=' | sed 's/.*port=//;s/ brpc=.*//')

获取本机 IP 并写入配置:

LOCAL_IP=$(hostname -I | awk '{print $1}')
{ "host": "${LOCAL_IP}:${ACTUAL_PORT_TARGET}", "host_baseline": "${LOCAL_IP}:${ACTUAL_PORT_BASE}", "git_branch": "<target_branch>" }

注意:deploy_dual.sh 在入口已内置 find_free_port 重探测逻辑,若传入端口被抢占会自动递增。上述解析确保 config 中写入的是实际使用端口而非传入端口。

Step 6: 生成报告

输出部署报告:<CASE_DIR>/<feature>/deploy_report.md

脚本说明

deploy_dual.sh 基于 install.sh 改造,固定 async 类型,本地执行。 参数:home target_branch baseline_branch port_target brpc_target port_baseline brpc_baseline data_mode

  • 目标服务:使用当前工作目录代码(map-spec 测试阶段代码尚未 push),在当前目录执行 build.sh + ngbuild.sh release,不执行任何 git clone/git reset
  • 基线服务:git clone 基线分支到 ${home}/navi-guide,独立目录构建
  • 两个服务进程名均为 navi-guide-server,通过目录路径区分
  • 并行构建与启动,失败自动清理残留服务
  • 返回 TARGET_DEPLOY_FAILED 或 BASELINE_DEPLOY_FAILED 标识失败

Current listing version

1.0.17

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value75/100

Highlights

  • 提供自动推导基线分支和探测空闲端口功能
  • 支持双版本数据部署模式
Trigger Precision90/100

Highlights

  • 触发词精准完整,覆盖多种变体
  • 边界清晰,描述详细
Structure and Standards90/100

Highlights

  • Phase/步骤清晰,有出口条件
  • 含端到端示例,frontmatter完整
Execution Reliability85/100

Highlights

  • 工具来源明确,参数正确
  • 覆盖主要异常,不可逆操作有确认机制
Evidence Verifiability (mean of the first four)85/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Invoke commands or scripts

    Read the script and arguments first. Use ordinary privileges and a scoped directory; confirm installation or execution in your host tool.

    Mentioned in main document · lines 134
Domains or addresses referenced in the document

These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.

  • 10.190.56.84

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.