Skip to main content

GitLab integration

Summary​

The GitLab integration allows your GitLab CI/CD pipelines to automatically update Shared Environment properties in Costimizer—such as pipeline status, commit SHA, branch name, and triggering user—right after each build or deployment.

Estimated time: 5–10 minutes
Category: Developer Tools

Prerequisites​

  • At least one Shared Environment created in Costimizer
  • A GitLab repository with a .gitlab-ci.yml pipeline

Steps​

1. Copy your ENV_COLLECTOR_URL​

  1. In Costimizer, navigate to Shared Environments and select your environment.
  2. Open CI/CD integration on the Shared Environment details page and copy your unique ENV_COLLECTOR_URL.

2. Add ENV_COLLECTOR_URL to GitLab CI/CD variables​

  1. In your GitLab project, go to Settings → CI/CD → Variables (or define it in .gitlab-ci.yml).
  2. Add ENV_COLLECTOR_URL with the URL copied from Costimizer.

3. Add a send_status stage to .gitlab-ci.yml​

Add a final job that runs with when: always so Costimizer receives both successful and failed deployment statuses:

stage: send_status
needs: [$all_other_steps]
when: always
script:
- curl -X POST -H "Content-Type: application/json" -d "{\"Pipeline result\": \"$CI_PIPELINE_STATUS\", \"Version\": \"$CI_COMMIT_SHA\"}" "$ENV_COLLECTOR_URL"
Full step-by-step walkthrough

For screenshots, complete .gitlab-ci.yml examples (including Branch and TriggeredBy), and troubleshooting, see the full Connect GitLab CI/CD guide.