Example #1
0
 public string ParseTemplateText(string template, BaseProcess process, Func<string, string> valueEncoder = null)
 {
     return ParseTemplateTextKeywords(template, new Dictionary<string, Func<string>>()
         {
             {"instanceName", () => process.InstanceName},
             {"result", () => process.Skipped ? "skipped" : (process.Succeeded ? "OK" : "failed")},
             {"tags", () => string.Join(",", process.Instance.Tags)},
             {"log", () => process.FullLog },
             {"changeLog", () => string.Join(Environment.NewLine, process.Instance.ChangeLog)},
             {"changeLogShort", () => string.Join(Environment.NewLine, process.Instance.ChangeLogShort)},
             {"treeish", () => process.Instance.Treeish},
             {"machineName", () => Environment.MachineName},
         });
 }
Example #2
0
 public void Notify(BaseProcess process)
 {
     try
     {
         if (!ShouldNotify(process))
         {
             return;
         }
         process.Log(string.Format("Notifying using {0}:{1}", this.GetType().Name, Key));
         DoNotify(process);
         process.Log("Notified");
     }
     catch (Exception ex)
     {
         process.Log(string.Format("Error executing {0}: {1}", this.GetType().Name, ex.Message));
     }
 }
Example #3
0
 protected virtual bool ShouldNotify(BaseProcess process)
 {
     if (!(process is Deployment))
     {
         return false;
     }
     if (((Deployment) process).Dry)
     {
         return false;
     }
     if (process.Skipped && Settings.ContainsKey("IgnoreSkipped") && Settings["IgnoreSkipped"].ToLowerInvariant() == "true")
     {
         return false;
     }
     if (process.Succeeded && Settings.ContainsKey("IgnoreSucceeded") && Settings["IgnoreSucceeded"].ToLowerInvariant() == "true")
     {
         return false;
     }
     if (!process.Succeeded && Settings.ContainsKey("IgnoreFailed") && Settings["IgnoreFailed"].ToLowerInvariant() == "true")
     {
         return false;
     }
     return true;
 }
Example #4
0
 internal static void Log(string message, Instance instance, BaseProcess process)
 {
     TraceSource.TraceInformation(message);
 }
Example #5
0
 protected abstract void DoNotify(BaseProcess process);
Example #6
0
 internal void Log(string message, BaseProcess process)
 {
     Hub.Log(message, this, process);
 }