CI/CD pipelines are the backbone of modern software development. GitHub Actions, GitLab CI, and ArgoCD let you automate testing, deployment, and delivery—but writing their YAML by hand is tedious and error-prone. Using AI prompts, you can generate a robust pipeline in seconds. Here are 10 practical prompts, with example results, to accelerate your CI/CD workflow.
1. Node.js Test Pipeline on GitHub Actions
Prompt: "Write a GitHub Actions workflow that runs on every push, checks out the code, sets up Node.js 20, runs npm ci, npm test, and uploads coverage to Codecov."
Example output:
name: CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 20 }
- run: npm ci
- run: npm test
2. Build and Push Docker Image to AWS ECR
Prompt: "Create a GitHub Actions workflow that builds a Docker image from a Dockerfile, tags it with the Git SHA, pushes it to AWS ECR, and integrates with the aws-actions/amazon-ecr-login action."
Example output:
name: Build and Push to ECR
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v2
- name: Build and push
run: |
docker build -t ${{ secrets.ECR_REPO }}:${{ github.sha }} .
docker push ${{ secrets.ECR_REPO }}:${{ github.sha }}
3. Multi-Stage GitLab CI Pipeline
Prompt: "Generate a GitLab CI configuration with three stages: build, test, and deploy. The build stage compiles a Go binary, the test stage runs unit tests, and the deploy stage deploys to a staging server using SSH."
Example output:
stages:
- build
- test
- deploy
build:
stage: build
script:
- go build -o myapp
artifacts:
paths: [myapp]
test:
stage: test
script:
- go test ./...
deploy:
stage: deploy
script:
- scp myapp user@staging:/opt/app/
only:
- main
4. Terraform Plan/Apply with Approval in GitLab CI
Prompt: "Create a GitLab CI pipeline that runs terraform plan on a merge request, and pushes a manual approval gate before terraform apply. Use amanual` action in the deploy stage."
Example output:
stages:
- plan
- apply
plan:
stage: plan
script: terraform plan
except:
- main
apply:
stage: apply
script: terraform apply -auto-approve
environment: production
when: manual
only:
- main
5. ArgoCD Application with Automated Sync
Prompt: "Write an ArgoCD Application manifest that deploys an app from a Git repository to a Kubernetes namespace, with automated sync and self-healing enabled, and a sync policy that creates the namespace if it doesn't exist."
Example output:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: my-app
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/me/my-app.git
targetRevision: HEAD
path: k8s
destination:
server: https://kubernetes.default.svc
namespace: my-app
syncPolicy:
automated:
prune: true
selfHeal: true
6. Multi-Environment ArgoCD ApplicationSet
Prompt: "Generate an ArgoCD ApplicationSet that creates an Application for each environment in a list (dev, staging, prod), using a common Git repository but different values files per environment."
Example output:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: multi-env
spec:
generators:
- list:
elements:
- env: dev
- env: staging
- env: prod
template:
metadata:
name: '{{env}}'
spec:
project: default
source:
repoURL: https://github.com/me/app.git
targetRevision: HEAD
path: manifests
helm:
valueFiles:
- 'values-{{env}}.yaml'
destination:
server: https://kubernetes.default.svc
namespace: '{{env}}'
7. Cache Dependencies and Upload Artifacts in GitHub Actions
Prompt: "Design a GitHub Actions workflow for a Python project that caches pip dependencies, runs pytest, and uploads test results as an artifact using actions/cache and actions/upload-artifact."
Example output:
name: Python CI
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
- run: pip install -r requirements.txt
- run: pytest --junitxml=report.xml
- uses: actions/upload-artifact@v4
with:
name: test-report
path: report.xml
8. Trivy Security Scan in GitLab CI
Prompt: "Create a GitLab CI job that runs a Trivy filesystem scan on the repository, fails the pipeline if vulnerabilities with a severity of HIGH are found, and outputs the report as a job artifact."
Example output:
security_scan:
stage: test
image: aquasec/trivy:latest
script:
- trivy fs --exit-code 1 --severity HIGH --no-progress .
artifacts:
paths:
- trivy-report
9. ArgoCD PreSync Hook for Database Migration
Prompt: "Generate an ArgoCD manifest with a PreSync hook that runs a Kubernetes Job to execute a database migration, ensuring successful migration before the main application resources are synced."
Example output:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: db-migration
spec:
source:
repoURL: https://github.com/me/app.git
path: migration
syncPolicy:
syncOptions:
- CreateNamespace=true
sync:
hooks:
- events: [PreSync]
resource:
apiVersion: batch/v1
kind: Job
metadata:
name: migration
10. Deploy to Kubernetes from GitHub Actions
Prompt: "Write a GitHub Actions workflow that builds a Docker image, pushes it to a registry, then updates a Kubernetes deployment via kubectl set image, using azure/setup-kubectl and azure/k8s-set-context actions."
Example output:
name: Deploy to K8s
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: azure/setup-kubectl@v4
- uses: azure/k8s-set-context@v5
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
- run: kubectl set image deployment/my-app my-app=docker.io/me/my-app:${{ github.sha }}
These 10 prompts cover the most common CI/CD tasks across three powerful tools. Use them as templates—then adapt them to your stack. Start with one prompt, test it, and expand from there. Your future self will thank you.
Comments