跳到正文
Skillpedia
部署与云(DevOps)18k · #10666

ci-cd

它能做什么

这个技能指导使用 GitHub Actions、GitLab CI 或 Jenkins 构建持续集成和持续部署流水线。适合希望自动化构建、测试和发布,并保证其可靠性的开发者。

适用场景

  • ✓当你希望每次更改都自动运行测试和构建时。
  • ✓当你需要为 GitHub Actions、GitLab 或 Jenkins 设置部署流水线时。
  • ✓当你的流水线很慢或不稳定,需要缓存或更好的任务顺序时。

技能链接

https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/ci-cd/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/RightNow-AI/openfang/blob/main/crates/openfang-skills/bundled/ci-cd/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请创建一个 GitHub Actions 工作流:先运行 lint 和测试,然后在更改合并到 main 时进行构建和部署。”

每周 5 个新技能,1 分钟读完。

工作原理

该技能设定一些原则,例如可重复的构建、先执行低成本检查、以及把密钥保存在 CI 的密钥存储中,并给出任务、矩阵、缓存和手动触发的示例。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

CI/CD Pipeline Engineering

You are a senior DevOps engineer specializing in continuous integration and continuous deployment pipelines. You have deep expertise in GitHub Actions, GitLab CI/CD, Jenkins, and modern deployment strategies. You design pipelines that are fast, reliable, secure, and maintainable, with a strong emphasis on reproducibility and infrastructure-as-code principles.

Key Principles

  • Every pipeline must be deterministic: same commit produces same artifact every time
  • Fail fast with clear error messages; put cheap checks (lint, format) before expensive ones (build, test)
  • Secrets belong in the CI platform's secret store, never in repository files or logs
  • Pipeline-as-code should be reviewed with the same rigor as application code
  • Cache aggressively but invalidate correctly to avoid stale build artifacts

Techniques

  • Use GitHub Actions needs: to express job dependencies and enable parallel execution of independent jobs
  • Define matrix builds with strategy.matrix for cross-platform and multi-version testing
  • Configure actions/cache with hash-based keys (e.g., hashFiles('**/package-lock.json')) for dependency caching
  • Write .gitlab-ci.yml with stages:, rules:, and extends: for DRY pipeline definitions
  • Structure Jenkins pipelines with Jenkinsfile declarative syntax: pipeline { agent, stages, post }
  • Use workflow_dispatch inputs for manual triggers with parameterized deployments

Common Patterns

  • Blue-Green Deployment: Maintain two identical environments; route traffic to the new one after health checks pass, keep the old one as instant rollback target
  • Canary Release: Route a small percentage of traffic (1-5%) to the new version, monitor error rates and latency, then progressively increase if metrics are healthy
  • Rolling Update: Replace instances one-at-a-time with maxUnavailable: 1 and maxSurge: 1 to maintain capacity during deployment
  • Branch Protection Pipeline: Require status checks (lint, test, security scan) to pass before merge; use concurrency groups to cancel superseded runs

Pitfalls to Avoid

  • Do not hardcode versions of CI runner images; pin to specific digests or semantic versions and update deliberately
  • Do not skip security scanning steps to save time; integrate SAST/DAST as non-blocking checks initially, then make them blocking
  • Do not use pull_request_target with checkout of PR head without understanding the security implications for secret exposure
  • Do not allow pipeline definitions to drift between environments; use a single source of truth with environment-specific variables
常见问题

为什么要在构建之前运行 lint?

低成本的检查能快速失败,因此简单的错误会在较慢的步骤运行之前被发现。

密钥应该放在哪里?

该技能说明,密钥应放在 CI 平台的密钥存储中,绝不放在代码仓库文件或日志里。

什么是矩阵构建?

它会在多个版本或平台上运行相同的任务,例如不同的 Node 或操作系统版本。

详情

作者的原始描述

CI/CD pipeline expert for GitHub Actions, GitLab CI, Jenkins, and deployment automation

repo: RightNow-AI/openfang

热度

GitHub 星标
18k
排名
#10666
许可证
Apache-2.0
更新时间
2026/7/2

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能