node-jenkins
Usage
Create an instance
Options
- jenkinsId:
String
usually the email you use to log into your jenkins. - jenkinsToken:
String
you can find it in your jenkins personal area. - jenkinsPath:
String
the url you use to acces to your jenkins. - customHeaders:
Object
default={}
with custom headers to be sended in every request (don't worry about the 'Authorization' or 'crumb' headers, node-jenkins do it for you 😉 ).
; const jenkins = jenkinsId jenkinsToken jenkinsPath customHeaders;
Info
Retrieve server information.
const info = await jenkins;
Jobs
Retrieve job information
- jobName:
String
job url
const info = await jenkins;
Retrieve job configuration
- jobUrl:
String
job url
const config = await jenkins;
Builds
Retrieve build information
- jobName:
String
job url - jobId:
Number
build id
const info = await jenkins;
Trigger build with parameters
- jobName:
String
job url - params:
Object
default={}
params to send to job building
const build = await jenkins;
Trigger build now
- jobName:
String
job url
const build = await jenkins;
Show progressive console output
- jobName:
String
job url - jobId:
Number
build id - showLogs:
Boolean
default=true
you can execute this function without displaying logs on console, only to waiting for the build finish - interval:
Number
default=100
interval to retrieve next output in milliseconds
await jenkins;
async
/await
, you can use .then
instead
Note that in all examples i use License
This work is licensed under the MIT License (see the LICENSE file).