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 😉 ).
import Jenkins from "node-jenkins";
const jenkins = new Jenkins(jenkinsId, jenkinsToken, jenkinsPath, [
customHeaders
]);
Retrieve server information.
const info = await jenkins.info();
Retrieve job information
- jobName:
String
job url
const info = await jenkins.info(jobName);
Retrieve job configuration
- jobUrl:
String
job url
const config = await jenkins.getJobConfig(jobUrl);
Retrieve build information
- jobName:
String
job url - jobId:
Number
build id
const info = await jenkins.getBuildInfo(jobName, jobId);
Trigger build with parameters
- jobName:
String
job url - params:
Object
default={}
params to send to job building
const build = await jenkins.buildWithParams(jobName, [params]);
Trigger build now
- jobName:
String
job url
const build = await jenkins.build(jobName);
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.progressiveText(jobName, jobId, [showLogs, interval]);
This work is licensed under the MIT License (see the LICENSE file).