Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added branch selection when deploying, closes #26 #28

Merged
merged 9 commits into from
Sep 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,19 @@ If you are new to Hubot visit the [getting started](https://hubot.github.com/doc
HUBOT_BLUEMIX_SPACE=<Bluemix space>
HUBOT_BLUEMIX_USER=<Bluemix User ID>
HUBOT_BLUEMIX_PASSWORD=<Password for the Bluemix use>
HUBOT_GITHUB_TOKEN=<GitHub personal access token> (optional)
HUBOT_GITHUB_DOMAIN=<GitHub domain, omit for public GitHub> (optional)

5. Start up your bot & off to the races!

## Commands

- `hubot deploy` - Deployment setup with prompts for application and GitHub URL.
- `hubot deploy <app>` - Deployment setup for , or prompt you to provide a GitHub URL to deploy to .
- `hubot deploy <url>` - Deployment setup for and prompt you for the Bluemix application name.
- `hubot deploy <app> <url>` - Deployment of as on Bluemix.
- `hubot deploy help`- Show available deploy commands.
- `hubot deploy` - Deployment setup with prompts for application, GitHub URL and branch.
- `hubot deploy <app>` - Deployment setup for app, or prompt you to provide a GitHub URL and branch to depoy to.
- `hubot deploy <url>` - Deployment setup for url and prompt you for the Bluemix application name and branch.
- `hubot deploy <app> <url>` - Deployment of app with url, prompt for branch if not provided.
- `hubot deploy help` - Show available commands in the deploy category.


Your github repository should contain a `manifest.yml` that describes the deployment of the application.
More information about application deployment and manifest files can be read here: https://console.ng.bluemix.net/docs/manageapps/depapps.html#deployingapps
Expand Down Expand Up @@ -68,6 +71,8 @@ Please refer to the [CONTRIBUTING.md](https://github.com/ibm-cloud-solutions/hub
export HUBOT_BLUEMIX_SPACE=<Bluemix space>
export HUBOT_BLUEMIX_USER=<Bluemix User ID>
export HUBOT_BLUEMIX_PASSWORD=<Password for the Bluemix use>
export HUBOT_GITHUB_TOKEN=<GitHub personal access token> (optional)
export HUBOT_GITHUB_DOMAIN=<GitHub domain, omit for public GitHub> (optional)

3. In order to view content in chat clients you will need to add `hubot-ibmcloud-formatter` to your `external-scripts.json` file. Additionally, if you want to use `hubot-help` to make sure your command documentation is correct. Create `external-scripts.json` in the root of this project, with the following contents:

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
],
"dependencies": {
"adm-zip": "^0.4.7",
"yamljs": "^0.2.8"
"yamljs": "^0.2.8",
"github": "^3.0.0"
},
"config": {
"commitizen": {
Expand Down
24 changes: 24 additions & 0 deletions src/lib/github.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

/*
* Licensed Materials - Property of IBM
* (C) Copyright IBM Corp. 2016. All Rights Reserved.
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
'use strict';

const Github = require('github');

const gh = new Github({
version: '3.0.0',
host: process.env.HUBOT_GITHUB_DOMAIN || 'api.github.com'
});

if (process.env.HUBOT_GITHUB_TOKEN) {
gh.authenticate({
type: 'token',
token: process.env.HUBOT_GITHUB_TOKEN
});
}

module.exports = gh;
3 changes: 2 additions & 1 deletion src/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

"github.deploy.app.select": "Which app would you like to deploy? Here are the ones I know about:",
"github.deploy.failure": "Sorry, I tried my best.",
"github.deploy.in.progress": "Deploying *%s* from master branch of %s.",
"github.deploy.in.progress": "Deploying *%s* from *%s* branch of %s.",
"github.deploy.in.progress.matching": "Deploying matching apps.",
"github.deploy.started": "Deployment *%s* has been started.",
"github.deploy.name.invalid": "You didn't give me a valid app name. I would love to do something with this, but I cannot.",
Expand Down Expand Up @@ -38,6 +38,7 @@
"github.deploy.error": "A deployment error occurred for app *%s*: %s.",
"github.deploy.manifest.error": "Invalid manifest.yml file for app *%s*.",
"github.deploy.route.error": "Error adding route to the application: *%s*.",
"github.deploy.branch.prompt": "Which *branch* would you like to deploy?",

"help.github.deploy": "Deployment setup with prompts for application and GitHub URL.",
"help.github.deploy.app": "Deployment setup for <app>, or prompt you to provide a GitHub URL to deploy to <app>.",
Expand Down
Loading