GitLab CI
Prepare GitLab CI/CD variables, stages, environments, and result handling for a ContextQA test-plan quality gate.
Documentation owner: Deep Barot · Last updated: November 11, 2026
Quick answer
Prepare GitLab CI/CD variables, stages, environments, and result handling for a ContextQA test-plan quality gate. Use this page to understand when the capability applies, complete its user-facing workflow, and verify the expected result.
Key takeaways
Prepare GitLab CI/CD variables, stages, environments, and result handling for a ContextQA test-plan quality gate.
Create and manually validate the test plan you want to use as the gate.
Open Settings → CI/CD → Variables and add: Use environment scopes when staging and production use different plans or credentials.
What this page covers
Use a GitLab CI/CD job to coordinate a ContextQA test-plan run and require its result before a merge or deployment.
Before you begin
Create and manually validate the test plan you want to use as the gate.
Open the plan's CI / CD tab and confirm GitLab is listed.
Obtain the current public start and status contract supplied for your workspace.
Create a dedicated API token with the narrowest required scopes.
Store GitLab configuration
Open Settings → CI/CD → Variables and add:
CONTEXTQA_API_TOKEN
Masked; protected for protected environments
The one-time token value copied from ContextQA
CONTEXTQA_TEST_PLAN_ID
Protected when appropriate
The plan ID shown on the ContextQA plan overview
CONTEXTQA_API_BASE_URL
Protected when appropriate
The public base URL from the official contract, when supplied
Use environment scopes when staging and production use different plans or credentials. Do not store a ContextQA username or password in GitLab CI/CD variables.
Design the pipeline stage
Place the ContextQA job after the target environment is ready and before the protected deployment or release job. When the public contract is available, the job should:
Start the plan with the published method, path, and payload.
Capture the returned run ID.
Poll the published status operation with a bounded timeout.
Exit successfully only for documented success results.
Include the run ID in the job output or a dotenv artifact for later stages.
Use rules to run a small plan for merge requests and a broader plan for protected branches or deployment pipelines. If the gate is required, do not mark the job allow_failure: true.
Protect the release path
After testing both pass and fail behavior:
Require the pipeline to succeed before merge.
Restrict production variables to protected branches and environments.
Require approvals for changes to the CI configuration that controls the gate.
Rotate the API token before expiry and after suspected exposure.
Troubleshooting
There is no endpoint to place in .gitlab-ci.yml
Obtain the public API contract for your workspace. The current production CI/CD tab describes the operations but does not publish their paths.
The token is unavailable in a merge-request pipeline
Check the variable's Protected and environment-scope settings against the pipeline source and target branch.
A failed plan does not block a merge
Confirm the job returns a non-zero exit code, is not allowed to fail, and is included in the project's merge checks.
Related pages
Current plan setup
Open the plan's CI / CD tab and select Open setup guide for current provider instructions. Use the displayed plan ID and a scoped CONTEXTQA_TOKEN secret. See CI/CD release gates for required permissions and failure-path validation.
Last updated
Was this helpful?
