From ae17c43b23325c782377b18758805391f3348d71 Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:19:01 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 15 ++ README.md | 3 + commands/ci-cd-build.md | 206 ++++++++++++++++++ plugin.lock.json | 61 ++++++ skills/ci-cd-pipeline-builder/SKILL.md | 52 +++++ .../ci-cd-pipeline-builder/assets/README.md | 8 + .../references/README.md | 9 + .../ci-cd-pipeline-builder/scripts/README.md | 8 + 8 files changed, 362 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/ci-cd-build.md create mode 100644 plugin.lock.json create mode 100644 skills/ci-cd-pipeline-builder/SKILL.md create mode 100644 skills/ci-cd-pipeline-builder/assets/README.md create mode 100644 skills/ci-cd-pipeline-builder/references/README.md create mode 100644 skills/ci-cd-pipeline-builder/scripts/README.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..5052665 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "ci-cd-pipeline-builder", + "description": "Build CI/CD pipelines for GitHub Actions, GitLab CI, Jenkins, and more", + "version": "1.0.0", + "author": { + "name": "Claude Code Plugins", + "email": "[email protected]" + }, + "skills": [ + "./skills" + ], + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..f214c9e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ci-cd-pipeline-builder + +Build CI/CD pipelines for GitHub Actions, GitLab CI, Jenkins, and more diff --git a/commands/ci-cd-build.md b/commands/ci-cd-build.md new file mode 100644 index 0000000..cb254f0 --- /dev/null +++ b/commands/ci-cd-build.md @@ -0,0 +1,206 @@ +--- +description: Build CI/CD pipelines +--- + +# CI/CD Pipeline Builder + +Generate production-ready CI/CD pipelines for multiple platforms. + +## Pipeline Patterns + +1. **Test Stage**: Unit, integration, E2E tests +2. **Build Stage**: Compile, bundle, containerize +3. **Security Stage**: Vulnerability scanning, SAST/DAST +4. **Deploy Stage**: Staging and production deployment +5. **Monitoring**: Pipeline metrics and alerts + +## GitHub Actions Example + +```yaml +name: CI/CD Pipeline + +on: + push: + branches: [main, develop] + pull_request: + branches: [main] + +env: + NODE_VERSION: '18' + REGISTRY: ghcr.io + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run linter + run: npm run lint + + - name: Run tests + run: npm test -- --coverage + + - name: Upload coverage + uses: codecov/codecov-action@v3 + + security: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Run Trivy vulnerability scanner + uses: aquasecurity/trivy-action@master + with: + scan-type: 'fs' + severity: 'CRITICAL,HIGH' + + - name: Run CodeQL analysis + uses: github/codeql-action/analyze@v2 + + build: + needs: [test, security] + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ github.repository }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=sha,prefix={{branch}}- + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + deploy-staging: + needs: build + if: github.ref == 'refs/heads/develop' + runs-on: ubuntu-latest + environment: + name: staging + url: https://staging.example.com + steps: + - name: Deploy to Kubernetes + run: | + kubectl set image deployment/app \ + app=${{ env.REGISTRY }}/${{ github.repository }}:develop-${{ github.sha }} \ + --namespace=staging + + deploy-production: + needs: build + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + environment: + name: production + url: https://example.com + steps: + - name: Deploy to Kubernetes + run: | + kubectl set image deployment/app \ + app=${{ env.REGISTRY }}/${{ github.repository }}:main-${{ github.sha }} \ + --namespace=production + + - name: Notify deployment + uses: slackapi/slack-github-action@v1 + with: + webhook-url: ${{ secrets.SLACK_WEBHOOK }} + payload: | + { + "text": "Production deployment successful!" + } +``` + +## GitLab CI Example + +```yaml +stages: + - test + - build + - deploy + +variables: + DOCKER_DRIVER: overlay2 + DOCKER_TLS_CERTDIR: "/certs" + +test: + stage: test + image: node:18 + cache: + paths: + - node_modules/ + script: + - npm ci + - npm run lint + - npm test + coverage: '/Lines\s*:\s*(\d+\.\d+)%/' + artifacts: + reports: + coverage_report: + coverage_format: cobertura + path: coverage/cobertura-coverage.xml + +security: + stage: test + image: aquasec/trivy:latest + script: + - trivy fs --severity HIGH,CRITICAL . + +build: + stage: build + image: docker:latest + services: + - docker:dind + script: + - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA . + - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA + +deploy:production: + stage: deploy + image: bitnami/kubectl:latest + script: + - kubectl set image deployment/app app=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA + only: + - main + environment: + name: production + url: https://example.com +``` + +## When Invoked + +Generate complete CI/CD pipeline configurations for your platform of choice with best practices. diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..f6bf090 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,61 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/devops/ci-cd-pipeline-builder", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "d8b01bd3c78e1fa2d6972cb04a25067c43c6d65b", + "treeHash": "58cf93b32d240c7782022721db3cb08ec9d28c62fcab12a8aa7c17d4b07fe7b1", + "generatedAt": "2025-11-28T10:18:12.648319Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "ci-cd-pipeline-builder", + "description": "Build CI/CD pipelines for GitHub Actions, GitLab CI, Jenkins, and more", + "version": "1.0.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "2be3fe60a89574d4d732709f85a59f65a6f085acdc53b330322f0994a13925bf" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "f9772fe695dee288827a2cfc4ed9765c3a97590fbe0fca8e5acd73ba8fded040" + }, + { + "path": "commands/ci-cd-build.md", + "sha256": "70f75e94be42fd7e7ef742c78765c1e4d36d6c7c23a2f2fe711a4b5c60bf3b84" + }, + { + "path": "skills/ci-cd-pipeline-builder/SKILL.md", + "sha256": "58a835c57b5cec4b81e5b546e8e249fa488b9c21a1db207ae42d84874ad21098" + }, + { + "path": "skills/ci-cd-pipeline-builder/references/README.md", + "sha256": "d50ce970b1926666c700639edfb0f806f5b2918303e217fe95e8224866d6a33d" + }, + { + "path": "skills/ci-cd-pipeline-builder/scripts/README.md", + "sha256": "e248d9fd009f7555234836ba23ced44d0168a66c907322e17a956eac5be87456" + }, + { + "path": "skills/ci-cd-pipeline-builder/assets/README.md", + "sha256": "48781a0ddbc28f3a5b78441b2b7c9a51d7420c15d7daad52cfec5f313c312c54" + } + ], + "dirSha256": "58cf93b32d240c7782022721db3cb08ec9d28c62fcab12a8aa7c17d4b07fe7b1" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/ci-cd-pipeline-builder/SKILL.md b/skills/ci-cd-pipeline-builder/SKILL.md new file mode 100644 index 0000000..0de07f7 --- /dev/null +++ b/skills/ci-cd-pipeline-builder/SKILL.md @@ -0,0 +1,52 @@ +--- +name: building-cicd-pipelines +description: | + This skill enables Claude to generate CI/CD pipeline configurations for various platforms, including GitHub Actions, GitLab CI, and Jenkins. It is used when a user requests the creation of a CI/CD pipeline, specifies a platform (e.g., "GitHub Actions"), or mentions specific pipeline stages like "test," "build," "security," or "deploy." This skill is also useful when the user needs to automate software delivery, integrate security scanning, or set up multi-environment deployments. The skill is triggered by terms such as "CI/CD pipeline," "GitHub Actions pipeline," "GitLab CI configuration," or "Jenkins pipeline." +allowed-tools: Read, Write, Edit, Grep, Glob, Bash +version: 1.0.0 +--- + +## Overview + +This skill empowers Claude to build production-ready CI/CD pipelines, automating software development workflows. It supports multiple platforms and incorporates best practices for testing, building, security, and deployment. + +## How It Works + +1. **Receiving User Request**: Claude receives a request for a CI/CD pipeline, including the target platform and desired stages. +2. **Generating Configuration**: Claude generates the CI/CD pipeline configuration file (e.g., YAML for GitHub Actions or GitLab CI, Groovy for Jenkins). +3. **Presenting Configuration**: Claude presents the generated configuration to the user for review and deployment. + +## When to Use This Skill + +This skill activates when you need to: +- Create a CI/CD pipeline for a software project. +- Generate a CI/CD configuration file for GitHub Actions, GitLab CI, or Jenkins. +- Automate testing, building, security scanning, and deployment processes. + +## Examples + +### Example 1: Creating a GitHub Actions Pipeline + +User request: "Create a GitHub Actions pipeline with test, build, and deploy stages." + +The skill will: +1. Generate a `github-actions.yml` file with defined test, build, and deploy stages. +2. Present the generated YAML configuration to the user. + +### Example 2: Generating a GitLab CI Configuration + +User request: "Generate a GitLab CI configuration that includes security scanning." + +The skill will: +1. Generate a `.gitlab-ci.yml` file with test, build, security, and deploy stages, including vulnerability scanning. +2. Present the generated YAML configuration to the user. + +## Best Practices + +- **Security**: Integrate static and dynamic analysis tools into the pipeline to identify vulnerabilities early. +- **Testing**: Include unit, integration, and end-to-end tests to ensure code quality. +- **Deployment**: Use infrastructure-as-code tools to automate infrastructure provisioning and deployment. + +## Integration + +This skill can be used in conjunction with other plugins to automate infrastructure provisioning, security scanning, and deployment processes. For example, it can work with a cloud deployment plugin to automatically deploy applications to AWS, Azure, or GCP after the CI/CD pipeline successfully builds and tests the code. \ No newline at end of file diff --git a/skills/ci-cd-pipeline-builder/assets/README.md b/skills/ci-cd-pipeline-builder/assets/README.md new file mode 100644 index 0000000..6175b62 --- /dev/null +++ b/skills/ci-cd-pipeline-builder/assets/README.md @@ -0,0 +1,8 @@ +# Assets + +Bundled resources for ci-cd-pipeline-builder skill + +- [ ] github_actions_template.yml Template for GitHub Actions pipelines. +- [ ] gitlab_ci_template.yml Template for GitLab CI pipelines. +- [ ] jenkins_template.groovy Template for Jenkins pipelines. +- [ ] example_pipeline_configurations/ Example configurations for various use cases (e.g., web app deployment, microservice deployment). diff --git a/skills/ci-cd-pipeline-builder/references/README.md b/skills/ci-cd-pipeline-builder/references/README.md new file mode 100644 index 0000000..2b4f8a9 --- /dev/null +++ b/skills/ci-cd-pipeline-builder/references/README.md @@ -0,0 +1,9 @@ +# References + +Bundled resources for ci-cd-pipeline-builder skill + +- [ ] github_actions_reference.md Detailed documentation for GitHub Actions syntax and features. +- [ ] gitlab_ci_reference.md Detailed documentation for GitLab CI syntax and features. +- [ ] jenkins_reference.md Detailed documentation for Jenkins syntax and features. +- [ ] security_best_practices.md Best practices for securing CI/CD pipelines. +- [ ] pipeline_stages_explained.md Explanation of common pipeline stages (test, build, deploy, etc.). diff --git a/skills/ci-cd-pipeline-builder/scripts/README.md b/skills/ci-cd-pipeline-builder/scripts/README.md new file mode 100644 index 0000000..19630ab --- /dev/null +++ b/skills/ci-cd-pipeline-builder/scripts/README.md @@ -0,0 +1,8 @@ +# Scripts + +Bundled resources for ci-cd-pipeline-builder skill + +- [ ] pipeline_generator.py Generates pipeline configurations based on user input and platform. +- [ ] validator.py Validates pipeline configurations for syntax and best practices. +- [ ] security_scan.sh Executes security scans on the pipeline configuration. +- [ ] deploy.sh Deploys the generated pipeline to the specified platform.