Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Semaphore API Call Snippet for Jenkins
echo "DEBUG: got project_id ${project_id} and template_id ${template_id}"
withCredentials([[$class: 'StringBinding', credentialsId: 'semaphore-token', variable: 'bearer']]) {
httpRequest acceptType: 'APPLICATION_JSON', consoleLogResponseBody: true, contentType: 'APPLICATION_JSON', customHeaders: [[name: 'Authorization', value: "Bearer ${env.bearer}"]], httpMode: 'POST', requestBody: """{
\"template_id\": ${template_id},
\"debug\": false,
\"dry_run\": false,
\"playbook\": \"\",
\"environment\": \"\"
}""", url: "https://ansible.ourdomain.com/api/project/${project_id}/tasks"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment