{
"title": "10 Prompts for CI/CD: GitHub Actions, GitLab CI, and ArgoCD",
"content": "## Introduction\n\nContinuous Integration and Continuous Deployment (CI/CD) pipelines have become the backbone of modern software delivery. Whether you're a DevOps engineer, a platform architect, or a developer looking to automate repetitive tasks, mastering prompts for CI/CD tools like GitHub Actions, GitLab CI, and ArgoCD can dramatically accelerate your workflow. In this article, we present a curated collection of 10 ready-to-use prompts designed to help you configure, debug, and optimize your pipelines. Each prompt includes a specific task, a usage example, and practical tips drawn from real-world experience and official documentation.\n\n## Why Prompts Matter for CI/CD\n\nPrompts—structured instructions for AI assistants or code generators—can reduce cognitive load and eliminate guesswork. Instead of manually searching for YAML syntax or best practices, you can use a well-crafted prompt to generate a complete pipeline configuration, troubleshoot a failing job, or even design a multi-environment deployment strategy. According to the 2025 State of DevOps Report by Google Cloud, teams that adopt automation tools report 2.6x higher deployment frequency. Prompts amplify this effect by making automation more accessible.\n\n## 1. Generate a GitHub Actions Workflow for a Node.js App\n\nTask: Create a CI pipeline that runs tests and lints code on every push to the main branch.\n\nPrompt:\n\nGenerate a GitHub Actions workflow YAML file for a Node.js application. The workflow should:\n- Trigger on push to main and pull requests targeting main.\n- Use Ubuntu latest runner.\n- Set up Node.js 18.\n- Install dependencies with npm ci.\n- Run linting with ESLint.\n- Run unit tests with Jest.\n- Upload test coverage report as an artifact.\n- Cache node_modules to speed up subsequent runs.\n\n\nExplanation: This prompt covers the most common CI tasks for a JavaScript/TypeScript project. The AI will produce a complete .github/workflows/ci.yml file with proper caching, artifact upload, and conditional triggers.\n\nUsage example: Paste the generated YAML into your repository, commit, and push. The pipeline will automatically run on new changes.\n\n## 2. Create a GitLab CI Pipeline with Docker-in-Docker\n\nTask: Build and push a Docker image to GitLab Container Registry, then deploy to a staging environment.\n\nPrompt:\n\nWrite a .gitlab-ci.yml file that:\n- Uses the docker:latest image with Docker-in-Docker service.\n- Builds a Docker image with tag $CI_COMMIT_SHORT_SHA.\n- Pushes the image to GitLab Container Registry.\n- Deploys the image to a staging server using SSH (define variables for host, user, and key).\n- Includes a manual approval gate before deployment.\n\n\nExplanation: GitLab CI's DIND (Docker-in-Docker) pattern is common for building container images. This prompt also adds environment management and deployment, which is essential for real-world workflows.\n\nUsage example: After generating, define the required CI/CD variables (SSH_PRIVATE_KEY, STAGING_HOST, etc.) in your GitLab project settings. The pipeline will build, push, and deploy upon merge to main.\n\n## 3. Configure ArgoCD Application with Automatic Sync\n\nTask: Declare a Kubernetes application in ArgoCD that syncs from a Git repository automatically.\n\nPrompt:\n\nGenerate an ArgoCD Application manifest in YAML for a microservice called 'users-api'. The application should:\n- Use a Git repository URL: https://github.com/example/argocd-config.\n- Sync policy: automatic with prune (remove resources not in Git) and self-heal (revert manual changes).\n- Target namespace: production.\n- Destination cluster: https://kubernetes.default.svc (in-cluster).\n- Path in repo: 'k8s/production/users-api'.\n\n\nExplanation: ArgoCD uses custom resource definitions (CRDs) to manage deployments. This prompt generates the exact YAML you need to apply with kubectl apply -f.\n\nUsage example: Save the output as users-api-application.yaml and apply it. ArgoCD will immediately detect the Git repository and start syncing.\n\n## 4. Debug a Failing GitHub Actions Job\n\nTask: Troubleshoot a workflow that fails during the 'install' step with npm ci.\n\nPrompt:\n\nI have a GitHub Actions workflow that fails on the 'npm ci' step with error 'EPERM: operation not permitted, unlink'. My YAML is:\n\n[include your YAML here]\n\nExplain the most likely cause and provide a fix. Also suggest how to add debug logs.\n\n\nExplanation: Prompting with the actual error and YAML helps the AI pinpoint issues like file permissions, caching conflicts, or missing dependencies.\n\nUsage example: The AI might suggest clearing the cache, adding --unsafe-perm flag, or using a newer Node.js version. This approach turns a 30-minute debugging session into a 2-minute fix.\n\n## 5. Implement a Multi-Environment Deployment with GitLab CI\n\nTask: Deploy the same application to development, staging, and production environments with different variables.\n\nPrompt:\n\nWrite a GitLab CI pipeline that:\n- Defines three environments: dev, staging, prod.\n- Uses rules to deploy to dev automatically after build, staging after manual trigger, and prod only on tags.\n- Each environment uses its own set of variables (e.g., DATABASE_URL, API_KEY).\n- Includes a rollback job for production that redeploys the previous successful image.\n\n\nExplanation: Environment-specific variables are a best practice. This prompt also adds a rollback mechanism, which is often overlooked but critical for production reliability.\n\nUsage example: The generated YAML will include environment: name and rules blocks. You'll need to configure environment-scoped variables in GitLab UI.\n\n## 6. Generate an ArgoCD Project with RBAC\n\nTask: Create an ArgoCD Project that restricts access to specific namespaces and clusters.\n\nPrompt:\n\nGenerate an ArgoCD AppProject YAML called 'team-alpha' that:\n- Allows deployments only to namespace 'team-alpha' in cluster 'https://kubernetes.default.svc'.\n- Restricts source repositories to 'https://github.com/org/team-alpha-config'.\n- Enables cluster resource blacklist for dangerous resources like ClusterRole.\n- Sets orphaned resources as warned.\n\n\nExplanation: ArgoCD Projects provide multi-tenancy. This prompt helps you create a secure project with minimal permissions.\n\nUsage example: Apply the manifest. Then, all applications created under this project will inherit the restrictions.\n\n## 7. Convert a Docker Compose File to Kubernetes Manifests\n\nTask: Automatically generate Kubernetes YAML from an existing docker-compose.yml.\n\nPrompt:\n\nGiven the following docker-compose.yml:\n\n[include your docker-compose.yml here]\n\nConvert it to a set of Kubernetes manifests (Deployment, Service, ConfigMap, PersistentVolumeClaim). Use kompose as the conversion tool and explain any manual adjustments needed.\n\n\nExplanation: This prompt is a hybrid: it generates the conversion command and also explains post-processing steps (e.g., adding health checks, resource limits).\n\nUsage example: Run kompose convert as instructed, then review and tweak the generated YAML before applying to your cluster.\n\n## 8. Set Up a GitHub Actions Matrix Build\n\nTask: Test your application against multiple Node.js versions and operating systems.\n\nPrompt:\n\nCreate a GitHub Actions workflow that uses a build matrix with:\n- Node.js versions: 16, 18, 20.\n- Operating systems: ubuntu-latest, windows-latest.\n- Runs tests on each combination.\n- Skips Windows + Node 16 if it's known to fail (use continue-on-error).\n- Summarizes results in a single job.\n\n\nExplanation: Matrix builds are powerful for cross-platform testing. The prompt includes error handling and result aggregation.\n\nUsage example: The generated YAML will have a strategy.matrix section. After pushing, GitHub will run 6 parallel jobs.\n\n## 9. Optimize ArgoCD Sync Wave Order\n\nTask: Ensure that a database migration job runs before the application deployment.\n\nPrompt:\n\nGenerate ArgoCD sync wave annotations for a Kubernetes deployment that includes:\n- A Job 'db-migrate' that runs first (wave 0).\n- A Deployment 'app' that runs after the job completes (wave 1).\n- Both resources are in the same application.\n- Add a post-sync hook to send a Slack notification.\n\n\nExplanation: Sync waves allow ordered deployments. This prompt also adds a notification hook.\n\nUsage example: Add the generated annotations to your manifests. ArgoCD will respect the wave order during sync.\n\n## 10. Create a Comprehensive CI/CD Audit Log\n\nTask: Generate a report of all pipeline runs for the last month across GitHub Actions, GitLab CI, and ArgoCD.\n\nPrompt:\n\nI need to audit CI/CD pipeline activity for the past 30 days. For each tool:\n- GitHub Actions: List workflow runs with status, duration, and branch using the GitHub API.\n- GitLab CI: List pipeline jobs with stage, status, and user who triggered it.\n- ArgoCD: List application sync status and last sync time.\n- Combine the data into a single Markdown table.\n- Include a summary section with total runs, success rate, and average duration.\n\n\nExplanation: This prompt generates scripts or queries to collect data from each tool's API. It's useful for compliance or performance reviews.\n\nUsage example: The AI will provide curl commands or Python scripts. Run them to produce your audit report.\n\n## Comparison Table: CI/CD Tools
| Feature | GitHub Actions | GitLab CI | ArgoCD |
|---|---|---|---|
| Hosting | GitHub-hosted or self-hosted | GitLab-hosted or self-hosted | Kubernetes-native (self-hosted) |
| Configuration format | YAML (.github/workflows/*.yml) |
YAML (.gitlab-ci.yml) |
CRD YAML (Application, AppProject) |
| Triggers | Push, PR, schedule, webhook | Push, MR, tag, schedule, webhook | Git sync (polling or webhook) |
| Orchestration level | CI/CD pipeline | CI/CD pipeline | Continuous delivery (GitOps) |
| Built-in container registry | GitHub Container Registry | GitLab Container Registry | External (e.g., Docker Hub, ECR) |
| Multi-environment | Via environments and secrets | Via environments and variables | Via namespaces and sync waves |
| Rollback | Manual via re-run | Manual via job or re-run | Automated via Git revert + sync |
Practical Recommendations
- Start small: Begin with a simple CI pipeline (e.g., #1 or #2) and gradually add deployment stages.
- Use environments: Always separate development, staging, and production to avoid accidental deployments.
- Monitor sync status: For ArgoCD, set up notifications for sync failures (e.g., Slack, email).
- Cache dependencies: In GitHub Actions and GitLab CI, caching can reduce pipeline runtime by 40–60%.\n- Audit regularly: Use prompt #10 to generate monthly reports and identify bottlenecks.\n\n## Conclusion\n\nPrompts are more than just shortcuts—they are a way to codify best practices and share knowledge across teams. The 10 prompts in this article cover the most common CI/CD tasks for GitHub Actions, GitLab CI, and ArgoCD, from basic testing to advanced multi-environment deployments with rollback. By integrating these prompts into your daily workflow, you can reduce setup time, minimize errors, and focus on delivering value. As the DevOps landscape evolves, prompts will become an essential part of every engineer's toolkit. Start using them today and watch your pipeline efficiency soar.\n\nASI Biont supports connecting to GitHub Actions, GitLab CI, and ArgoCD via API for advanced monitoring and automation—learn more at asibiont.com/courses.",
"excerpt": "A practical collection of 10 ready-to-use prompts for GitHub Actions, GitLab CI, and ArgoCD, covering pipeline generation, debugging, multi-environment deployments, and audit reports. Includes a comparison table and expert recommendations."
}
Comments