Update Bot Watcher's Dashboard for Buildbot 0.9
authoraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Aug 2017 03:22:15 +0000 (03:22 +0000)
committeraakash_jain@apple.com <aakash_jain@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Aug 2017 03:22:15 +0000 (03:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174777

Reviewed by Daniel Bates.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Buildbot.js:
(Buildbot): Check if USE_BUILDBOT_VERSION_LESS_THAN_09 is passed.
(Buildbot.prototype._computeBuilderNameToIDMap): Fetch the builder name to ID mapping from buidbot and store
in a dictionary.
(Buildbot.prototype.buildPageURLForIteration): Updated URL as per Buildbot 0.9 format. Buildbot 0.9 currently does not support
builder name in the build url. See <https://github.com/buildbot/buildbot/issues/3465>.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
(isMultiCodebaseGotRevisionProperty): Adapting to new data format.
(parseRevisionProperty): Ditto.
(BuildbotIteration.prototype.failureLogURL): Return the URL to build page if precise failure url is not available. For
Buildbot 0.9, build page URL would be appropriate in most cases as per the new UI.
(BuildbotIteration.prototype._parseData): Parsing the data as per new data format. Many variable names and data types
have changed in Buildbot 0.9.
(BuildbotIteration.prototype._adjustBuildDataForBuildbot09): Adjust the Buildbot 0.8 data to new format.
(BuildbotIteration.prototype._updateIfDataAvailable): Update method for Buildbot 0.9 data. We are performing two API calls,
one for build information, another for step information of that build. We need to wait until data from both REST API calls are available.
(BuildbotIteration.prototype._deprecatedUpdateWithData): Renamed from _updateWithData, used for Buildbot 0.8 data.
(BuildbotIteration.prototype.get buildURL): URL to fetch build information from Buildbot. Also fetches got_revision property.
(BuildbotIteration.prototype.get buildStepsURL): URL to fetch the steps information from Buildbot.
(BuildbotIteration.prototype.urlFailedToLoad): Callback method to be used when URL fails to load. Made it a separate function now.
(BuildbotIteration.prototype.update): Modified to support both Buildbot 0.9 and 0.8 data format.
(BuildbotIteration.prototype.actualUpdate): Update method for Buildbot 0.9 data.
(BuildbotIteration.prototype.deprecatedUpdate): Update method for Buildbot 0.8 data.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
(BuildbotQueue.prototype.get baseURL): Updated URL as per Buildbot 0.9 format.
(BuildbotQueue.prototype.get allIterationsURL): Ditto.
(BuildbotQueue.prototype.get overviewURL): Ditto.
(BuildbotQueue.prototype.get buildsURL): URL to fetch builds data in Buildbot 0.9.
(BuildbotQueue.prototype.get buildsInfoURL): Returns the appropriate URL to use to fetch builds information from
Buildbot 0.8 or 0.9.
(BuildbotQueue.prototype.getBuilds): Method compatible with both Buildbot 0.8 and 0.9 to get build information from data
fetched from Buildbot. Also, reversing the Buildbot 0.8 data to make it similar to 0.9 data format.
(BuildbotQueue.prototype.isBuildComplete): Method compatible with both Buildbot 0.8 and 0.9 to check if the build has completed.
(BuildbotQueue.prototype.getIterationID):  Method compatible with both Buildbot 0.8 and 0.9 to get the Iteration ID.
(BuildbotQueue.prototype.update): Supports both Buildbot 0.8 and 0.9. Buildbot 0.9 REST API doesn't have cachedBuilds and currentBuilds.
Therefore we are fetching information for fixed number of build.
Also iterating the loop incrementally since the build data is already reverse sorted.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTestResults.js:
(BuildbotTestResults.prototype._parseResults): Updated as per Buildbot 0.9 format. Note that we do not
need to worry about 0.8 or 0.9 data format here, since the data is already converted to 0.9 format.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js:
(WebKitBuildbot): Pass the USE_BUILDBOT_VERSION_LESS_THAN_09 flag.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220120 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Buildbot.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTestResults.js
Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js
Tools/ChangeLog

index 3e9d78b..d9d518d 100644 (file)
@@ -42,6 +42,11 @@ Buildbot = function(baseURL, queuesInfo, options)
     this._needsAuthentication = typeof options === "object" && options.needsAuthentication === true;
     this._authenticationStatus = Buildbot.AuthenticationStatus.Unauthenticated;
 
+    this.VERSION_LESS_THAN_09 = options && options.USE_BUILDBOT_VERSION_LESS_THAN_09;
+
+    if (!this.VERSION_LESS_THAN_09)
+        this._computeBuilderNameToIDMap();
+
     for (var id in queuesInfo) {
         if (queuesInfo[id].combinedQueues) {
             for (var combinedQueueID in queuesInfo[id].combinedQueues)
@@ -146,9 +151,26 @@ Buildbot.prototype = {
         }
     },
 
+    // FIXME: Remove this logic after <https://github.com/buildbot/buildbot/issues/3465> is fixed.
+    _computeBuilderNameToIDMap: function()
+    {
+        JSON.load(this.baseURL + "api/v2/builders", function(data) {
+            if (!data || !(data.builders instanceof Array))
+                return;
+
+            this._builderNameToIDMap = {};
+            for (var builder of data.builders)
+                this._builderNameToIDMap[builder.name] = builder.builderid;
+        }.bind(this));
+    },
+
     buildPageURLForIteration: function(iteration)
     {
-        return this.baseURL + "builders/" + encodeURIComponent(iteration.queue.id) + "/builds/" + iteration.id;
+        if (this.VERSION_LESS_THAN_09)
+            return this.baseURL + "builders/" + encodeURIComponent(iteration.queue.id) + "/builds/" + iteration.id;
+
+        // FIXME: Remove this._builderNameToIDMap lookup after <https://github.com/buildbot/buildbot/issues/3465> is fixed.
+        return this.baseURL + "#/builders/" + encodeURIComponent(this._builderNameToIDMap[iteration.queue.id]) + "/builds/" + iteration.id;
     },
 
     javaScriptCoreTestFailuresURLForIteration: function(iteration, name)
index 81373fb..e92b64b 100644 (file)
@@ -97,20 +97,24 @@ BuildbotIteration.Event = {
 // See <http://docs.buildbot.net/0.8.8/manual/cfg-properties.html>.
 function isMultiCodebaseGotRevisionProperty(property)
 {
-    return property[0] === "got_revision" && typeof property[1] === "object";
+    return typeof property[0] === "object";
 }
 
 function parseRevisionProperty(property, key, fallbackKey)
 {
     if (!property)
         return null;
-    var value = property[1];
+    var value = property[0];
 
-    // The property got_revision may have the following forms:
-    //
+    // The property got_revision may have the following forms in Buildbot v0.8:
     // ["got_revision",{"Internal":"1357","WebKitOpenSource":"2468"},"Source"]
     // OR
     // ["got_revision","2468","Source"]
+    //
+    // It may have the following forms in Buildbot v0.9:
+    // [{"Internal":"1357","WebKitOpenSource":"2468"}, "Source"]
+    // OR
+    // ["2468", "Source"]
     if (isMultiCodebaseGotRevisionProperty(property))
         value = (key in value) ? value[key] : value[fallbackKey];
     return value;
@@ -160,6 +164,9 @@ BuildbotIteration.prototype = {
 
         console.assert(this._firstFailedStep);
 
+        if (!this._firstFailedStep.logs)
+            return this.queue.buildbot.buildPageURLForIteration(this);
+
         for (var i = 0; i < this._firstFailedStep.logs.length; ++i) {
             if (this._firstFailedStep.logs[i][0] == kind)
                 return this._firstFailedStep.logs[i][1];
@@ -194,13 +201,12 @@ BuildbotIteration.prototype = {
 
     _parseData: function(data)
     {
+        data = this._adjustBuildDataForBuildbot09(data)
         console.assert(!this.id || this.id === data.number);
         this.id = data.number;
 
         this.revision = {};
-        var revisionProperty = data.properties.findFirst(function(property) {
-            return property[0] === "got_revision";
-        });
+        var revisionProperty = data.properties.got_revision;
         var branches = this.queue.branches;
 
         for (var i = 0; i < branches.length; ++i) {
@@ -239,17 +245,20 @@ BuildbotIteration.prototype = {
         // The changes array is generally meaningful for svn triggered queues (such as builders),
         // but not for internally triggered ones (such as testers), due to coalescing.
         this.changes = [];
+        if (this.queue.buildbot.VERSION_LESS_THAN_09)
+            console.assert(data.sourceStamp || data.sourceStamps)
         if (data.sourceStamp)
             this.changes = sourceStampChanges(data.sourceStamp);
-        else for (var i = 0; i < data.sourceStamps.length; ++i)
-            this.changes = this.changes.concat(sourceStampChanges(data.sourceStamps[i]));
+        else if (data.sourceStamps)
+            for (var i = 0; i < data.sourceStamps.length; ++i)
+                this.changes = this.changes.concat(sourceStampChanges(data.sourceStamps[i]));
 
-        this.startTime = new Date(data.times[0] * 1000);
-        this.endTime = new Date(data.times[1] * 1000);
+        this.startTime = new Date(data.started_at * 1000);
+        this.endTime = new Date(data.complete_at * 1000);
 
         this.failedTestSteps = [];
         data.steps.forEach(function(step) {
-            if (!step.isFinished || step.hidden || !(step.name in BuildbotIteration.TestSteps))
+            if (!step.complete || step.hidden || !(step.name in BuildbotIteration.TestSteps))
                 return;
             var results = new BuildbotTestResults(step);
             if (step.name === "layout-test")
@@ -262,7 +271,16 @@ BuildbotIteration.prototype = {
         }, this);
 
         var masterShellCommandStep = data.steps.findFirst(function(step) { return step.name === "MasterShellCommand"; });
-        this.resultURLs = masterShellCommandStep ? masterShellCommandStep.urls : null;
+        if (masterShellCommandStep && masterShellCommandStep.urls) {
+            // Sample masterShellCommandStep.urls data:
+            // "urls": [
+            //     {
+            //         "name": "view results",
+            //         "url": "/results/Apple Sierra Release WK2 (Tests)/r220013 (3245)/results.html"
+            //     }
+            // ]
+            this.resultURLs = masterShellCommandStep.urls[0];
+        }
         for (var linkName in this.resultURLs) {
             var url = this.resultURLs[linkName];
             if (!url.startsWith("http"))
@@ -271,22 +289,20 @@ BuildbotIteration.prototype = {
 
         this.loaded = true;
 
-        this._firstFailedStep = data.steps.findFirst(function(step) { return !step.hidden && step.results[0] === BuildbotIteration.FAILURE; });
+        this._firstFailedStep = data.steps.findFirst(function(step) { return !step.hidden && step.results === BuildbotIteration.FAILURE; });
 
         console.assert(data.results === null || typeof data.results === "number");
         this._result = data.results;
 
-        this.text = data.text.join(" ");
-
-        if (!data.currentStep)
-            this.finished = true;
+        this.text = data.state_string;
+        this.finished = data.complete;
 
         this._productive = this._finished && this._result !== BuildbotIteration.EXCEPTION && this._result !== BuildbotIteration.RETRY;
         if (this._productive) {
             var finishedAnyProductiveStep = false;
             for (var i = 0; i < data.steps.length; ++i) {
                 var step = data.steps[i];
-                if (!step.isFinished)
+                if (!step.complete)
                     break;
                 if (step.name in BuildbotIteration.ProductiveSteps || step.name in BuildbotIteration.TestSteps) {
                     finishedAnyProductiveStep = true;
@@ -297,7 +313,60 @@ BuildbotIteration.prototype = {
         }
     },
 
-    _updateWithData: function(data)
+    // FIXME: Remove this method after https://bugs.webkit.org/show_bug.cgi?id=175056 is fixed.
+    _adjustBuildDataForBuildbot09: function(data)
+    {
+        if (!this.queue.buildbot.VERSION_LESS_THAN_09)
+            return data;
+
+        data.started_at = data.times[0];
+        data.complete_at = data.times[1];
+        delete data["times"];
+
+        let revisionProperty = data.properties.findFirst((property) => property[0] === "got_revision");
+
+        if (revisionProperty) {
+            // Removing first element from revision property to match with new data format.
+            // Old format: ["got_revision",{"Internal":"1357","WebKitOpenSource":"2468"},"Source"]
+            // New format: [{"Internal":"1357","WebKitOpenSource":"2468"},"Source"]
+            console.assert(revisionProperty[0] === "got_revision")
+            revisionProperty.splice(0, 1);
+        }
+        data.properties.got_revision = revisionProperty;
+
+        for (var i = 0; i < data.steps.length; i++) {
+            data.steps[i].complete = data.steps[i].isFinished;
+            delete data.steps[i]["isFinished"];
+            // Sample state_string: "Exiting early after 20 crashes and 30 timeouts. 31603 tests run. 147 failures 69 new passes".
+            data.steps[i].state_string = data.steps[i].results[1].join(' ');
+            data.steps[i].results = data.steps[i].results[0]; // See URL http://docs.buildbot.net/latest/developer/results.html
+        }
+
+        let masterShellCommandStep = data.steps.findFirst((step) => step.name === "MasterShellCommand");
+        if (masterShellCommandStep)
+            masterShellCommandStep.urls = [masterShellCommandStep.urls];
+
+        data.state_string = data.text.join(" ");
+        delete data["text"];
+
+        data.complete = !data.currentStep;
+        delete data["currentStep"];
+
+        return data;
+    },
+
+    _updateIfDataAvailable: function()
+    {
+        if (!this._steps || !this._buildData)
+            return;
+
+        this.isLoading = false;
+        this._buildData.steps = this._steps;
+
+        this._deprecatedUpdateWithData(this._buildData);
+    },
+
+    _deprecatedUpdateWithData: function(data)
     {
         if (this.loaded && this._finished)
             return;
@@ -310,6 +379,26 @@ BuildbotIteration.prototype = {
         this.dispatchEventToListeners(BuildbotIteration.Event.Updated);
     },
 
+
+    get buildURL()
+    {
+        return this.queue.baseURL + "/builds/" + this.id + "?property=got_revision";
+    },
+
+    get buildStepsURL()
+    {
+        return this.queue.baseURL + "/builds/" + this.id + "/steps";
+    },
+
+    urlFailedToLoad: function(data)
+    {
+        this.isLoading = false;
+        if (data.errorType === JSON.LoadError && data.errorHTTPCode === 401) {
+            this.queue.buildbot.isAuthenticated = false;
+            this.dispatchEventToListeners(BuildbotIteration.Event.UnauthorizedAccess);
+        }
+    },
+
     update: function()
     {
         if (this.loaded && this._finished)
@@ -322,22 +411,52 @@ BuildbotIteration.prototype = {
             return;
 
         this.isLoading = true;
+        if (this.queue.buildbot.VERSION_LESS_THAN_09)
+            this.deprecatedUpdate();
+        else
+            this.actualUpdate();
+    },
 
+    actualUpdate: function()
+    {
+        JSON.load(this.buildStepsURL, function(data) {
+            if (!(data.steps instanceof Array))
+                return;
+
+            this._steps = data.steps;
+            this._updateIfDataAvailable();
+        }.bind(this), this.urlFailedToLoad, {withCredentials: this.queue.buildbot.needsAuthentication});
+
+        JSON.load(this.buildURL, function(data) {
+            this.queue.buildbot.isAuthenticated = true;
+            if (!(data.builds instanceof Array))
+                return;
+
+            // Sample data for a single build:
+            // "builds": [
+            //     {
+            //         "builderid": 282,
+            //         "buildid": 5609,
+            //         "complete": true,
+            //         ...
+            //         "workerid": 188
+            //     }
+            // ]
+            this._buildData = data.builds[0];
+            this._updateIfDataAvailable();
+        }.bind(this), this.urlFailedToLoad, {withCredentials: this.queue.buildbot.needsAuthentication});
+    },
+
+    deprecatedUpdate: function()
+    {
         JSON.load(this.queue.baseURL + "/builds/" + this.id, function(data) {
             this.isLoading = false;
             this.queue.buildbot.isAuthenticated = true;
             if (!data || !data.properties)
                 return;
 
-            this._updateWithData(data);
-        }.bind(this),
-        function(data) {
-            this.isLoading = false;
-            if (data.errorType === JSON.LoadError && data.errorHTTPCode === 401) {
-                this.queue.buildbot.isAuthenticated = false;
-                this.dispatchEventToListeners(BuildbotIteration.Event.UnauthorizedAccess);
-            }
-        }.bind(this), {withCredentials: this.queue.buildbot.needsAuthentication});
+            this._deprecatedUpdateWithData(data);
+        }.bind(this), this.urlFailedToLoad, {withCredentials: this.queue.buildbot.needsAuthentication});
     },
 
     loadLayoutTestResults: function(callback)
index 43f8a3c..d97b872 100644 (file)
@@ -71,18 +71,34 @@ BuildbotQueue.prototype = {
 
     get baseURL()
     {
-        return this.buildbot.baseURL + "json/builders/" + encodeURIComponent(this.id);
+        if (this.buildbot.VERSION_LESS_THAN_09)
+            return this.buildbot.baseURL + "json/builders/" + encodeURIComponent(this.id);
+
+        return this.buildbot.baseURL + "api/v2/builders/" + encodeURIComponent(this.id);
     },
 
     get allIterationsURL()
     {
-        // Getting too many builds results in a timeout error, 10000 is OK.
-        return this.buildbot.baseURL + "json/builders/" + encodeURIComponent(this.id) + "/builds/_all/?max=10000";
+        if (this.buildbot.VERSION_LESS_THAN_09)
+            return this.baseURL + "/builds/_all/?max=10000";
+
+        return this.baseURL + "/builds?order=-number";
+    },
+
+    get buildsURL()
+    {
+        // We need to limit the number of builds for which we fetch the info, as it would
+        // impact performance. For each build, we will be subsequently making REST API calls
+        // to fetch detailed build info.
+        return this.baseURL + "/builds?order=-number&limit=20";
     },
 
     get overviewURL()
     {
-        return this.buildbot.baseURL + "builders/" + encodeURIComponent(this.id) + "?numbuilds=50";
+        if (this.buildbot.VERSION_LESS_THAN_09)
+            return this.buildbot.baseURL + "builders/" + encodeURIComponent(this.id) + "?numbuilds=50";
+
+        return this.buildbot.baseURL + "#/builders/" + encodeURIComponent(this.id) + "?numbuilds=50";
     },
 
     get recentFailedIterationCount()
@@ -192,30 +208,63 @@ BuildbotQueue.prototype = {
         }
     },
 
-    update: function()
+    get buildsInfoURL()
     {
-        this._load(this.baseURL, function(data) {
-            if (!(data.cachedBuilds instanceof Array))
-                return;
+        if (this.buildbot.VERSION_LESS_THAN_09)
+            return this.baseURL;
+
+        return this.buildsURL;
+    },
+
+    getBuilds: function(data)
+    {
+        if (this.buildbot.VERSION_LESS_THAN_09)
+            return data.cachedBuilds.reverse();
+
+        return data.builds;
+    },
 
+    isBuildComplete: function(data, index)
+    {
+        if (this.buildbot.VERSION_LESS_THAN_09) {
             var currentBuilds = {};
             if (data.currentBuilds instanceof Array)
                 data.currentBuilds.forEach(function(id) { currentBuilds[id] = true; });
 
-            var loadingStop = Math.max(0, data.cachedBuilds.length - BuildbotQueue.RecentIterationsToLoad);
+            return (!(data.cachedBuilds[index] in currentBuilds));
+        }
+
+        return data.builds[index].complete;
+    },
+
+    getIterationID: function(data, index)
+    {
+        if (this.buildbot.VERSION_LESS_THAN_09)
+            return data.cachedBuilds[index];
+
+        return data.builds[index].number;
+    },
+
+    update: function()
+    {
+        this._load(this.buildsInfoURL, function(data) {
+            var builds = this.getBuilds(data);
+            if (!(builds instanceof Array))
+                return;
 
             var newIterations = [];
 
-            for (var i = data.cachedBuilds.length - 1; i >= 0; --i) {
-                var iteration = this._knownIterations[data.cachedBuilds[i]];
+            for (var i = 0; i < builds.length; ++i) {
+                var iterationID = this.getIterationID(data, i);
+                var iteration = this._knownIterations[iterationID];
                 if (!iteration) {
-                    iteration = new BuildbotIteration(this, data.cachedBuilds[i], !(data.cachedBuilds[i] in currentBuilds));
+                    iteration = new BuildbotIteration(this, iterationID, this.isBuildComplete(data, i));
                     newIterations.push(iteration);
                     this.iterations.push(iteration);
                     this._knownIterations[iteration.id] = iteration;
                 }
 
-                if (i >= loadingStop && (!iteration.finished || !iteration.loaded)) {
+                if (i < BuildbotQueue.RecentIterationsToLoad && (!iteration.finished || !iteration.loaded)) {
                     if (!this._hasLoadedIterationForInOrderResult)
                         iteration.addEventListener(BuildbotIteration.Event.Updated, this._checkForInOrderResult.bind(this));
                     iteration.update();
index 21ba05d..f569e50 100644 (file)
@@ -56,7 +56,7 @@ BuildbotTestResults.prototype = {
         this.missingCount = 0;
         this.crashCount = 0;
 
-        if (!testStep.isFinished) {
+        if (!testStep.complete) {
             // The step never even ran, or hasn't finished running.
             this.finished = false;
             return;
@@ -64,13 +64,13 @@ BuildbotTestResults.prototype = {
 
         this.finished = true;
 
-        if (!testStep.results || testStep.results[0] === BuildbotIteration.SUCCESS || testStep.results[0] === BuildbotIteration.WARNINGS) {
+        if (!testStep.results || testStep.results === BuildbotIteration.SUCCESS || testStep.results === BuildbotIteration.WARNINGS) {
             // All tests passed.
             this.allPassed = true;
             return;
         }
 
-        if (/Exiting early/.test(testStep.results[1][0]))
+        if (/Exiting early/.test(testStep.state_string))
             this.tooManyFailures = true;
 
         function resultSummarizer(matchString, sum, outputLine)
@@ -89,14 +89,14 @@ BuildbotTestResults.prototype = {
             return sum + parseInt(match[1], 10);
         }
 
-        this.failureCount = testStep.results[1].reduce(resultSummarizer.bind(null, "fail"), undefined);
-        this.flakeyCount = testStep.results[1].reduce(resultSummarizer.bind(null, "flake"), undefined);
-        this.totalLeakCount = testStep.results[1].reduce(resultSummarizer.bind(null, "total leak"), undefined);
-        this.uniqueLeakCount = testStep.results[1].reduce(resultSummarizer.bind(null, "unique leak"), undefined);
-        this.newPassesCount = testStep.results[1].reduce(resultSummarizer.bind(null, "new pass"), undefined);
-        this.missingCount = testStep.results[1].reduce(resultSummarizer.bind(null, "missing"), undefined);
-        this.crashCount = testStep.results[1].reduce(resultSummarizer.bind(null, "crash"), undefined);
-        this.issueCount = testStep.results[1].reduce(resultSummarizer.bind(null, "issue"), undefined);
+        this.failureCount = resultSummarizer('fail', null, testStep.state_string);
+        this.flakeyCount = resultSummarizer("flake", null, testStep.state_string);
+        this.totalLeakCount = resultSummarizer("total leak", null, testStep.state_string);
+        this.uniqueLeakCount = resultSummarizer("unique leak", null, testStep.state_string);
+        this.newPassesCount = resultSummarizer("new pass", null, testStep.state_string);
+        this.missingCount = resultSummarizer("missing", null, testStep.state_string);
+        this.crashCount = resultSummarizer("crash", null, testStep.state_string);
+        this.issueCount = resultSummarizer("issue", null, testStep.state_string);
 
         if (!this.failureCount && !this.flakyCount && !this.totalLeakCount && !this.uniqueLeakCount && !this.newPassesCount && !this.missingCount) {
             // This step exited with a non-zero exit status, but we didn't find any output about the number of failed tests.
index 6411bbe..e152377 100644 (file)
@@ -89,7 +89,7 @@ WebKitBuildbot = function()
         }}
     };
 
-    Buildbot.call(this, "https://build.webkit.org/", queueInfo);
+    Buildbot.call(this, "https://build.webkit.org/", queueInfo, {"USE_BUILDBOT_VERSION_LESS_THAN_09" : true});
 };
 
 BaseObject.addConstructorFunctions(WebKitBuildbot);
index 762c0e8..59c7e9e 100644 (file)
@@ -1,3 +1,53 @@
+2017-08-01  Aakash Jain  <aakash_jain@apple.com>
+
+        Update Bot Watcher's Dashboard for Buildbot 0.9
+        https://bugs.webkit.org/show_bug.cgi?id=174777
+
+        Reviewed by Daniel Bates.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/Buildbot.js:
+        (Buildbot): Check if USE_BUILDBOT_VERSION_LESS_THAN_09 is passed.
+        (Buildbot.prototype._computeBuilderNameToIDMap): Fetch the builder name to ID mapping from buidbot and store
+        in a dictionary.
+        (Buildbot.prototype.buildPageURLForIteration): Updated URL as per Buildbot 0.9 format. Buildbot 0.9 currently does not support
+        builder name in the build url. See <https://github.com/buildbot/buildbot/issues/3465>.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
+        (isMultiCodebaseGotRevisionProperty): Adapting to new data format.
+        (parseRevisionProperty): Ditto.
+        (BuildbotIteration.prototype.failureLogURL): Return the URL to build page if precise failure url is not available. For
+        Buildbot 0.9, build page URL would be appropriate in most cases as per the new UI.
+        (BuildbotIteration.prototype._parseData): Parsing the data as per new data format. Many variable names and data types
+        have changed in Buildbot 0.9.
+        (BuildbotIteration.prototype._adjustBuildDataForBuildbot09): Adjust the Buildbot 0.8 data to new format.
+        (BuildbotIteration.prototype._updateIfDataAvailable): Update method for Buildbot 0.9 data. We are performing two API calls, 
+        one for build information, another for step information of that build. We need to wait until data from both REST API calls are available.
+        (BuildbotIteration.prototype._deprecatedUpdateWithData): Renamed from _updateWithData, used for Buildbot 0.8 data.
+        (BuildbotIteration.prototype.get buildURL): URL to fetch build information from Buildbot. Also fetches got_revision property.
+        (BuildbotIteration.prototype.get buildStepsURL): URL to fetch the steps information from Buildbot.
+        (BuildbotIteration.prototype.urlFailedToLoad): Callback method to be used when URL fails to load. Made it a separate function now.
+        (BuildbotIteration.prototype.update): Modified to support both Buildbot 0.9 and 0.8 data format.
+        (BuildbotIteration.prototype.actualUpdate): Update method for Buildbot 0.9 data.
+        (BuildbotIteration.prototype.deprecatedUpdate): Update method for Buildbot 0.8 data.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueue.js:
+        (BuildbotQueue.prototype.get baseURL): Updated URL as per Buildbot 0.9 format.
+        (BuildbotQueue.prototype.get allIterationsURL): Ditto.
+        (BuildbotQueue.prototype.get overviewURL): Ditto.
+        (BuildbotQueue.prototype.get buildsURL): URL to fetch builds data in Buildbot 0.9.
+        (BuildbotQueue.prototype.get buildsInfoURL): Returns the appropriate URL to use to fetch builds information from
+        Buildbot 0.8 or 0.9.
+        (BuildbotQueue.prototype.getBuilds): Method compatible with both Buildbot 0.8 and 0.9 to get build information from data
+        fetched from Buildbot. Also, reversing the Buildbot 0.8 data to make it similar to 0.9 data format.
+        (BuildbotQueue.prototype.isBuildComplete): Method compatible with both Buildbot 0.8 and 0.9 to check if the build has completed.
+        (BuildbotQueue.prototype.getIterationID):  Method compatible with both Buildbot 0.8 and 0.9 to get the Iteration ID.
+        (BuildbotQueue.prototype.update): Supports both Buildbot 0.8 and 0.9. Buildbot 0.9 REST API doesn't have cachedBuilds and currentBuilds. 
+        Therefore we are fetching information for fixed number of build. 
+        Also iterating the loop incrementally since the build data is already reverse sorted.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotTestResults.js:
+        (BuildbotTestResults.prototype._parseResults): Updated as per Buildbot 0.9 format. Note that we do not
+        need to worry about 0.8 or 0.9 data format here, since the data is already converted to 0.9 format.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/WebKitBuildbot.js:
+        (WebKitBuildbot): Pass the USE_BUILDBOT_VERSION_LESS_THAN_09 flag.
+
 2017-08-01  Devin Rousso  <drousso@apple.com>
 
         Web Inspector: simplify WebInspector with WI