// TimerTrigger("0 30 9 * * 1") -> Monday 9:30 am // TimerTrigger("0 */1 * * * *") -> Every minute // TimerTrigger("0 */30 * * * *") -> Every half hour // TimerTrigger("0 0 */1 * * *") -> Every hour // TimerTrigger("0 0 6 */1 * *") -> Every day at 6 UTC // TimerTrigger("0 0 16 * * 1") -> Every Monday 8:00 am PST // [FunctionName("TimedExecute")] public static void Run([TimerTrigger("0 0 16 * * 1")] TimerInfo myTimer, TraceWriter log) { log.Info($"C# Timer trigger function executed at: {DateTime.Now}"); log.Info($"C# Timer trigger function running with user: {WindowsIdentity.GetCurrent().Name}"); var project = new Project() { Id = EnvVars.DevDivProjectGuid, Name = Constants.DevDiv }; var logger = new Logger(log); var definitionId = EnvVars.NuGetOfficialBuildDefinitionId; var definition = VSTSUtil.GetBuildDefintionAsync(project, Int32.Parse(definitionId), logger).Result; foreach (var kvp in branchLookUp) { var branch = kvp.Key; var apiVersion = kvp.Value; var latestBuild = VSTSUtil.GetLatestBuildForBranchAsync(definition, logger, branch).Result; if (latestBuild != null) { ProcessLatestBuildAsync(log, logger, latestBuild, branch, apiVersion).Wait(); } else { log.Error($"Latest build for branch {branch} returned null!"); } } }
static void Main(string[] args) { var project = new Project() { Id = EnvVars.DevDivProjectGuid, Name = Constants.DevDiv }; var logger = new Logger(); var definitionId = EnvVars.NuGetOfficialBuildDefinitionId; var definition = VSTSUtil.GetBuildDefintionAsync(project, Int32.Parse(definitionId), logger).Result; var latestBuild = VSTSUtil.GetLatestBuildAsync(definition, logger).Result; if (latestBuild != null) { latestBuild.PopulateTimeLine(logger).Wait(); } var validations = latestBuild.TimelineRecords.Where(r => r.Name == VALIDATE_VSIX || r.Name == VALIDATE_REPO); var summaries = new List <LocValidationSummary>(); foreach (var validation in validations) { var summary = GetLocalizationSummary(validation.Log.GetLogContentAsync(logger).Result); if (!string.IsNullOrEmpty(summary)) { summaries.Add(new LocValidationSummary() { Summary = summary, Title = validation.Name }); } } }