diff options
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java | 5 | ||||
-rw-r--r-- | src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java | 1 |
3 files changed, 18 insertions, 2 deletions
@@ -2,3 +2,17 @@ BlaEars ======= It's called BlaEars because it listens for HTTP requests. Get it? + +This is used for listening for HTTP requests on specified URLs, and then +doing something with them - specifically, sending messages to IRC (at +the moment) + +Current supported URLs - + +/git/push +Listens for GitLab messages announcing pushes to repositories + +/git/merge +Listens for GitLab messages announcing merge requests + +Uses Spring MVC and SpringBoot diff --git a/src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java b/src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java index 5622aea..09c7134 100644 --- a/src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java +++ b/src/main/java/uk/co/blatech/blaears/controllers/GitMergeController.java @@ -28,10 +28,11 @@ public class GitMergeController { } else if (mergeMsg.getObjectKind().equals("merge")) { action = " merged from branch "; } else { - return "gitlab"; + action = " did a " + mergeMsg.getObjectKind() + " from "; +// return "gitlab"; } //DANGER - Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom " + mergeMsg.getUser().getUserName()+ " created a merge request from " + mergeMsg.getObjectAttributes().getSourceBranch() + " to " + mergeMsg.getObjectAttributes().getTargetBranch() + ": " + mergeMsg.getUrl() + " | bash /home/smsd/msgrelay.bash "}); + Runtime.getRuntime().exec(new String[]{"/bin/bash", "-c", "echo theblueroom " + mergeMsg.getUser().getUserName() + action + mergeMsg.getObjectAttributes().getSourceBranch() + " to " + mergeMsg.getObjectAttributes().getTargetBranch() + ": " + mergeMsg.getUrl() + " | bash /home/smsd/msgrelay.bash "}); model.addAttribute("result", "OK"); } catch (IOException e) { System.out.println("Failed to run command"); diff --git a/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java b/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java index 85592c8..2e8020b 100644 --- a/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java +++ b/src/main/java/uk/co/blatech/blaears/controllers/GitPushController.java @@ -26,6 +26,7 @@ public class GitPushController { 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() + ": "+ commitMsg + " | bash /home/smsd/msgrelay.bash "}); |