Jenkins integration
Summary
The Jenkins integration enables Jenkins pipelines and jobs to automatically update Shared Environment properties in Costimizer after every build or deployment, so your team can always see the latest deployment state and software version alongside environment costs.
Estimated time: 5 minutes
Category: Developer Tools
Prerequisites
- At least one Shared Environment created in Costimizer
- A Jenkins pipeline (
Jenkinsfile) withcurlavailable on the build agent
Steps
1. Get your ENV_COLLECTOR_URL
- In Costimizer, go to Shared Environments and click your target environment.
- Open the CI/CD integration panel on the Shared Environment details page and copy the ENV_COLLECTOR_URL.
2. Add ENV_COLLECTOR_URL as a Jenkins credential or environment variable
Store the copied URL in Jenkins (Manage Jenkins → Credentials, or in your Jenkinsfile environment block) as ENV_COLLECTOR_URL.
3. Add a post block to your Jenkinsfile
Add a post { always { ... } } section so Jenkins sends the deployment status regardless of whether the build succeeds or fails:
post {
always {
script {
sh '''
curl -X POST \
-H "Content-Type: application/json" \
-d "{\\"Pipeline result\\": \\"${currentBuild.currentResult}\\", \\"Version\\": \\"${GIT_COMMIT}\\"}" \
"${ENV_COLLECTOR_URL}"
'''
}
}
}
Verification
- Run your Jenkins pipeline.
- Open your environment in Shared Environments in Costimizer and verify that the Shared Environment properties section shows the latest
Pipeline resultandVersion.