ns-gitlab-ci-generator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitLab CI Generator

GitLab CI 生成器

Produce
.gitlab-ci.yml
for backend + frontend SaaS layouts.
为后端+前端架构的SaaS产品生成
.gitlab-ci.yml
文件。

Session boot

会话启动

Load
.nextstage-harness/rules/infra-rules.mdc
,
backend-tests-rules.mdc
,
e2e-tests-rules.mdc
when present. Read
docker-compose.yml
.
若存在
.nextstage-harness/rules/infra-rules.mdc
backend-tests-rules.mdc
e2e-tests-rules.mdc
则加载这些文件。读取
docker-compose.yml
文件。

When to use

使用场景

  • Create or adjust
    .gitlab-ci.yml
  • product_class
    saas or intelligent_saas (backend + frontend required)
  • Branch-based test/build/deploy
  • 创建或调整
    .gitlab-ci.yml
    文件
  • product_class
    为saas或intelligent_saas(要求包含后端+前端)
  • 基于分支的测试/构建/部署

Out of scope

不适用于以下场景

  • agent_runtime
    -only pipelines
  • Cloud provisioning beyond template contract
  • 仅包含
    agent_runtime
    的流水线
  • 超出模板约定范围的云资源配置

Inputs

输入信息

  • Target branches (minimum: develop, homolog, main)
  • E2E folder name (
    testes-cypress
    ,
    tests-e2e
    , or
    frontend/cypress
    )
  • 目标分支(至少包含:develop、homolog、main)
  • E2E文件夹名称(如
    testes-cypress
    tests-e2e
    frontend/cypress

Workflow

工作流程

A — Copy baseline

A — 复制基准模板

Copy
references/templates/gitlab-ci.template.yml
to
.gitlab-ci.yml
Paths are repo-relative (
backend/
,
frontend/
).
references/templates/gitlab-ci.template.yml
复制为
.gitlab-ci.yml
路径为仓库相对路径(如
backend/
frontend/
)。

B — Mandatory adaptations

B — 强制适配项

ItemAction
E2E folderMatch product folder in
changes:
and job
cd
PHP imageAlign to backend Dockerfile
Test commandsMatch
composer.json
/
package.json
Lockfile
yarn.lock
vs
package-lock.json
in cache key
Deploy branchesAdjust regex if not main/homolog/develop
E2E disabledRemove e2e jobs from deploy
needs
or document
RUN_REMOTE_E2E=false
Do not copy another product's CI file — use this template only.
操作说明
E2E文件夹
changes:
配置和
cd
任务中匹配产品对应的文件夹
PHP镜像与后端Dockerfile保持一致
测试命令
composer.json
/
package.json
中的配置匹配
锁文件在缓存键中区分
yarn.lock
package-lock.json
部署分支若分支不是main/homolog/develop,则调整正则表达式
E2E功能禁用从部署任务的
needs
中移除e2e任务,或记录
RUN_REMOTE_E2E=false
配置
请勿复制其他产品的CI文件——仅使用本模板。

C — GitLab CI variables

C — GitLab CI 变量

Document in optional
docs/context/ci-cd-notes.md
:
  • ENV_BACKEND
    ,
    ENV_FRONTEND
    , test DB vars,
    RUN_REMOTE_E2E
    , GCP keys — names only, no secret values
在可选文件
docs/context/ci-cd-notes.md
中记录:
  • ENV_BACKEND
    ENV_FRONTEND
    、测试数据库变量、
    RUN_REMOTE_E2E
    、GCP密钥——仅记录名称,不包含敏感值

D — Validate

D — 验证

Lint YAML; confirm jobs match repo layout.
对YAML文件进行语法检查;确认任务与仓库架构匹配。

References

参考文件

FileWhen
references/templates/gitlab-ci.template.yml
Baseline pipeline
文件路径使用场景
references/templates/gitlab-ci.template.yml
流水线基准模板

Related skills

相关技能

  • ns-e2e-tests
    — E2E folder conventions
  • ns-spec-driven
    references/e2e-test-task-generator.md
    — planning E2E scope
  • ns-e2e-tests
    — E2E文件夹命名规范
  • ns-spec-driven
    references/e2e-test-task-generator.md
    — E2E测试范围规划