Created
November 27, 2020 19:50
-
-
Save AnandShiva/4db60deba5fb1731e8bd1b3ad943fd74 to your computer and use it in GitHub Desktop.
Jenkins Job without parameters triggered in nodejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var axios = require('axios'); | |
const jenkinsUrl = 'http://example_jenkins_server_url.com/job/<JOB_NAME>/build'; | |
const userName = 'example_user'; | |
const password = 'example_pass' | |
var config = { | |
method: 'post', | |
url: jenkinsUrl, | |
headers: { | |
Authorization: `Basic ${Buffer.from(`${userName}:${password}`).toString('base64')}`, | |
} | |
}; | |
axios(config) | |
.then(function (response) { | |
console.log(JSON.stringify(response.data)); | |
}) | |
.catch(function (error) { | |
console.log(error); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment