GitLab Runner Custom Executor Driver Config Prompt
Build and debug a GitLab Runner Custom executor driver (config/prepare/run/cleanup scripts) to run jobs on an environment GitLab does not natively support — such as bespoke VMs, a hypervisor, or an isolated sandbox.
- Target user
- Runner administrators integrating non-standard job execution backends
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior Runner administrator who has authored GitLab Runner Custom executor drivers and knows the exact contract of the config, prepare, run, and cleanup stages. I will provide: - The execution backend I need (e.g. a custom VM manager, a remote sandbox, a hypervisor API) - My current `config.toml` and what I have tried so far - The failure I see (job hangs in prepare, run stage exits non-zero, cleanup leaks resources) Your job: 1. **Executor contract** — explain the Custom executor lifecycle: `config_exec` (returns JSON to override settings), `prepare_exec`, `run_exec` (called once per script stage with a stage name), `cleanup_exec`, and which env vars (`CUSTOM_ENV_*`) each stage receives. 2. **config.toml** — produce a `[runners.custom]` block wiring my four scripts with sane `prepare_exec_timeout`, `cleanup_exec_timeout`, and `graceful_kill_timeout`. 3. **Driver scripts** — write skeletons for prepare/run/cleanup that provision the backend, execute the per-stage script GitLab passes on stdin, and tear down idempotently. 4. **Diagnose my failure** — map my symptom to a lifecycle stage and the likely cause (build-failure vs. system-failure exit codes matter). 5. **Build-failure vs. system-failure** — explain `BUILD_FAILURE_EXIT_CODE` and `SYSTEM_FAILURE_EXIT_CODE` and how returning the wrong one breaks retries and metrics. 6. **Cleanup guarantees** — ensure cleanup runs even when prepare or run aborts, so backends are never orphaned. Output as: (a) the `config.toml` custom block, (b) prepare/run/cleanup script skeletons, (c) a stage-to-symptom diagnosis table, (d) an idempotent-cleanup checklist. Do not assume the run stage is called once; it is invoked per script stage and your driver must be re-entrant.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
GitLab Kubernetes Runner Affinity and Tolerations Prompt
Tune the GitLab Runner Kubernetes executor so CI job pods land on the right nodes — using node selectors, affinity, and tolerations to schedule onto tainted CI node pools (spot, GPU, large-build) without starving other workloads.
-
GitLab Runner config.toml Executor Tuning Prompt
Tune self-managed runner config.toml — concurrency, executor choice (docker/kubernetes/shell), cache backend, image pull policy, and the new runner authentication tokens that replaced registration tokens.
-
GitLab CI/CD Android Signed APK/AAB Build Pipeline Prompt
Build, test, and sign Android APK/AAB artifacts in GitLab CI — keystore secrecy, Gradle caching, SDK licenses, and Play Store upload without leaking signing keys.
-
GitLab CI/CD Container Image Size Budget Gate Prompt
Add an image-size budget gate to GitLab CI — measure built image size, diff against a baseline, and fail the pipeline when a layer bloats the image past budget.
More GitLab CI/CD prompts & error guides
Browse every GitLab CI/CD prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.