Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
kub1x committed Jun 26, 2017
2 parents f288361 + 5453136 commit 1deccd2
Show file tree
Hide file tree
Showing 5 changed files with 1,002 additions and 46 deletions.
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jenkins.update_job('job-to-update',
function(config) {
// function which takes the config.xml, and returns
// the new config xml for the job
return config.replace('development,'feature-branch');
return config.replace('development', 'feature-branch');
}
,function(err, data) {
// if no error, job was copied
Expand Down Expand Up @@ -211,8 +211,60 @@ jenkins.all_jobs_in_view('view-in-jenkins', function(err, data) {
if (err){ return console.log(err); }
console.log(data)
});

### update existing job configuration
```javascript
jenkins.update_config('job-to-update'
,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(err, data) {
// if no error, job was copied
if (err){ return console.log(err); }
console.log(data)
});
```

### create view

```javascript
jenkins.create_view('new-view-name', function(err, data) {
if (err){ return console.log(err); }
console.log(data)
});
```

### update view

```javascript
var viewConfig = {
name: "view-in-jenkins",
"description": "This is the view-in-jenkins View",
"statusFilter": "",
"job-in-jenkins": true,
"useincluderegex": true,
"includeRegex": "prefix.*",
"columns": [{"stapler-class": "hudson.views.StatusColumn", "$class": "hudson.views.StatusColumn"}, {"stapler-class": "hudson.views.WeatherColumn", "$class": "hudson.views.WeatherColumn"}, {"stapler-class": "hudson.views.JobColumn", "$class": "hudson.views.JobColumn"}, {"stapler-class": "hudson.views.LastSuccessColumn", "$class": "hudson.views.LastSuccessColumn"}, {"stapler-class": "hudson.views.LastFailureColumn", "$class": "hudson.views.LastFailureColumn"}, {"stapler-class": "hudson.views.LastDurationColumn", "$class": "hudson.views.LastDurationColumn"}, {"stapler-class": "hudson.views.BuildButtonColumn", "$class": "hudson.views.BuildButtonColumn"}]
};
jenkins.update_view('view-in-jenkins', viewConfig, function(err, data) {
if (err){ return console.log(err); }
console.log(data)
});
```

### delete view

```javascript
jenkins.delete_view('view-in-jenkins', function(err, data) {
if (err){ return console.log(err); }
console.log(data)
});
```


## Default configuration

You can set the default configuration which will be use in all HTTP requests by calling init with the additional options parameter:
Expand Down
Loading

0 comments on commit 1deccd2

Please sign in to comment.