Quick and dirty VSTS builds monitoring using Sparky

Alexey Melezhik - Oct 25 '18 - - Dev Community

Sparky is a powerful pocket size task runner server in crontab style.

It's just a piece of cake how you can monitor VSTS builds using Sparky.

The task is to check that VSTS builds scheduled daily finish successfully.

Monitoring scenario

There are daily builds for production release candidates web application. The application source code is at VSTS git repository $git-repository and the build definition named as Web Build. We want to ensure the next day after a build happens that it succeeds.

Sparrowdo plugin called vsts-schedule-build-check does all the job:

$ nano sparrowfile

#!perl6

my $git-repository = "http/git/repo";

git-scm $git-repository;

task-run "WebApplication Build Check", "vsts-schedule-build-check", %(
  pattern => "Web Build",
);

Enter fullscreen mode Exit fullscreen mode

Monitoring scheduler

As builds get run daily, we run monitor daily as well, right after builds:

$ nano sparky.yaml

crontab: "2 20 * * *"
keep_builds: 10
Enter fullscreen mode Exit fullscreen mode

keep_builds directive means no more 10 sparky reports are kept for this job, as we don't want to keep monitoring reports forever.

Report

2018-10-24 20:02:19 : [task] WebApplication Build Check [plg] vsts-schedule-build-check [path] /
++ grep schedule
++ grep 'Web Build Update'
++ vsts build list
104316  2.0181e+07   completed  succeeded              872  Web Build master     2018-10-24 03:00:00.560775  schedule
102573  2.0181e+07   completed  succeeded              872  Web Build master     2018-10-23 03:00:00.267757  schedule
100867  2.0181e+07   completed  succeeded              872  Web Build master     2018-10-22 03:00:01.772785  schedule
 77631  2.0181e+07   completed  succeeded              872  Web Build master     2018-10-21 03:00:01.573334  schedule
 78325  2.0181e+07   completed  succeeded              872  Web Build master     2018-10-20 03:00:00.225068  schedule
 76774  2.0181e+07   completed  failed                 872  Web Build master     2018-10-17 03:00:00.877437  schedule
 75028  2.0181e+07   completed  failed                 872  Web Build master     2018-10-18 03:00:00.548563  schedule
 73277  2.0181e+07   completed  failed                 872  Web Build master     2018-10-17 03:00:00.477304  schedule
 71571  2.0181e+07   completed  failed                 872  Web Build master     2018-10-16 03:00:02.605516  schedule
 87715  2.0181e+07   completed  failed                 872  Web Build master     2018-10-15 03:00:02.266283  schedule
 88667  2.0181e+07   completed  failed                 872  Web Build master     2018-10-14 03:00:00.535670  schedule
 87423  2.0181e+07   completed  succeeded              872  Web Build master     2018-10-13 03:00:00.537774  schedule
 61408  2.01807e+07  completed  succeeded              872  Web Build develop    2018-07-26 03:00:01.518767  schedule
ok  scenario succeeded
ok  text match /completed\s+succeeded.*\s+2018-10-24\s+\S+\s+schedule$/
ok  text match /completed\s+(succeeded|failed).*\s+2018-10-24\s+\S+\s+schedule$/
STATUS  SUCCEED

Enter fullscreen mode Exit fullscreen mode

Last build for yesterday (2018-10-24) is successful and we're happy.

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player