Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update README.md

  • Loading branch information...
commit ebfe19be47c3cc2eb5a363e8b58e6c4801cf41a0 1 parent b15282b
@jansepar authored
Showing with 107 additions and 6 deletions.
  1. +107 −6 README.md
View
113 README.md
@@ -7,11 +7,112 @@ https://github.com/txels/autojenkins
There are many things you can do, such as:
-* Trigger builds
-* Get info on jobs/builds
-* Copy jobs
-* Delete jobs
+## Install
+
+<pre>
+git clone git@github.com:jansepar/node-jenkins-api.git
+cd node-jenkins-api
+npm link
+</pre>
+
+## Usage
+
+### setup
+
+```javascript
+var jenkinsapi = require('./jenkinsapi');
+
+var jenkins = jenkinsapi.init("http://jenkins.yoursite.com");
+// or with auth
+var jenkins = jenkinsapi.init("http://username:password@jenkins.yoursite.com");
+```
+
+### all jobs
+
+```javascript
+jenkins.all_jobs(function(err, data) {
+ if (err){ return console.log(err); }
+ console.log(data)
+});
+```
+### job info
+
+```javascript
+jenkins.job_info('job-in-jenkins', function(err, data) {
+ if (err){ return console.log(err); }
+ console.log(data)
+});
+```
+### last build info
+
+```javascript
+jenkins.last_build_info('job-in-jenkins', function(err, data) {
+ if (err){ return console.log(err); }
+ console.log(data)
+});
+```
+
+### last build report
+
+```javascript
+jenkins.last_build_report('job-in-jenkins', function(err, data) {
+ if (err){ return console.log(err); }
+ console.log(data)
+});
+```
+
+### get config xml
+
+```javascript
+jenkins.get_config_xml('job-in-jenkins', function(err, data) {
+ if (err){ return console.log(err); }
+ console.log(data)
+});
+```
+
+### copy job
+
+```javascript
+jenkins.copy_job('job-to-copy'
+ ,'new-job-title'
+ ,function(config) {
+ // function which takes the config.xml, and returns
+ // the new config xml for the new job
+ return config.replace('development','feature-branch');
+ }
+ ,function(error, data) {
+ // if no error, job was copied
+ if (err){ return console.log(err); }
+ console.log(data)
+ });
+```
+
+### delete job
+
+```javascript
+jenkins.delete_job('job-in-jenkins', function(err, data) {
+ if (err){ return console.log(err); }
+ console.log(data)
+});
+```
+
+### last success
+
+```javascript
+jenkins.last_success('job-in-jenkins', function(err, data) {
+ if (err){ return console.log(err); }
+ console.log(data)
+});
+```
+
+### last result
+```javascript
+jenkins.last_result('job-in-jenkins', function(err, data) {
+ if (err){ return console.log(err); }
+ console.log(data)
+});
+```
+
+
-Here is an example:
-*COMING SOON
Please sign in to comment.
Something went wrong with that request. Please try again.