Gitlab Cicd Pipeline

aj-geddes/useful-ai-prompts/skills/gitlab-cicd-pipeline

作者 aj-geddes3f5182cfd739無授權條款355 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 個月前更新

Design and implement GitLab CI/CD pipelines with stages, jobs, artifacts, and caching. Configure runners, Docker integration, and deployment strategies.

包含腳本DevOps & Cloud
AI 產生的概覽

設計 GitLab CI/CD 流程,涵蓋階段、工作、快取、Runner、Docker 與 Kubernetes 部署。

功能
提供建置 GitLab CI/CD 流程的指引與參考資料,涵蓋階段、工作、產出物、快取、Runner 設定、Docker 層快取、多專案流程以及 Kubernetes 部署。內含最小的 .gitlab-ci.yml 範例、流程範本和驗證指令碼。交付內容是流程設定與部署方案,而非應用程式程式碼。
適用情境
適用於為 GitLab 儲存庫建立或改善 CI/CD 的情境,包括多階段建置、Docker 登錄檔整合、Review App 或 Kubernetes 部署,以及快取最佳化。
執行需求
需要具備 CI/CD 的 GitLab 儲存庫與 GitLab Runner 基礎架構;容器與部署步驟需要 Docker 和 Kubernetes 存取權。附可執行驗證指令碼與流程範本。

GitLab CI/CD Pipeline

Table of Contents

Overview

Create comprehensive GitLab CI/CD pipelines that automate building, testing, and deployment using GitLab Runner infrastructure and container execution.

When to Use

  • GitLab repository CI/CD setup
  • Multi-stage build pipelines
  • Docker registry integration
  • Kubernetes deployment
  • Review app deployment
  • Cache optimization
  • Dependency management

Quick Start

Minimal working example:

yaml
# .gitlab-ci.ymlimage: node:18-alpine
variables:  DOCKER_DRIVER: overlay2  FF_USE_FASTZIP: "true"
stages:  - lint  - test  - build  - security  - deploy-review  - deploy-prod
cache:  key: ${CI_COMMIT_REF_SLUG}  paths:    - node_modules/    - .npm/
lint:  stage: lint  script:    - npm install// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

GuideContents
Complete Pipeline Configuration [blocked]Complete Pipeline Configuration
GitLab Runner Configuration [blocked]GitLab Runner Configuration
Docker Layer Caching Optimization [blocked]Docker Layer Caching Optimization
Multi-Project Pipeline [blocked]Multi-Project Pipeline
Kubernetes Deployment [blocked]Kubernetes Deployment, Performance Testing Stage, Release Pipeline with Semantic Versioning

Best Practices

✅ DO

  • Use stages to organize pipeline flow
  • Implement caching for dependencies
  • Use artifacts for test reports
  • Set appropriate cache keys
  • Implement conditional execution with only and except
  • Use needs: for job dependencies
  • Clean up artifacts with expire_in
  • Use Docker for consistent environments
  • Implement security scanning stages
  • Set resource limits for jobs
  • Use merge request pipelines

❌ DON'T

  • Run tests serially when parallelizable
  • Cache everything unnecessarily
  • Leave large artifacts indefinitely
  • Store secrets in configuration files
  • Run privileged Docker without necessity
  • Skip security scanning
  • Ignore pipeline failures
  • Use only: [main] without proper controls

來源與署名

來源:aj-geddes/useful-ai-prompts位於skills/gitlab-cicd-pipeline提交3f5182c

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架