@wkronmiller/node-jenkins

1.2.7 • Public • Published

node-jenkins

Travis Version License Issues Vulnerabilities Dependencies

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 😉 ).
import Jenkins from "node-jenkins";

const jenkins = new Jenkins(jenkinsId, jenkinsToken, jenkinsPath, [
  customHeaders
]);

Info

Retrieve server information.

const info = await jenkins.info();

Jobs

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);

Builds

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]);

Note that in all examples i use async/await, you can use .then instead

License

This work is licensed under the MIT License (see the LICENSE file).

Readme

Keywords

Package Sidebar

Install

npm i @wkronmiller/node-jenkins

Weekly Downloads

0

Version

1.2.7

License

MIT

Unpacked Size

208 kB

Total Files

18

Last publish

Collaborators

  • wkronmiller