summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2015-12-10 18:08:58 +0000
committerJoe Robinson <joe@lc8n.com>2015-12-10 18:08:58 +0000
commitf6d63731ef8e30111f286ad3d4c27c1d9f109fef (patch)
tree71d1b48bf141c9df71b330bc889222230c00e97a /src
parent317ece104f891afd0c5928773e298cd6cf352f48 (diff)
Add commit messages to push output
Diffstat (limited to 'src')
-rw-r--r--src/main/java/uk/co/blatech/blaears/controllers/GitRelayController.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/uk/co/blatech/blaears/controllers/GitRelayController.java b/src/main/java/uk/co/blatech/blaears/controllers/GitRelayController.java
index f5d240e..4727c59 100644
--- a/src/main/java/uk/co/blatech/blaears/controllers/GitRelayController.java
+++ b/src/main/java/uk/co/blatech/blaears/controllers/GitRelayController.java
@@ -1,11 +1,13 @@
package uk.co.blatech.blaears.controllers;
+import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
+import uk.co.blatech.blaears.models.gitlab.Commit;
import uk.co.blatech.blaears.models.gitlab.Push;
import java.io.IOException;
@@ -20,8 +22,15 @@ public class GitRelayController {
@RequestMapping(value = "/gitlab", method = RequestMethod.POST)
String relay(@RequestBody Push pushMsg, Model model){
try {
+ String commitMsg = "";
+ for (Commit commit: pushMsg.getCommits()) {
+ if (StringUtils.isNotEmpty(commitMsg)) {
+ commitMsg += ", ";
+ }
+ commitMsg += "\"" + commit.getMessage() + "\"";
+ }
//DANGER
- Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom " + pushMsg.getUserName() + " pushed to " + pushMsg.getRepository().getName() + " | bash /home/smsd/msgrelay.bash "});
+ Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom " + pushMsg.getUserName() + " pushed to " + pushMsg.getRepository().getName() + ": "+ commitMsg + " | bash /home/smsd/msgrelay.bash "});
model.addAttribute("result", "OK");
} catch (IOException e) {
System.out.println("Failed to run command");