Integrations

GitLab CI

Trigger a Killbug test plan from a GitLab CI deployment job.

Use the GitLab CI integration when a GitLab pipeline should run a Killbug test plan after deployment.

Before you start

Create or edit a test plan, add a Webhook trigger, and copy the generated Webhook URL. Store it as a masked CI/CD variable named KILLBUG_WEBHOOK_URL.

If each deployment has a different URL, store it in a variable such as KILLBUG_BASE_URL and send it as overrideBaseUrl.

Pipeline job

Add a post-deploy job to .gitlab-ci.yml:

killbug_post_deploy:
  stage: test
  image: alpine:3.20
  needs:
    - deploy_production
  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
  before_script:
    - apk add --no-cache curl jq
  script:
    - |
      jq -n \
        --arg message "[gitlab] $CI_COMMIT_TITLE" \
        --arg overrideBaseUrl "${KILLBUG_BASE_URL:-}" \
        '{ message: $message } + if $overrideBaseUrl == "" then {} else { overrideBaseUrl: $overrideBaseUrl } end' |
      curl --fail-with-body \
        -X POST "$KILLBUG_WEBHOOK_URL" \
        -H "Content-Type: application/json" \
        --data-binary @-

Replace deploy_production with the name of the job that completes your deployment.

Deployment timing

Keep the Killbug job after the deployment job. If your deploy job publishes a preview URL, export that URL into KILLBUG_BASE_URL or another CI variable before triggering Killbug.

Verification

Action: Run a pipeline where the deployment job succeeds.

Expected result: The killbug_post_deploy job runs after deployment and exits successfully.

Action: Open the Killbug run.

Expected result: The run message includes the GitLab commit title, and any failures include the normal browser evidence for review.

On this page