Title: [163314] trunk/Tools
Revision
163314
Author
[email protected]
Date
2014-02-03 10:37:11 -0800 (Mon, 03 Feb 2014)

Log Message

WebKit Bot Watcher's Dashboard: Defer subsequent resource loads from access-restricted build bot when
iteration fails to load with HTTP 401 status code
https://bugs.webkit.org/show_bug.cgi?id=128077

Reviewed by Alexey Proskuryakov.

Similar to the fix for <https://bugs.webkit.org/show_bug.cgi?id=127849>, we should only prompt for
the HTTP credentials of a build bot so long as an earlier authentication request wasn't cancelled
(i.e. failed with an HTTP 401 Unauthorized status code). Currently an authentication dialog will be
presented for an iteration each time the update queue timer fires until a person successfully
authenticates. Instead we should update the authentication status of the build bot on receiving an
HTTP 401 response code such that we defer subsequent requests to load any resource from the access-
restricted build bot when the queue update timer fires.

A person must explicitly click the "unauthorized" status line shown for the queue associated with the
iteration in the dashboard and authenticate successfully for the iteration to be loaded once an
authentication request for an iteration is cancelled.

* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
(BuildbotIteration.prototype.update): Early return if the associated Buildbot was given invalid credentials.
Also notify the associated Buildbot and update the queue view when a load failed with an HTTP 401 status code.
(BuildbotIteration.prototype.loadLayoutTestResults): Ditto.
* BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
(BuildbotQueueView): Modified to call BuildbotQueueView.prototype._unauthorizedAccess instead of
QueueView.prototype._updateSoon when event BuildbotQueue.Event.UnauthorizedAccess is received.
(BuildbotQueueView.prototype._unauthorizedAccess): Added.

Modified Paths

Diff

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js (163313 => 163314)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js	2014-02-03 18:08:59 UTC (rev 163313)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js	2014-02-03 18:37:11 UTC (rev 163314)
@@ -59,7 +59,8 @@
 BuildbotIteration.RETRY = 5;
 
 BuildbotIteration.Event = {
-    Updated: "updated"
+    Updated: "updated",
+    UnauthorizedAccess: "unauthorized-access"
 };
 
 // See <http://docs.buildbot.net/0.8.8/manual/cfg-properties.html>.
@@ -157,6 +158,9 @@
         if (this.loaded && this._finished)
             return;
 
+        if (this.queue.buildbot.needsAuthentication && this.queue.buildbot.authenticationStatus === Buildbot.AuthenticationStatus.InvalidCredentials)
+            return;
+
         function collectTestResults(data, stepName)
         {
             var testStep = data.steps.findFirst(function(step) { return step.name === stepName; });
@@ -211,6 +215,7 @@
         }
 
         JSON.load(this.queue.baseURL + "/builds/" + this.id, function(data) {
+            this.queue.buildbot.isAuthenticated = true;
             if (!data || !data.properties)
                 return;
 
@@ -271,11 +276,20 @@
             this.queue.sortIterations();
 
             this.dispatchEventToListeners(BuildbotIteration.Event.Updated);
-        }.bind(this), null, {withCredentials: this.queue.buildbot.needsAuthentication});
+        }.bind(this),
+        function(data) {
+            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});
     },
 
     loadLayoutTestResults: function(callback)
     {
+        if (this.queue.buildbot.needsAuthentication && this.queue.buildbot.authenticationStatus === Buildbot.AuthenticationStatus.InvalidCredentials)
+            return;
+
         function collectResults(subtree, predicate)
         {
             // Results object is a trie:
@@ -339,6 +353,7 @@
         }
 
         JSON.load(this.queue.buildbot.layoutTestFullResultsURLForIteration(this), function(data) {
+            this.queue.buildbot.isAuthenticated = true;
             this.hasPrettyPatch = data.has_pretty_patch;
 
             this.layoutTestResults.regressions = collectResults(data.tests, function(info) { return info["report"] === "REGRESSION" });
@@ -353,8 +368,12 @@
             callback();
         }.bind(this),
         function(data) {
+            if (data.errorType === JSON.LoadError && data.errorHTTPCode === 401) {
+                this.queue.buildbot.isAuthenticated = false;
+                this.dispatchEventToListeners(BuildbotIteration.Event.UnauthorizedAccess);
+            }
             console.log(data.error);
             callback();
-        }, {jsonpCallbackName: "ADD_RESULTS", withCredentials: this.queue.buildbot.needsAuthentication});
+        }.bind(this), {jsonpCallbackName: "ADD_RESULTS", withCredentials: this.queue.buildbot.needsAuthentication});
     }
 };

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js (163313 => 163314)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js	2014-02-03 18:08:59 UTC (rev 163313)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js	2014-02-03 18:37:11 UTC (rev 163314)
@@ -36,7 +36,7 @@
         else
             this.platform = queue.platform;
         queue.addEventListener(BuildbotQueue.Event.IterationsAdded, this._queueIterationsAdded, this);
-        queue.addEventListener(BuildbotQueue.Event.UnauthorizedAccess, this.updateSoon, this);
+        queue.addEventListener(BuildbotQueue.Event.UnauthorizedAccess, this._unauthorizedAccess, this);
     }.bind(this));
 
     this.debugQueues.forEach(function(queue) {
@@ -45,7 +45,7 @@
         else
             this.platform = queue.platform;
         queue.addEventListener(BuildbotQueue.Event.IterationsAdded, this._queueIterationsAdded, this);
-        queue.addEventListener(BuildbotQueue.Event.UnauthorizedAccess, this.updateSoon, this);
+        queue.addEventListener(BuildbotQueue.Event.UnauthorizedAccess, this._unauthorizedAccess, this);
     }.bind(this));
 
     webkitTrac.addEventListener(Trac.Event.NewCommitsRecorded, this._newCommitsRecorded, this);
@@ -298,6 +298,7 @@
 
         event.data.addedIterations.forEach(function(iteration) {
             iteration.addEventListener(BuildbotIteration.Event.Updated, this._iterationUpdated, this);
+            iteration.addEventListener(BuildbotIteration.Event.UnauthorizedAccess, this._unauthorizedAccess, this);
         }.bind(this));
     },
 
@@ -309,5 +310,10 @@
     _newCommitsRecorded: function(event)
     {
         this.updateSoon();
+    },
+
+    _unauthorizedAccess: function(event)
+    {
+        this.updateSoon();
     }
 };

Modified: trunk/Tools/ChangeLog (163313 => 163314)


--- trunk/Tools/ChangeLog	2014-02-03 18:08:59 UTC (rev 163313)
+++ trunk/Tools/ChangeLog	2014-02-03 18:37:11 UTC (rev 163314)
@@ -1,5 +1,34 @@
 2014-02-03  Daniel Bates  <[email protected]>
 
+        WebKit Bot Watcher's Dashboard: Defer subsequent resource loads from access-restricted build bot when
+        iteration fails to load with HTTP 401 status code
+        https://bugs.webkit.org/show_bug.cgi?id=128077
+
+        Reviewed by Alexey Proskuryakov.
+
+        Similar to the fix for <https://bugs.webkit.org/show_bug.cgi?id=127849>, we should only prompt for
+        the HTTP credentials of a build bot so long as an earlier authentication request wasn't cancelled
+        (i.e. failed with an HTTP 401 Unauthorized status code). Currently an authentication dialog will be
+        presented for an iteration each time the update queue timer fires until a person successfully
+        authenticates. Instead we should update the authentication status of the build bot on receiving an
+        HTTP 401 response code such that we defer subsequent requests to load any resource from the access-
+        restricted build bot when the queue update timer fires.
+
+        A person must explicitly click the "unauthorized" status line shown for the queue associated with the
+        iteration in the dashboard and authenticate successfully for the iteration to be loaded once an
+        authentication request for an iteration is cancelled.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotIteration.js:
+        (BuildbotIteration.prototype.update): Early return if the associated Buildbot was given invalid credentials.
+        Also notify the associated Buildbot and update the queue view when a load failed with an HTTP 401 status code.
+        (BuildbotIteration.prototype.loadLayoutTestResults): Ditto.
+        * BuildSlaveSupport/build.webkit.org-config/public_html/dashboard/Scripts/BuildbotQueueView.js:
+        (BuildbotQueueView): Modified to call BuildbotQueueView.prototype._unauthorizedAccess instead of
+        QueueView.prototype._updateSoon when event BuildbotQueue.Event.UnauthorizedAccess is received.
+        (BuildbotQueueView.prototype._unauthorizedAccess): Added.
+
+2014-02-03  Daniel Bates  <[email protected]>
+
         WebKit Bot Watcher's Dashboard: Teach JSON.load() to interpret third argument as either an
         option dictionary or a failure callback
         https://bugs.webkit.org/show_bug.cgi?id=128080
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to