Пример #1
0
        public void Notify(BuildState buildState)
        {
            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(_configuration.SlackWebHookUrl);

                    var message = new SlackMessage
                    {
                        text = buildState.ToString(),
                        channel = GetChannel(buildState.Status),
                        icon_emoji = GetIconEmoji(buildState.Status),
                        username = _configuration.SlackUserName
                    };

                    HttpContent content = new StringContent(JsonConvert.SerializeObject(message), Encoding.UTF8, "application/json");

                    var result =
                        client.PostAsync("", content).Result;
                    string resultContent = result.Content.ReadAsStringAsync().Result;
                    Console.WriteLine(resultContent);
                }
            }
            catch (Exception e)
            {
                Log.Error("Failed to notify slack", e);
            }
        }
Пример #2
0
 public void Notify(BuildState buildState)
 {
     Console.WriteLine(buildState);
 }
Пример #3
0
 public void Notify(BuildState buildState)
 {
     Console.WriteLine(buildState);
 }
Пример #4
0
 private static bool BuildIsDone(BuildState b)
 {
     return b.Status == BuildStatus.Failed || b.Status == BuildStatus.Succeeded;
 }