Skip to content

Commit

Permalink
Merge pull request #16 Version 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robsonbittencourt authored Nov 29, 2016
2 parents eab7b09 + cc036e8 commit d7c0ee8
Show file tree
Hide file tree
Showing 26 changed files with 698 additions and 330 deletions.
18 changes: 18 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
engines:
duplication:
enabled: true
config:
languages:
javascript:
mass_threshold: 70

fixme:
enabled: true
ratings:
paths:
- "**.js"
- "**.module"
exclude_paths:
- config/
- test/
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ root = true
charset = utf-8
insert_final_newline = true
indent_style = space
indent_size = 3
end_of_line = crlf
indent_size = 2
end_of_line = lf
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "hubot-js"
}
26 changes: 2 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,37 +1,15 @@
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm
*.db

# Optional REPL history
.node_repl_history
.vscode
17 changes: 17 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Logs
*.log

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Dependency directories
node_modules

*.db

.vscode

/media
24 changes: 18 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
language: node_js
node_js:
- "5.11"

after_success:
- 'npm run coveralls'
language: node_js

node_js:
- 7.1.0

script:
- npm run lint

after_success:
- npm run coveralls

deploy:
provider: npm
email: [email protected]
api_key:
secure: DitKAhj07lrVL6QVjA5jlmtx9wr7aocDYiO3bhdIRMFHSZczKzt0iG9Eqyb0C8e6dLl4E9NUWB/qF+9oIoL/uzTOvk81M4nkFHfs2LsrLse4il5aZWd+aJGzhtUfLa3avYNZ4Ihh1l9oUilTUeip1ytWYgp3PSskQ13mEMrydRp7k7KXzDrnBHnsOPBGFE6ikwop66DylfFEMOZd7tDD63ZpcDF0UM0vLsgVJbUpimxU3/ck8vJGQTpShc0DSFHJM2oke9oqKGMVJxgPk/lwxJmQChE2TXrFlusE21ApZwm9RWaP7j2X7ZaLSXugfiSpu8w6nlyLH2leQ8gDXhIDwOhuWutXuT4I+xVKIjlhjlMXv/lVkeXvdsrlgsuVvhZaP+oxvbcUFSykAj6SU3gIpuPPV4v9SoWw5HbiMWn4eQbl6DssKjZQJuowLgak0BpxTfe2ceRxNrKBcUT4xPzVcueMRL697aqP0VufB4Ql2fUsMBFMt05jeLqIHgIl3OHPU8bwqalr5vahlGg9NxUqOOSj2MkoXJOM04hknu5OS0JMHgqkh+Pukb5Xa/QrQNeyQKGU73Q5PxblIptaM7wFHB2LfktCM0RLN4WANJV+qGSwL5lwSTkogYIDWQc8ZQi5LApiDriDlbO1bPT8GchhCFo6OvHhCQE5VI2Z41QdLFs=
on:
branch: master
39 changes: 23 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@

# [v1.0.1](https://github.com/hubot-js/gear-jenkins/releases/tag/1.0.1) (2016-08-26)

### Features

* log when unknow error occurs ([38a2343](https://github.com/hubot-js/gear-jenkins/commit/38a2343))
* included crumbissuer option ([85e6773](https://github.com/hubot-js/gear-jenkins/commit/85e6773))
* add MIT license ([3cf1383](https://github.com/hubot-js/gear-jenkins/commit/3cf1383))
* improve readme ([a729921](https://github.com/hubot-js/gear-jenkins/commit/a729921)), close [#1](https://github.com/hubot-js/gear-jenkins/issues/1)
* create changelog file

# [v1.0.0](https://github.com/hubot-js/gear-jenkins/releases/tag/1.0.0) (2016-08-22)

### Features

* Call Jenkins job by name
# [v2.0.0](https://github.com/hubot-js/gear-jenkins/releases/tag/2.0.0) (2016-11-29)

### Features

[Project](https://github.com/hubot-js/gear-jenkins/projects/1)

* Gear Jenkins is now configurable by the Slack

# [v1.0.1](https://github.com/hubot-js/gear-jenkins/releases/tag/1.0.1) (2016-08-26)

### Features

* log when unknow error occurs ([38a2343](https://github.com/hubot-js/gear-jenkins/commit/38a2343))
* included crumbissuer option ([85e6773](https://github.com/hubot-js/gear-jenkins/commit/85e6773))
* add MIT license ([3cf1383](https://github.com/hubot-js/gear-jenkins/commit/3cf1383))
* improve readme ([a729921](https://github.com/hubot-js/gear-jenkins/commit/a729921)), close [#1](https://github.com/hubot-js/gear-jenkins/issues/1)
* create changelog file

# [v1.0.0](https://github.com/hubot-js/gear-jenkins/releases/tag/1.0.0) (2016-08-22)

### Features

* Call Jenkins job by name
42 changes: 21 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Robson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The MIT License (MIT)

Copyright (c) 2016 Robson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
46 changes: 17 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,35 @@
This is a gear to add to [hubot.js](https://github.com/hubot-js/hubot.js) the ability to interact with [Jenkins](https://jenkins.io/). If you do not know the hubot.js or do not know what they are gears like this [click here](https://github.com/hubot-js/hubot.js/blob/master/README.md) for more details.

![start-deploy-gif](https://s10.postimg.org/jl5ptldnt/hubot_start_deploy2.gif)
![start-job](media/start-job.gif)

## Starting

By using this gear you should inform your Jenkins url to start hubot.js. Something like the example below.
To use this gear you must first activate it with the command:

```
docker run -d -e BOT_API_KEY=your_slack_api_key \
-e BOT_NAME=name_of_your_bot \
-e JENKINS_AUTH_URL=your_jenkins_auth_url \
--restart="unless-stopped" \
--name=hubot \
robsonbittencourt/hubot.js
activate jenkins
```
![activate](media/activate-gear.gif)

Examples without using Docker you can find [here](https://github.com/hubot-js/hubot.js/blob/master/README.md).
## Configurations

## Jenkins url
Some settings are required. They can be made by Slack using the following command:

If you use Jenkins without security (authentication) the authorization link is simply the access url. For example: `http://your.jenkins.com:8080`

If you use the Jenkins authentication, you need to find your access token. It can be obtained from `yourJenkinsUrl/me/configure`. See more details [here](https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients). In this case your authorization link should be in this format: `http://your_user:your_token@your_jenkins_url`

After that, you can ask me to do your jobs.
```
configure jenkins
```
![configure](media/configure-gear.gif)

## CSRF Protection
These settings are stored, so you just need to do them once. But if necessary can make them again.

If you use the Jenkins secure option ["Prevent Cross Site Request Forgery exploits"](https://wiki.jenkins-ci.org/display/JENKINS/Remote+access+API) you should pass the CRUMB_ISSUER parameter.
Below are the details about each setting:

```
docker run -d -e BOT_API_KEY=your_slack_api_key \
-e BOT_NAME=name_of_your_bot \
-e JENKINS_AUTH_URL=your_jenkins_auth_url \
-e CRUMB_ISSUER=true \
--restart="unless-stopped" \
--name=hubot \
robsonbittencourt/hubot.js
```
### Jenkins url

In this case inform the parameter to true is required. If you don't use this option isn't not necessary. By default the parameter it's false.
If you use Jenkins without security (authentication) the authorization link is simply the access url. For example: `http://your.jenkins.com:8080`

If you use the Jenkins authentication, you need to find your access token. It can be obtained from `yourJenkinsUrl/me/configure`. See more details [here](https://wiki.jenkins-ci.org/display/JENKINS/Authenticating+scripted+clients). In this case your authorization link should be in this format: `http://your_user:your_token@your_jenkins_url`

## Usage

Expand All @@ -55,7 +43,7 @@ When hubot.js starts you can call Jenkins of jobs writing the following sentence
hubot start job my-deploy
```

![start-deploy](https://s9.postimg.org/g9dt1se9b/hubot_job.png)
![start-job](media/start-job.png)

## Development setup
- Fork and clone this project
Expand All @@ -68,4 +56,4 @@ Robson Bittencourt - @rluizv - [email protected]

Distributed under the MIT license. See [LICENSE](LICENSE) for more information.

https://github.com/robsonbittencourt/gear-jenkins
https://github.com/hubot-js/gear-jenkins
30 changes: 30 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"speak": "Okay, I'll ask you some questions. If you need more details <https://github.com/hubot-js/gear-jenkins#configurations|*click here*>."
},

{
"speak": "_*Do you use Jenkins with authentication?*_",
"expectedResponses": [
{
"response": "Yes",
"iteration": {
"speak": "_*What is the Jenkins url?*_ The url should have this format: http://user:authToken@jenkinsUrl. \nIf you do not want to make this setting now, keeping the current value, type *skip*.",
"handler": "src/configHandler/url-handler"
}
},

{
"response": "No",
"iteration": {
"speak": "_*What is the Jenkins url?*_ Just use the Jenkins access url. \nIf you do not want to make this setting now, keeping the current value, type *skip*.",
"handler": "src/configHandler/url-handler"
}
}
]
},

{
"speak": "All right. Jenkins configured."
}
]
1 change: 0 additions & 1 deletion config/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@
"message": "<!channel|channel> Alright. I'll start the job"
}
}

]
Binary file added media/activate-gear.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/configure-gear.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/start-job.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added media/start-job.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions migrations/001-initial-schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
-- Up
CREATE TABLE config (id INTEGER, url TEXT);
INSERT INTO config (id) VALUES (1);

-- Down
DROP TABLE config;
Loading

0 comments on commit d7c0ee8

Please sign in to comment.