Exemplo n.º 1
0
        public IHttpActionResult Jenkins(JenkinsNotification jData)
        {
            if (jData.Build.Phase == "FINALIZED")
            {
                return(Ok());
            }
            var rmqService = new RmqSkypeService();
            UniversalDal <JenkinsSubscription> dal = new UniversalDal <JenkinsSubscription>();

            dal.GetAll().Where(item => item.JenkisJobName == jData.Name && item.Active).ToList().ForEach(subscription =>
            {
                string smile = !string.IsNullOrEmpty(jData.Build.Status)
                    ? ((jData.Build.Status == "SUCCESS") ? "(sun)" : "(rain)")
                    : "(*)";
                rmqService.PushMessage(new RmqSkypeMessage()
                {
                    Conversation = subscription.ConversationName,
                    Message      =
                        string.Format("{0} Build for {1} - {2}{3}",
                                      smile,
                                      jData.Name,
                                      jData.Build.Phase,
                                      string.IsNullOrEmpty(jData.Build.Status) ? "" : ", status: *" + jData.Build.Status + "*")
                });
            });
            return(Ok());
        }
Exemplo n.º 2
0
        public IHttpActionResult SendMessagePost(RmqSkypeMessage jsonData)
        {
            var rmqService = new RmqSkypeService();

            rmqService.PushMessage(jsonData);
            return(Ok());
        }
Exemplo n.º 3
0
        public IHttpActionResult SendMessage(string to, string msg)
        {
            var rmqService = new RmqSkypeService();

            rmqService.PushMessage(new RmqSkypeMessage {
                Conversation = to,
                Message      = msg
            });
            return(Ok());
        }
Exemplo n.º 4
0
        public IHttpActionResult BuildEvent(string to, string job, string eventName, string revision = null, string node = null)
        {
            var rmqService = new RmqSkypeService();

            rmqService.PushMessage(new RmqSkypeMessage
            {
                Conversation = to,
                Message      = string.Format("(*) {0} build of {1} branch *{2}* for {3} node", job, revision, eventName, node)
            });
            return(Ok());
        }
Exemplo n.º 5
0
        public IHttpActionResult BranchLock(string locker, string branch, string command)
        {
            string skypeName  = GetSkypeNameByCruName(locker) ?? locker;
            var    rmqService = new RmqSkypeService();

            rmqService.PushMessage(new RmqSkypeMessage
            {
                Conversation = "Merge masters test chat",
                Message      = string.Format("[{0}] {1} {2}", skypeName, command, branch)
            });

            return(Ok());
        }
Exemplo n.º 6
0
        private IHttpActionResult SendCodeReviewMessage(string reviewer, string cruid, string message)
        {
            string skypeName = GetSkypeNameByCruName(reviewer);

            if (string.IsNullOrWhiteSpace(skypeName))
            {
                return(BadRequest("can't find skype name for " + reviewer));
            }
            var rmqService = new RmqSkypeService();

            rmqService.PushMessage(new RmqSkypeMessage
            {
                Conversation = GetSkypeNameByCruName(reviewer),
                Message      = string.Format("{0}: http://crucible/cru/{1}", message, cruid)
            });

            return(Ok());
        }