DevDynamics tracks builds using post-build metadata provided through the specified curl request.
curl --location \
--request \
POST 'https://api.devdynamics.ai/api/v1/deployment/<your-devdynamics-orgId>/notify' \
--header 'X-api-key: YOUR_API_KEY' \
--header 'X-delivery: BUILD_NUMBER' \
--header 'X-event: cd' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": "unique-deployment-id",
"name": "Job Name",
"timeStamp": "2024-01-15T12:00:00Z",
"startedAt": "2024-01-15T11:55:00Z",
"completedAt": "2024-01-15T12:00:00Z",
"htmlUrl": "Jenkins Build URL",
"source": "jenkins",
"status": "success",
"repository": "your-repo-name",
"artifact": "artifact-version",
"environment": "production",
"commit": "latest-commit-hash",
"tag": "test"
"additionalInfo": {
"label": "label1"
},
"stages": [{
"name": "",
"startTime": "",
"endTime": "",
"status": ""
}]
}'
Payload Fields Explanation
pipeline {
agent any
environment {
REPOSITORY = 'simple-maven-project-with-tests.git'
ENVIRONMENT = 'Production'
}
stages {
stage('Build') {
steps {
script {
git 'https://github.com/jglick/simple-maven-project-with-tests.git'
sh 'mvn -Dmaven.test.failure.ignore=true clean package'
}
}
post {
success {
script {
def timeStamp = new Date().format('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'')
def startTime = new Date().format('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'')
def completedTime = new Date().format('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'')
def scmVars = checkout([$class: 'GitSCM', branches: [[name: 'master']],
userRemoteConfigs: [[url: 'https://github.com/jglick/simple-maven-project-with-tests.git']]])
httpRequest contentType: 'APPLICATION_JSON', httpMode: 'POST', ignoreSslErrors: true, quiet: true, requestBody: """
{
"id": "${BUILD_NUMBER}",
"name": "${JOB_NAME}",
"timeStamp": "${timeStamp}",
"startedAt": "${startTime}",
"completedAt": "${completedTime}",
"commit": "${scmVars.GIT_COMMIT}",
"htmlUrl": "https://api.github.com/repos/devdynamics-ai/devd-client/deployments/696863512",
"source": "jenkins",
"status": "completed",
"repository": "${REPOSITORY}",
"environment": "${ENVIRONMENT}",
"branch": "${scmVars.GIT_BRANCH}",
"artifact": "",
"tag": "build-${BUILD_NUMBER}"
"additionalInfo": {},
"stages": [{
"name": "Build",
"startTime": "${startTime}",
"endTime": "${completedTime}",
"status": "completed"
}]
}
""", responseHandle: 'NONE', url: 'https://api.devdynamics.ai/api/v1/deployment/<your-devdynamics-orgId>/notify', wrapAsMultipart: false
}
}
failure {
script {
def timeStamp = new Date().format('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'')
def startTime = new Date().format('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'')
def completedTime = new Date().format('yyyy-MM-dd\'T\'HH:mm:ss\'Z\'')
def scmVars = checkout([$class: 'GitSCM', branches: [[name: 'master']],
userRemoteConfigs: [[url: 'https://github.com/jglick/simple-maven-project-with-tests.git']]])
httpRequest contentType: 'APPLICATION_JSON', httpMode: 'POST', ignoreSslErrors: true, quiet: true, requestBody: """
{
"id": "${BUILD_NUMBER}",
"name": "${JOB_NAME}",
"timeStamp": "${timeStamp}",
"startedAt": "${startTime}",
"completedAt": "${completedTime}",
"commit": "${scmVars.GIT_COMMIT}",
"htmlUrl": "https://api.github.com/repos/devdynamics-ai/devd-client/deployments/696863512",
"source": "jenkins",
"status": "failed",
"repository": "${REPOSITORY}",
"environment": "${ENVIRONMENT}",
"branch": "${scmVars.GIT_BRANCH}",
"artifact": "",
"tag": "build-${BUILD_NUMBER}"
"additionalInfo": {},
"stages": [{
"name": "Build",
"startTime": "${startTime}",
"endTime": "${completedTime}",
"status": "failed"
}]
}
""", responseHandle: 'NONE', url: 'https://api.devdynamics.ai/api/v1/deployment/<your-devdynamics-orgId>/notify', wrapAsMultipart: false
}
}
}
}
}
}