15 Prompts for CI/CD: GitHub Actions, GitLab CI, ArgoCD
Continuous Integration and Continuous Deployment (CI/CD) pipelines are the backbone of modern software delivery. Whether you're using GitHub Actions, GitLab CI, or ArgoCD, the right prompts can save hours of configuration time and help you avoid common pitfalls. This article provides 15 ready-to-use prompts that you can copy-paste directly into your workflow files. Each prompt includes a task description, an explanation, and a real-world usage example.
Why Use Prompts for CI/CD?
Manually writing YAML configurations for CI/CD pipelines is error-prone and time-consuming. Prompts — reusable, parameterized templates — allow you to standardize best practices across your organization. They reduce boilerplate, enforce security policies, and make pipelines easier to audit. According to the State of DevOps Report 2025 (Google Cloud), teams that use standardized pipeline templates achieve 2.5 times faster deployment frequency. By leveraging prompts, you can focus on business logic instead of debugging YAML indentation.
Prerequisites
Before using the prompts below, ensure you have:
- A GitHub, GitLab, or Kubernetes cluster account
- Basic knowledge of YAML syntax
- Access to the respective CI/CD platform’s documentation (GitHub Actions docs at docs.github.com/en/actions, GitLab CI docs at docs.gitlab.com/ee/ci/, ArgoCD docs at argoproj.github.io/cd/)
Prompts for GitHub Actions
Prompt 1: Multi-OS Testing Matrix
Task: Run tests across multiple operating systems and language versions.
Explanation: This prompt creates a build matrix that tests your code on Ubuntu, Windows, and macOS with Python 3.10, 3.11, and 3.12. It is ideal for libraries that must be cross-platform compatible.
Example:
name: Multi-OS Test
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install -r requirements.txt
- run: pytest
Prompt 2: Docker Image Build and Push
Task: Build a Docker image and push it to GitHub Container Registry (GHCR) on every push to main.
Explanation: Automates containerization and registry storage. Useful for microservices or any application deployed as a container.
Example:
name: Build and Push Docker Image
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: docker build -t ghcr.io/${{ github.repository }}:${{ github.sha }} .
- run: docker push ghcr.io/${{ github.repository }}:${{ github.sha }}
Prompt 3: Linting and Formatting Check
Task: Run ESLint and Prettier on every pull request to enforce code style.
Explanation: This prompt ensures code quality by checking for linting errors and formatting issues before merging.
Example:
name: Lint Check
on: pull_request
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: npx eslint . --max-warnings=0
- run: npx prettier --check .
Prompt 4: Deploy to AWS ECS via ECR
Task: Build, push to Amazon ECR, and deploy to Amazon ECS Fargate.
Explanation: Streamlines deployment to AWS ECS. Requires AWS credentials stored as secrets (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
Example:
name: Deploy to ECS
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- uses: aws-actions/amazon-ecr-login@v2
- run: docker build -t my-app .
- run: docker tag my-app:latest ${{ secrets.ECR_REPOSITORY }}:latest
- run: docker push ${{ secrets.ECR_REPOSITORY }}:latest
- uses: aws-actions/amazon-ecs-deploy-task-definition@v2
with:
task-definition: task-def.json
service: my-service
cluster: my-cluster
wait-for-service-stability: true
Prompt 5: Cache Dependencies for Faster Builds
Task: Cache Python pip or Node.js node_modules to speed up subsequent runs.
Explanation: Caching reduces pipeline runtime by reusing downloaded packages. This prompt caches pip dependencies based on the lock file hash.
Example:
name: Build with Cache
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- run: pip install -r requirements.txt
Prompts for GitLab CI
Prompt 6: Multi-Stage Pipeline with Artifacts
Task: Build, test, and deploy using stages, passing artifacts between jobs.
Explanation: GitLab CI stages run sequentially. Artifacts from the build stage are passed to test and deploy stages, avoiding redundant work.
Example:
stages:
- build
- test
- deploy
build-job:
stage: build
script:
- mkdir -p dist
- echo "Building..." > dist/output.txt
artifacts:
paths:
- dist/
test-job:
stage: test
script:
- cat dist/output.txt
- echo "Testing..."
deploy-job:
stage: deploy
script:
- echo "Deploying..."
only:
- main
Prompt 7: Run Tests in Parallel with Matrix
Task: Execute tests across multiple Python versions in parallel.
Explanation: GitLab CI supports parallel matrices using parallel:matrix. This prompt runs the same job with Python 3.9, 3.10, and 3.11 simultaneously.
Example:
stages:
- test
.test-template:
stage: test
script:
- pip install -r requirements.txt
- pytest
parallel:
matrix:
- PYTHON_VERSION: ["3.9", "3.10", "3.11"]
python-test-3.9:
extends: .test-template
image: python:3.9
python-test-3.10:
extends: .test-template
image: python:3.10
python-test-3.11:
extends: .test-template
image: python:3.11
Prompt 8: Deploy to Kubernetes with kubectl
Task: Deploy a Docker image to a Kubernetes cluster using kubectl.
Explanation: This prompt assumes you have a Kubernetes cluster and a KUBECONFIG stored as a CI/CD variable. It updates the deployment image and applies manifests.
Example:
deploy-k8s:
stage: deploy
image: bitnami/kubectl:latest
script:
- kubectl set image deployment/my-app my-app=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- kubectl apply -f k8s/
only:
- main
variables:
KUBECONFIG: $KUBECONFIG
Prompt 9: Trigger Downstream Pipeline
Task: After a successful build, trigger another project’s pipeline (e.g., integration tests).
Explanation: Multi-project pipelines allow you to chain CI/CD across repositories. Useful for microservices that depend on each other.
Example:
trigger-integration:
stage: deploy
trigger:
project: my-group/integration-tests
branch: main
strategy: depend
only:
- main
Prompt 10: Security Scan with Trivy
Task: Scan the built Docker image for vulnerabilities using Trivy.
Explanation: Security scanning in CI/CD helps catch vulnerabilities before deployment. Trivy is an open-source scanner maintained by Aqua Security.
Example:
security-scan:
stage: test
image: aquasec/trivy:latest
script:
- trivy image --severity HIGH,CRITICAL $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
artifacts:
reports:
container_scanning: gl-container-scanning-report.json
only:
- main
Prompts for ArgoCD
Prompt 11: Sync Application with Auto-Prune
Task: Sync an ArgoCD application and automatically prune resources that are no longer in Git.
Explanation: ArgoCD ensures your Kubernetes cluster matches the desired state in Git. Auto-prune removes resources that were deleted from the repository.
Example:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/my-org/my-app.git
targetRevision: HEAD
path: k8s
destination:
server: https://kubernetes.default.svc
namespace: production
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
Prompt 12: Rollback to Previous Version
Task: Rollback an ArgoCD application to a specific revision.
Explanation: ArgoCD maintains a history of sync operations. You can rollback by specifying a revision ID. This is useful for reverting faulty deployments.
Example:
argocd app rollback my-app <REVISION_ID> --prune
Prompt 13: Blue-Green Deployment Strategy
Task: Implement a blue-green deployment using Argo Rollouts.
Explanation: Argo Rollouts extends ArgoCD with advanced deployment strategies like blue-green and canary. This prompt creates a Rollout resource with a blue-green strategy.
Example:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: my-app-rollout
spec:
replicas: 3
strategy:
blueGreen:
activeService: my-app-active
previewService: my-app-preview
autoPromotionEnabled: false
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: my-app:latest
Prompt 14: Canary Deployment with Traffic Splitting
Task: Deploy a new version gradually, splitting traffic between old and new instances.
Explanation: Canary deployments reduce risk by routing a small percentage of traffic to the new version. This prompt uses Argo Rollouts with an Istio traffic split.
Example:
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
name: my-app-canary
spec:
replicas: 5
strategy:
canary:
steps:
- setWeight: 20
- pause: {duration: 10m}
- setWeight: 50
- pause: {duration: 10m}
- setWeight: 100
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app
image: my-app:canary
Prompt 15: Multi-Cluster Deployment
Task: Deploy the same application to multiple Kubernetes clusters using a single ArgoCD ApplicationSet.
Explanation: ApplicationSet allows you to manage deployments across clusters using a template. This prompt deploys to two clusters: staging and production.
Example:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: multi-cluster-app
spec:
generators:
- clusters:
selector:
matchLabels:
environment: production
template:
metadata:
name: '{{name}}-my-app'
spec:
project: default
source:
repoURL: https://github.com/my-org/my-app.git
targetRevision: HEAD
path: k8s
destination:
server: '{{server}}'
namespace: production
syncPolicy:
automated:
prune: true
Best Practices for Using Prompts
- Version Control: Store all prompts in a dedicated repository (e.g.,
company-pipeline-templates) and version them with Git tags. - Secrets Management: Never hardcode credentials. Use platform-specific secret stores: GitHub Secrets, GitLab CI/CD Variables, or Kubernetes Secrets.
- Testing Locally: Use tools like
actfor GitHub Actions orgitlab-runner execfor GitLab CI to test prompts locally before committing. - Monitoring: Add notifications (Slack, email) to your prompts so your team is alerted on failures. GitHub Actions supports
actions/notify-slack, and GitLab CI has built-in notifications. - Documentation: Comment your YAML files and maintain a README for each prompt. Include expected inputs, outputs, and example outputs.
Conclusion
CI/CD prompts are a powerful way to accelerate your delivery pipeline and enforce consistency. The 15 prompts in this article cover the most common tasks across GitHub Actions, GitLab CI, and ArgoCD. Start by adapting them to your tech stack, then expand your library with prompts for security scanning, compliance checks, and infrastructure provisioning. Remember to keep your prompts up to date with the latest platform features — both GitHub and GitLab release new actions and keywords regularly. Happy shipping!
Comments