Methods
_console(cb:)
Get a handler that calls Jenkins API to stream console output.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
_delete(name:, cb:)
Delete a job.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
cb: |
function
|
standard cb(err, result) callback |
_delete(cb:)
Get a handler that calls Jenkins API to delete a job.
Success job deletion message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
build(name:, params:, cb:)
Build a job.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
params: |
Object
|
String
|
build parameters key-value pairs, passed as object or 'a=b&c=d' string |
cb: |
function
|
standard cb(err, result) callback |
build(cb:)
Get a handler that calls Jenkins API to build a job.
Success job stopped message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
colorByStatus(status:, jenkinsColor:)
Get color based on status and Jenkins status color.
Jenkins status color will take precedence over status because
Jenkins uses either blue or green as the color for ok status.
Color property can contain either color or status text.
Hence the need for mapping color to status text in the case where value is really color.
This is used in conjunction with statusByColor function.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
status: |
String
|
Jenkins status |
jenkinsColor: |
String
|
Jenkins status color |
Returns:
the status text
computer(cb:)
Retrieve Jenkins instance computer information.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
standard cb(err, result) callback |
copy(existingName:, newName:, cb:)
Copy an existing job into a new job.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
existingName: |
String
|
existing Jenkins job name to copy from |
newName: |
String
|
new Jenkins job name to copy to |
cb: |
function
|
standard cb(err, result) callback |
copy(cb:)
Get a handler that calls Jenkins API to copy a job into a new job.
Success job copy message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
create(name:, config:, cb:)
Create a job with specified configuration.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
config: |
String
|
Jenkins job config.xml |
cb: |
function
|
standard cb(err, result) callback |
create(name:, config:, cb:)
Create a view with specified configuration.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins view name |
config: |
String
|
Jenkins view config.xml |
cb: |
function
|
standard cb(err, result) callback |
create(cb:)
Get a handler that calls Jenkins API to create a job with specific configuration.
Success job creation message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
create(cb:)
Get a handler that calls Jenkins API to create a view with specific configuration.
Success view creation message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
crumb(cb:)
Retrieve Jenkins crumb, this is needed when sending POST requests to a Jenkins
instance with CSRF protection.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
standard cb(err, result) callback |
csrf(cb:)
Add Jenkins crumb header to instance.
This is needed for Jenkins installations that have CSRF protection enabled.
New installations of Jenkins starting version 2.x enables CSRF protection by default.
https://wiki.jenkins-ci.org/display/JENKINS/CSRF+Protection
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
standard cb(err, result) callback |
dashboard(cb:)
Get a handler that calls Jenkins API to get a list of all jobs on the Jenkins instance.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
disable(jobName:, cb:)
Disable a job.
If job was enabled, then it will be disabled.
If job was already disabled, then it will stay as-is, no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
jobName: |
String
|
Jenkins job name |
cb: |
function
|
standard cb(err, result) callback |
disable(cb:)
Get a handler that calls Jenkins API to disable a job.
Success job disabled message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
discover(host:, cb:)
Discover whether there's a Jenkins instance running on the specified host.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
host: |
String
|
hostname |
cb: |
function
|
standard cb(err, result) callback |
discover(cb:)
Get a handler that calls Jenkins API to discover a Jenkins instance on specified host.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
enable(name:, cb:)
Enable a job.
If job was disabled, then it will be enabled.
If job was already enabled, then it will stay as-is, no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
cb: |
function
|
standard cb(err, result) callback |
enable(cb:)
Get a handler that calls Jenkins API to enable a job.
Success job enabled message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
executor(cb:)
Get a handler that calls Jenkins API to display executors information per computer
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
executorSummary(computers:)
Summarise executor information from computers array.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
computers: |
Array
|
computers array, part of Jenkins#computer result |
Returns:
executor summary object
feed(cb:)
Get a handler that calls Jenkins API to retrieve feed.
Feed contains articles.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
fetchConfig(name:, cb:)
Fetch a job configuration.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
cb: |
function
|
standard cb(err, result) callback |
fetchConfig(name:, cb:)
Fetch a view configuration.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins view name |
cb: |
function
|
standard cb(err, result) callback |
fetchConfig(cb:)
Get a handler that calls Jenkins API to fetch a job configuration.
Jenkins job config.xml will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
fetchConfig(cb:)
Get a handler that calls Jenkins API to fetch a view configuration.
Jenkins view config.xml will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
htmlError(result:, cb:)
Parse HTML error page from Jenkins, pass the error message to the callback.
This error is usually the response body of error 400.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
result: |
Object
|
result of the sent request |
cb: |
function
|
standard cb(err, result) callback |
info(cb:)
Retrieve Jenkins instance information.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
standard cb(err, result) callback |
jobBuildNotFoundError(name:, buildNumber:)
Create a 'job or build not found' error handler function.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
the job name |
buildNumber: |
Number
|
the job's build number |
Returns:
a handler function
jobNotFoundError(name:)
Create a 'job not found' error handler function.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
the job name |
Returns:
a handler function
jobRequireParamsError(name:)
Create a 'job require params' error handler function.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
the job name |
Returns:
a handler function
monitor(opts:, cb:)
Monitor Jenkins latest build status on a set interval.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
opts: |
Object
|
optional - job: Jenkins job name - view: Jenkins view name - schedule: cron scheduling definition in standard * * * * * * format, default: 0 * * * * * (every minute) |
cb: |
function
|
standard cb(err, result) callback |
parseFeed(cb:)
Parse Jenkins instance feed (all jobs).
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
standard cb(err, result) callback |
parseFeed(name:, cb:)
Parse job feed.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
cb: |
function
|
standard cb(err, result) callback |
parseFeed(name:, cb:)
Parse view feed.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins view name |
cb: |
function
|
standard cb(err, result) callback |
passThroughResponse(result:, cb:)
Handle success simply by passing the entire response through to callback
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
result: |
Object
|
result of the sent request as a string |
cb: |
function
|
standard cb(err, result) callback |
passThroughSuccess(result:, cb:)
Handle success simply by passing result's (response) body through to callback.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
result: |
Object
|
result of the sent request as a string |
cb: |
function
|
standard cb(err, result) callback |
passThroughSuccessJson(result:, cb:)
Handle success simply by passing result's (response) JSON string body parsed as an object through to callback.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
result: |
Object
|
result of the sent request as object |
cb: |
function
|
standard cb(err, result) callback |
queue(cb:)
Retrieve a list of jobs in the queue waiting for available
executor or for a previously running build of the same job
to finish.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
standard cb(err, result) callback |
queue(cb:)
Get a handler that calls Jenkins API to read the queue.
Queue contains a list of jobs that are queued waiting for a free executor.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
read(name:, cb:)
Retrieve information about a job.
Information contains job status and reports among other things.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
cb: |
function
|
standard cb(err, result) callback |
read(name:, cb:)
Retrieve information about a view.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins view name |
cb: |
function
|
standard cb(err, result) callback |
read(cb:)
Get a handler that calls Jenkins API to retrieve information about a job.
Job status and health reports will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
readLatest(name:, cb:)
Retrieve information about the latest build of a job.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
cb: |
function
|
standard cb(err, result) callback |
readLatest(cb:)
Get a handler that calls Jenkins API to retrieve information about the latest build of a job.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
statusByColor(jenkinsColor:)
Get status based on the value of color property.
Color property can contain either color or status text.
Hence the need for mapping color to status text in the case where value is really color.
This is used in conjunction with colorByStatus function.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
jenkinsColor: |
String
|
Jenkins status color |
Returns:
the status text
stop(name:, cb:)
Stop a running/building job.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
cb: |
function
|
standard cb(err, result) callback |
stop(cb:)
Get a handler that calls Jenkins API to stop a job.
Success job stopped message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
streamConsole(name:, buildNumber:, interval:, cb:) → {ConsoleStream}
Stream a Jenkins job console output (readable stream).
Jenkins uses the following headers:
- x-more-data to determine whether there are still more content coming through
- x-text-size to determine the starting point of progressive text output (this was obviously badly named, but stayed there for backward compatibility reason)
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
buildNumber: |
Number
|
Jenkins job's build number |
interval: |
Number
|
interval between console requests in milliseconds |
cb: |
function
|
standard cb(err, result) callback |
update(name:, config:, cb:)
Update a job with specified configuration
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins job name |
config: |
String
|
Jenkins job config.xml |
cb: |
function
|
standard cb(err, result) callback |
update(name:, config:, cb:)
Update a view with specified configuration
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
Jenkins view name |
config: |
String
|
Jenkins view config.xml |
cb: |
function
|
standard cb(err, result) callback |
update(cb:)
Get a handler that calls Jenkins API to update a job with specific configuration.
Success job update message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
update(cb:)
Get a handler that calls Jenkins API to update a view with specific configuration.
Success view update message will be logged when there's no error.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
version(cb:)
Retrieve Jenkins version number from x-jenkins header.
If x-jenkins header does not exist, then it's assumed that the server is not a Jenkins instance.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
standard cb(err, result) callback |
version(cb:)
Get a handler that calls Jenkins API to read the Jenkins version.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
cb: |
function
|
callback for argument handling |
Returns:
Jenkins API handler function
viewNotFoundError(name:)
Create a 'view not found' error handler function.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
name: |
String
|
the view name |
Returns:
a handler function