Skip to content
This repository was archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
Remove unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
ikikko committed Jan 2, 2015
1 parent 0cca538 commit c0befd8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,19 @@
import javax.servlet.ServletException;
import java.io.IOException;


/**
* @see <a href="https://github.com/github/hubot-scripts/blob/master/src/scripts/jenkins.coffee">hubot script</a>
*/
@Extension
public class TypetalkWebhookAction implements RootAction {

// FIXME parameterized build
// FIXME check authentication

// TODO handle response back ( if Typetalk supports it )
// TODO enable alias job name

@Override
public String getIconFileName() {
return null;
Expand All @@ -32,41 +42,17 @@ public String getUrlName() {
}

@RequirePOST
public HttpResponse doNotify(final StaplerRequest request) {
public HttpResponse doNotify() {

return new HttpResponse() {
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node)
throws IOException, ServletException {

String message = new WebhookParser(req).parse();
WebhookExecutor executor = WebhookExecutorFactory.create(req, rsp, message);
executor.execute();

// for (ResponseContributor c : contributors) {
// c.addHeaders(req, rsp);
// }
// PrintWriter w = rsp.getWriter();
// for (ResponseContributor c : contributors) {
// c.writeBody(req, rsp, w);
// }
executor.execute();
}
};
}

static class TypetalkRequest {
Object topic;

// {"topic":{"id":9526,"name":"Typetalk Hack Tokyo Dec 2014","suggestion":"Typetalk Hack Tokyo Dec 2014","lastPostedAt":"2014-12-16T11:17:44Z","createdAt":"2014-12-16T08:32:53Z","updatedAt":"2014-12-16T08:32:53Z"},"post":{"id":754399,"topicId":9526,"replyTo":null,"message":"@ikikkobot+ hello","account":{"id":10,"name":"ikikko","fullName":"nakamura","suggestion":"nakamura","imageUrl":"https://typetalk.in/accounts/10/profile_image.png?t=1413099125640","createdAt":"2012-03-07T05:13:52Z","updatedAt":"2014-12-16T09:12:55Z"},"mention":null,"attachments":[],"likes":[],"talks":[],"links":[],"createdAt":"2014-12-16T11:17:44Z","updatedAt":"2014-12-16T11:17:44Z"}}

// @see https://github.com/github/hubot-scripts/blob/master/src/scripts/jenkins.coffee
//
// # Commands:
// # hubot jenkins b <jobNumber> - builds the job specified by jobNumber. List jobs to get number.
// # hubot jenkins build <job> - builds the specified Jenkins job
// # hubot jenkins build <job>, <params> - builds the specified Jenkins job with parameters as key=value&key2=value2
// # hubot jenkins list <filter> - lists Jenkins jobs
// # hubot jenkins describe <job> - Describes the specified Jenkins job
// # hubot jenkins last <job> - Details about the last build for the specified Jenkins job

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

public class BuildExecutor extends WebhookExecutor {

// TODO nakamura : パラメータ付きビルドの対応
// TODO nakamura : 認証付きの場合の確認

private static final Logger LOGGER = Logger.getLogger(BuildExecutor.class.getName());

private String job;
Expand Down

0 comments on commit c0befd8

Please sign in to comment.