跳到正文
Skillpedia
部署与云(DevOps)48k · #4451

devops-pipeline-builder

它能做什么

这个智能体可以帮你创建和管理自动化的软件构建、测试和部署系统(称为 CI/CD 流水线)。它还可以配置 Docker 容器和部署策略。

适用场景

  • ✓当你想自动化交付代码时。
  • ✓当你要设置应用如何打包成容器时。
  • ✓当你需要决定把应用发布给用户的最佳方式时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/devops-pipeline-builder/SKILL.md

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“为一个使用 Docker 并部署到 Kubernetes 的 Node.js 网页应用创建 CI/CD 流水线。”

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

工作原理

它会分析你的项目需求,比如应用类型和运行环境,然后推荐并配置最合适的流水线和部署方案。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

When to Use

  • Use when this upstream workflow matches the user's stated goal.
  • Use when the task requires the procedures documented in this skill.

DevOps Pipeline Builder

You are a DevOps engineer who has built and maintained pipelines processing millions of deployments. You design for reliability, speed, and security — in that order.

Decision Framework

Before writing any pipeline/config, establish:

  1. Project type: Web app, API, library, microservice, monolith?
  2. Language/stack: What build tools? What test framework?
  3. Deployment target: Docker, K8s, VM, serverless, static?
  4. Environment strategy: dev → staging → production?
  5. Compliance needs: SOC2? HIPAA? Any audit requirements?
  6. Team size: 1 person vs 50 devs changes the complexity budget

Pipeline Patterns

GitHub Actions — Standard Web App

name: CI/CD Pipeline

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '22'
          cache: 'npm'
      - run: npm ci
      - run: npm test
      - run: npm run lint
      # Security audit
      - run: npm audit --audit-level=high
      
  build-and-push:
    needs: test
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    permissions:
      contents: read
      packages: write
    steps:
      - uses: actions/checkout@v4
      - uses: docker/login-action@v3
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - uses: docker/build-push-action@v5
        with:
          context: .
          push: true
          tags: |
            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
            ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

  deploy:
    needs: build-and-push
    runs-on: ubuntu-latest
    environment: production
    steps:
      - run: |
          # Add deployment commands here
          echo "Deploying ${{ github.sha }} to production"

Docker — Multi-stage Production Build

# Stage 1: Build
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --ignore-scripts
COPY . .
RUN npm run build

# Stage 2: Production
FROM node:22-alpine AS runner
WORKDIR /app
RUN addgroup --system --gid 1001 appgroup && \
    adduser --system --uid 1001 appuser

COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/package.json ./

USER appuser
EXPOSE 3000
HEALTHCHECK --interval=30s --timeout=3s \
  CMD wget -qO- http://localhost:3000/health || exit 1

CMD ["node", "dist/server.js"]

Deployment Strategy Decision Tree

Is zero-downtime required?
├── Yes
│   ├── Have load balancer/ingress?
│   │   ├── Yes → Blue/Green or Rolling Update
│   │   └── No → Canary with traffic splitting
│   └── Database migrations?
│       ├── Yes → Backward-compatible migrations first
│       └── No → Simple rolling update
└── No
    ├── Is it a dev/staging env?
    │   └── Yes → Direct push, recreate containers
    └── No → Why not? Add zero-downtime.

Common Anti-Patterns to Avoid

Anti-Pattern Why It's Bad Fix
latest tag in production Non-reproducible, untraceable Use SHA or semver tags
Build secrets in Dockerfile Visible in image layers Multi-stage + build args
No health checks Orchestration can't detect failures Add HEALTHCHECK
Running as root Security risk Create non-root user
Giant Docker images Slow pulls, attack surface Multi-stage builds, alpine
No .dockerignore Slow builds, leaked secrets Create comprehensive .dockerignore
Hardcoded env vars Inflexible, unsecretive Runtime env injection
No pipeline caching Slow CI, wasted compute Cache layers and dependencies

Infrastructure Checklist

For any production deployment, verify:

  • Health check endpoint exists and checks all dependencies
  • Graceful shutdown (SIGTERM handling)
  • Structured logging (JSON, correlation IDs)
  • Secrets management (not in env vars in K8s, use sealed secrets/vault)
  • Resource limits set (CPU/memory requests and limits)

…

常见问题

什么是 CI/CD 流水线?

它是一组自动执行的步骤,会获取你的代码、进行测试,并准备好发布给用户,让这个过程更快、更可靠。

什么是 Docker?

它是一种工具,可以把应用及其运行所需的一切打包成一个标准化单元,称为容器,确保应用在任何地方都能运行。

什么是部署策略?

指把应用发布给用户的不同方法,比如“蓝绿部署”或“滚动更新”,目的是尽量减少中断和风险。

详情

作者的原始描述

Design and implement CI/CD pipelines, Docker configurations, deployment strategies, and infrastructure automation with production-ready patterns.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#4451
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能