To delete a single job:
curl -X POST http://jenkins-user:jenkins-token@hostname:port/job/execute-pipeline/26/doDelete
To delete a range of jobs:
curl -X POST http://jenkins-user:jenkins-token@hostname:port/job/execute-pipeline/[20-30]/doDelete
This is handy for deleting a build arising from a git event you’ve chosen to ignore in your Jenkinsfile:
def buildId = env.BUILD_ID
node {
sh "curl -X POST http://my_user:my_token@my_host:8080/job/execute-pipeline/${buildId}/doDelete"
}
No comments:
Post a Comment