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.ymlpipeline
Steps
1. Copy your ENV_COLLECTOR_URL
- In Costimizer, navigate to Shared Environments and select your environment.
- 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
- In your GitLab project, go to Settings → CI/CD → Variables (or define it in
.gitlab-ci.yml). - Add
ENV_COLLECTOR_URLwith 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.