Introduction
CI/CD pipelines are the backbone of modern software delivery, enabling teams to automate builds, tests, and deployments with speed and reliability. However, crafting efficient pipelines often requires deep knowledge of tools like GitHub Actions, GitLab CI, and ArgoCD. To save you hours of trial and error, we've compiled 10 ready-to-use prompts that cover common scenarios—from basic YAML setup to advanced Kubernetes rollouts. Each prompt is designed to be copy-paste ready, with explanations and real-world examples. Whether you're a DevOps engineer or a developer looking to streamline your workflow, this guide will accelerate your CI/CD journey.
10 Prompts for CI/CD Pipelines
1. Prompt: Generate a GitHub Actions Workflow for Multi-Environment Deployment
Task: Create a CI/CD workflow that builds, tests, and deploys a Node.js app to staging and production environments sequentially.
Prompt:
Create a GitHub Actions YAML file for a Node.js application. The workflow should:
- Trigger on push to main branch.
- Build the app, run unit tests, and lint.
- Deploy to a staging environment on AWS EC2 using SSH and pm2.
- After manual approval, deploy to production using the same method.
- Use environment secrets for SSH keys and hostnames.
Usage Example:
Save as .github/workflows/deploy.yml. The workflow will automatically run on every push to main. After staging deployment succeeds, a GitHub Actions environment approval gate pauses the pipeline until a reviewer approves the production deployment. This pattern is used by companies like Shopify to prevent accidental production releases (see GitHub Docs on Environments).
2. Prompt: Write a GitLab CI Pipeline for Monorepo with Caching
Task: Optimize a monorepo build using GitLab CI with dependency caching and parallel jobs.
Prompt:
Define a .gitlab-ci.yml for a monorepo with two services: frontend (React) and backend (Python Flask). The pipeline should:
- Only run jobs for changed services using rules:changes.
- Use cache for node_modules and pip packages.
- Run unit tests in parallel for each service.
- Build Docker images and push to GitLab Container Registry.
Usage Example:
Place this in the root of your monorepo. GitLab CI will detect changes and skip irrelevant jobs, speeding up pipeline execution. Caching reduces dependency install time by up to 70% based on GitLab's own benchmarks (GitLab CI/CD Cache Documentation).
3. Prompt: Create ArgoCD Application with Sync Phases and Health Checks
Task: Define an ArgoCD Application that syncs a Kubernetes deployment with pre-sync and post-sync hooks.
Prompt:
Generate an ArgoCD Application YAML that:
- Sources a Helm chart from a private Git repo.
- Sets syncPolicy with automated prune and selfHeal.
- Adds a pre-sync hook to run a database migration job.
- Adds a post-sync hook to send a Slack notification.
- Includes a custom health check for a StatefulSet.
Usage Example:
Apply this to your cluster using kubectl apply -f app.yaml. ArgoCD will automatically sync the application and run hooks before and after deployment. The custom health check ensures the StatefulSet is considered healthy only when all pods are ready. This approach is standard in enterprise Kubernetes deployments (see ArgoCD Docs on Sync Waves).
4. Prompt: Design a GitHub Actions Workflow for Docker Build and Push with Multi-Architecture Support
Task: Build and push Docker images for both amd64 and arm64 architectures.
Prompt:
Write a GitHub Actions workflow that:
- Uses the docker/setup-qemu-action and docker/setup-buildx-action.
- Builds a Docker image with platforms linux/amd64 and linux/arm64.
- Tags the image with semantic version (e.g., v1.2.3) and latest.
- Pushes to Docker Hub using secrets for username and password.
Usage Example:
This workflow is essential for teams deploying to mixed architecture environments like AWS Graviton (arm64) and x86 servers. The docker/setup-buildx-action enables emulated builds, ensuring compatibility. Many organizations, including GitHub itself, use multi-arch images for resilience (GitHub Actions Docker Build Example).
5. Prompt: Set Up GitLab CI for Automatic Security Scanning with SAST and DAST
Task: Integrate security scanning into your GitLab CI pipeline.
Prompt:
Create a .gitlab-ci.yml that:
- Includes the GitLab SAST template for JavaScript/Node.js.
- Adds a DAST job that runs against a staging URL.
- Fails the pipeline if any critical vulnerabilities are found.
- Generates a security report accessible in the merge request widget.
Usage Example:
Add the template inclusion include: - template: Security/SAST.gitlab-ci.yml to your file. GitLab will automatically scan your code for common vulnerabilities like SQL injection or XSS. DAST scans the running application for runtime issues. This aligns with OWASP recommendations and helps meet compliance standards like SOC 2 (GitLab Security Scanning Documentation).
6. Prompt: Create ArgoCD ApplicationSet for Multi-Cluster Deployment
Task: Deploy the same application to multiple Kubernetes clusters using ApplicationSet.
Prompt:
Define an ArgoCD ApplicationSet that:
- Uses a cluster generator to list clusters from a secret.
- Deploys the same Helm chart to each cluster with cluster-specific values.
- Overrides the namespace based on cluster metadata.
- Sets syncPolicy to auto-sync with prune.
Usage Example:
This is ideal for organizations running multiple clusters for disaster recovery or multi-region latency. The ApplicationSet dynamically creates individual Application resources for each cluster. For example, a fintech company might deploy to US-East and EU-West clusters simultaneously, ensuring business continuity (see ArgoCD ApplicationSet Docs).
7. Prompt: Write a GitHub Actions Workflow for Automated Version Bumping and Release
Task: Automatically bump version and create a GitHub release based on conventional commits.
Prompt:
Design a workflow that:
- Triggers on push to main.
- Uses the anothrNick/github-tag-action to automatically increment version (major, minor, patch) based on commit messages.
- Creates a GitHub release with auto-generated release notes.
- Publishes the package to npm or PyPI.
Usage Example:
With conventional commits (e.g., feat: add login for minor, fix: resolve crash for patch), this workflow eliminates manual versioning. The release notes are generated from commit history, saving time for maintainers. Companies like Google rely on automated versioning in their open-source projects (Conventional Commits Specification).
8. Prompt: Set Up GitLab CI for Terraform Infrastructure as Code Pipeline
Task: Automate Terraform plan and apply in GitLab CI.
Prompt:
Create a .gitlab-ci.yml that:
- Runs terraform fmt and validate on merge request.
- Generates a terraform plan artifact.
- Applies the plan on merge to main.
- Uses GitLab Terraform state backend.
- Includes a manual approval gate before apply.
Usage Example:
This pipeline ensures infrastructure changes are reviewed and tested before deployment. The plan artifact is attached to the merge request, allowing reviewers to see what will change. GitLab's native Terraform integration simplifies state management (GitLab Terraform Integration).
9. Prompt: Create ArgoCD Sync Wave for Canary Deployment with Prometheus Metrics
Task: Implement a canary deployment strategy using ArgoCD and Prometheus for health evaluation.
Prompt:
Define an ArgoCD Application that:
- Uses a canary deployment strategy via the Rollout resource (Argo Rollouts).
- Configures sync waves: first deploy the canary, then analyze metrics from Prometheus, then promote to stable.
- Sets a step weight of 20% for the canary.
- Includes a rollback if error rate exceeds 5%.
Usage Example:
This prompt requires Argo Rollouts installed on the cluster. The canary receives 20% traffic initially; if Prometheus metrics show no errors, the rollout proceeds. This minimizes blast radius during deployments. Netflix popularized canary deployments to reduce risk (Argo Rollouts Documentation).
10. Prompt: Write a GitHub Actions Workflow for Self-Hosted Runner with Docker-in-Docker
Task: Run a self-hosted runner that executes Docker commands inside a container.
Prompt:
Create a workflow that:
- Runs on a self-hosted runner with label 'docker-runner'.
- Uses a Docker-in-Docker service container.
- Builds a Docker image and pushes to a private registry.
- Cleans up resources after the job.
Usage Example:
Self-hosted runners are useful for accessing private networks or custom hardware. Docker-in-Docker allows the runner to build images without mounting the host's Docker socket, improving security. For example, a healthcare company might use this to deploy to an on-premise server behind a VPN (see GitHub Docs on Self-Hosted Runners).
Conclusion
These 10 prompts cover the most common CI/CD scenarios across GitHub Actions, GitLab CI, and ArgoCD. By using them as templates, you can accelerate your pipeline setup and adopt best practices like multi-architecture builds, security scanning, and canary deployments. Remember to adapt each prompt to your specific tools and infrastructure. Start by implementing one prompt today—your future self will thank you when deployments run smoothly.
For further learning, explore the official documentation for each tool:
- GitHub Actions Documentation
- GitLab CI/CD Documentation
- ArgoCD Documentation
Comments