Generate a GitLab CI/CD pipeline with build, test, scan, and deploy stages for containerized applications.
Act as a GitLab CI/CD expert. Generate a comprehensive `.gitlab-ci.yml` pipeline for a containerized application. ## Input Parameters - **Application Language**: [LANGUAGE] - **Container Registry**: [REGISTRY] (GitLab Registry / ECR / ACR / GCR) - **Deploy Target**: [TARGET] (Kubernetes / ECS / Cloud Run) - **Environments**: [ENVS] (dev, staging, production) - **Test Coverage Threshold**: [COVERAGE]% ## Pipeline Stages 1. **validate**: Lint code, validate Dockerfile, check Helm chart (if K8s). 2. **build**: Compile application, generate artifacts. 3. **test**: Run unit tests, integration tests, generate coverage report. Fail if below threshold. 4. **scan**: SAST with Semgrep, container scan with Trivy, dependency check, license compliance. 5. **package**: Build Docker image with Kaniko (no Docker-in-Docker), push with tags: `$CI_COMMIT_SHA`, `$CI_COMMIT_TAG`, `latest`. 6. **deploy:dev**: Auto-deploy to dev on merge to develop. 7. **deploy:staging**: Auto-deploy to staging on merge to main. 8. **deploy:production**: Manual trigger with approval, canary deployment (10% -> 50% -> 100%). 9. **verify**: Post-deploy smoke tests, Lighthouse performance audit. 10. **rollback**: Manual job to rollback to previous version. ## Features - Use `rules:` syntax (not `only/except`). - DAG dependencies with `needs:` for parallel execution. - Cache dependencies between pipeline runs. - SAST results in merge request widget. - Environment URLs for each deployment. - Include `reviewapp` job for MR preview environments. ## Output Format Return the complete `.gitlab-ci.yml` with inline comments. Include required CI/CD variables table.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.0 Flash, Llama 4.
Specify your language, registry, deployment target, and coverage threshold. Configure the listed CI/CD variables in GitLab project settings.
Initial release
Sign in and download this prompt to leave a review.