Title: [293167] trunk/Tools
Revision
293167
Author
jbed...@apple.com
Date
2022-04-21 06:20:21 -0700 (Thu, 21 Apr 2022)

Log Message

[build.webkit.org] Support identifiers on dashboard
https://bugs.webkit.org/show_bug.cgi?id=239473
<rdar://problem/76852365>

Reviewed by Aakash Jain.

* Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Buildbot.js:
(Buildbot.prototype.layoutTestResultsDirectoryURLForIteration): Remove leading r.
* Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/BuildbotIteration.js:
(BuildbotIteration.prototype.get buildURL): Request identifier.
* Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Dashboard.js: OpenSource should be considered a git checkout.
* Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Initialization.js: Add Commit interface.
* Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Main.js: Kick off periodic commits.webkit.org refresh.
* Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/QueueView.js:
(QueueView.prototype._appendPendingRevisionCount): Use commit.webkit.org interface instead of trac.
(QueueView.prototype._formatRevisionForDisplay): Don't truncate identifiers.
* Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/index.html: Import Commits.js.
* Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/MockCommits.js:
(MockCommits): Add mock commits.webkit.org interface.
* Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/tests.js:
(setup): Add commits.webkit.org interface.
(this.view._latestProductiveIteration):
* Tools/CISupport/build-webkit-org/public_html/dashboard/index.html:

Canonical link: https://commits.webkit.org/249849@main

Modified Paths

Added Paths

Diff

Modified: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Buildbot.js (293166 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Buildbot.js	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Buildbot.js	2022-04-21 13:20:21 UTC (rev 293167)
@@ -181,12 +181,12 @@
 
     layoutTestResultsDirectoryURLForIteration: function(iteration)
     {
-        var underscoreSeparatedRevisions = "r";
+        var underscoreSeparatedCommits = "";
         sortDictionariesByOrder(Dashboard.Repository).forEach(function(repository) {
             if (iteration.revision[repository.name]) {
-                if (underscoreSeparatedRevisions.length > 1)
-                    underscoreSeparatedRevisions += "_";
-                underscoreSeparatedRevisions += iteration.revision[repository.name];
+                if (underscoreSeparatedCommits.length > 1)
+                    underscoreSeparatedCommits += "_";
+                underscoreSeparatedCommits += iteration.revision[repository.name];
             }
         });
         var url = "" + "results/";
@@ -193,7 +193,7 @@
         if (this.baseURLForResults) {
             url = ""
         }
-        return url + encodeURIComponent(iteration.queue.id) + "/" + encodeURIComponent(underscoreSeparatedRevisions + " (" + iteration.id + ")");
+        return url + encodeURIComponent(iteration.queue.id) + "/" + encodeURIComponent(underscoreSeparatedCommits + " (" + iteration.id + ")");
     },
 
     layoutTestResultsURLForIteration: function(iteration)

Modified: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/BuildbotIteration.js (293166 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/BuildbotIteration.js	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/BuildbotIteration.js	2022-04-21 13:20:21 UTC (rev 293167)
@@ -196,7 +196,6 @@
         this.id = data.number;
 
         this.revision = {};
-        var revisionProperty = data.properties.got_revision;
         var branches = this.queue.branches;
 
         for (var i = 0; i < branches.length; ++i) {
@@ -213,8 +212,10 @@
                 fallbackKey = null;
             }
 
-            var revision = parseRevisionProperty(revisionProperty, key, fallbackKey);
-            this.revision[repositoryName] = revision;
+            if (repository.isSVN || !data.properties.identifier || !fallbackKey)
+                this.revision[repositoryName] = parseRevisionProperty(data.properties.got_revision, key, fallbackKey);
+            else
+                this.revision[repositoryName] = parseRevisionProperty(data.properties.identifier, key, fallbackKey);
         }
 
         function sourceStampChanges(sourceStamp) {
@@ -335,7 +336,7 @@
 
     get buildURL()
     {
-        return this.queue.baseURL + "/builds/" + this.id + "?property=got_revision";
+        return this.queue.baseURL + "/builds/" + this.id + "?property=got_revision&property=identifier";
     },
 
     get buildStepsURL()

Copied: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Commits.js (from rev 293163, trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Initialization.js) (0 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Commits.js	                        (rev 0)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Commits.js	2022-04-21 13:20:21 UTC (rev 293167)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+Commits = function(url)
+{
+    BaseObject.call(this);
+
+    console.assert(url);
+    this.url = ""
+    this.heads = {'main': null};
+};
+
+BaseObject.addConstructorFunctions(Commits);
+
+Commits.UpdateInterval = 45000; // 45 seconds
+
+Commits.prototype = {
+    constructor: Commits,
+    __proto__: BaseObject.prototype,
+
+    _update: function() {
+        var self = this
+        Object.entries(self.heads).forEach(function(branch){
+            JSON.load(self.url + '/' + branch[0] + '/json', function(data) {
+                self.heads[branch[0]] = data;
+            });
+        });
+    },
+    startPeriodicUpdates: function() {
+        this._update()
+        this.updateTimer = setInterval(this._update.bind(this), Commits.UpdateInterval);
+    },
+    branchPosition: function(identifier) {
+        var split = identifier.split(/\.|@/);
+        if (split.length === 2)
+            return parseFloat(split[0]);
+        if (split.length === 3)
+            return parseFloat(split[1]);
+        return null
+    },
+};

Modified: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Dashboard.js (293166 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Dashboard.js	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Dashboard.js	2022-04-21 13:20:21 UTC (rev 293167)
@@ -48,7 +48,7 @@
     },
     Branch: {},
     Repository: {
-        OpenSource: { name: "openSource", isSVN: true, order: 0 },
+        OpenSource: { name: "openSource", isGit: true, order: 0 },
     },
     get sortedPlatforms()
     {

Modified: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Initialization.js (293166 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Initialization.js	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Initialization.js	2022-04-21 13:20:21 UTC (rev 293167)
@@ -25,6 +25,7 @@
 
 var settings = new Settings;
 var buildbots = [ new WebKitBuildbot ];
+Dashboard.Repository.OpenSource.commits = new Commits("https://commits.webkit.org/");
 Dashboard.Repository.OpenSource.trac = new Trac("https://trac.webkit.org/");
 if (typeof Bugzilla !== "undefined")
     var bugzilla = new Bugzilla;

Modified: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Main.js (293166 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Main.js	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Main.js	2022-04-21 13:20:21 UTC (rev 293167)
@@ -334,6 +334,9 @@
     var trac = sortedRepositories[i].trac;
     if (typeof trac !== "undefined")
         trac.startPeriodicUpdates();
+    var commits = sortedRepositories[i].commits;
+    if (typeof commits !== "undefined")
+        commits.startPeriodicUpdates();
 }
 
 document.addEventListener("DOMContentLoaded", documentReady);

Modified: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/QueueView.js (293166 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/QueueView.js	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/QueueView.js	2022-04-21 13:20:21 UTC (rev 293167)
@@ -118,20 +118,22 @@
         var branches = queue.branches;
         for (var i = 0; i < branches.length; ++i) {
             var branch = branches[i];
+            if (branch.name === 'trunk')
+                branch.name = 'main';
             var repository = branch.repository;
             var repositoryName = repository.name;
-            var trac = repository.trac;
-            var latestProductiveRevisionNumber = latestProductiveIteration.revision[repositoryName];
-            if (!latestProductiveRevisionNumber)
+            var commits = repository.commits;
+            var latestProductiveIdentifier = latestProductiveIteration.revision[repositoryName];
+            if (!latestProductiveIdentifier)
                 continue;
-            if (!trac)
+            if (!commits)
                 continue;
-            if (!trac.latestRecordedRevisionNumber || trac.indexOfRevision(trac.oldestRecordedRevisionNumber) > trac.indexOfRevision(latestProductiveRevisionNumber)) {
-                trac.loadMoreHistoricalData();
-                return;
+            var head = commits.heads[branch.name];
+            if (!head) {
+                commits.heads[branch.name] = null;
+                continue;
             }
-
-            totalRevisionsBehind += trac.commitsOnBranchLaterThanRevision(branch.name, latestProductiveRevisionNumber).length;
+            totalRevisionsBehind = commits.branchPosition(commits.heads[branch.name].identifier) - commits.branchPosition(latestProductiveIdentifier);
         }
 
         if (!totalRevisionsBehind)
@@ -138,7 +140,7 @@
             return;
 
         var messageElement = document.createElement("span"); // We can't just pass text to StatusLineView here, because we need an element that perfectly fits the text for popover positioning.
-        messageElement.textContent = totalRevisionsBehind + " " + (totalRevisionsBehind === 1 ? "revision behind" : "revisions behind");
+        messageElement.textContent = totalRevisionsBehind + " " + (totalRevisionsBehind === 1 ? "commit behind" : "commits behind");
         var status = new StatusLineView(messageElement, StatusLineView.Status.NoBubble);
         this.element.appendChild(status.element);
 
@@ -225,6 +227,8 @@
         console.assert(repository.isSVN || repository.isGit, "Should not get here; " + repository.name + " did not specify a known VCS type.");
         if (repository.isSVN)
             return "r" + revision;
+        if (revision.includes('@'))
+            return revision;
         // Truncating for display. Git traditionally uses seven characters for a short hash.
         return revision.substr(0, 7);
     },

Modified: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/index.html (293166 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/index.html	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/index.html	2022-04-21 13:20:21 UTC (rev 293167)
@@ -67,6 +67,7 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
     <script src=""
 
 </head>

Copied: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/MockCommits.js (from rev 293163, trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Initialization.js) (0 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/MockCommits.js	                        (rev 0)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/MockCommits.js	2022-04-21 13:20:21 UTC (rev 293167)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2022 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+MockCommits = function(url)
+{
+    BaseObject.call(this);
+    this.heads = {'main': {'identifier': '33022@main'}};
+};
+
+BaseObject.addConstructorFunctions(MockCommits);
+
+MockCommits.UpdateInterval = 45000; // 45 seconds
+
+MockCommits.prototype = {
+    constructor: MockCommits,
+    __proto__: BaseObject.prototype,
+
+    _update: function() {},
+    startPeriodicUpdates: function() {},
+    branchPosition: function(identifier) {
+        var split = identifier.split(/\.|@/);
+        if (split.length === 2)
+            return parseFloat(split[0]);
+        if (split.length === 3)
+            return parseFloat(split[1]);
+        return null
+    },
+};

Modified: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/tests.js (293166 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/tests.js	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/tests.js	2022-04-21 13:20:21 UTC (rev 293167)
@@ -41,6 +41,7 @@
 module("Trac", {
     setup: function() {
         this.trac = new MockTrac();
+        this.commits = new MockCommits();
         this.tracWithIdentifier = new MockTrac("webkit");
     }
 });
@@ -160,6 +161,7 @@
 module("BuildBotQueueView", {
     setup: function() {
         this.trac = new MockTrac();
+        this.commits = new MockCommits();
         this.trac.recordedCommits = MockTrac.EXAMPLE_TRAC_COMMITS;
         this.trac.recordedCommitIndicesByRevisionNumber = MockTrac.recordedCommitIndicesByRevisionNumber;
         this.queue = new MockBuildbotQueue();
@@ -168,6 +170,7 @@
             repository: {
                 name: "openSource",
                 trac: this.trac,
+                commits: this.commits,
                 isSVN: true,
             }
         };
@@ -176,7 +179,7 @@
         this.view._latestProductiveIteration = function(queue)
         {
             var iteration = {
-                revision: { "openSource": "33021" },
+                revision: { "openSource": "33021@main" },
             };
             return iteration;
         }
@@ -187,8 +190,8 @@
 test("_appendPendingRevisionCount", function()
 {
     this.view._appendPendingRevisionCount(this.queue, this.view._latestProductiveIteration);
-    var revisionsBehind = this.view.element.getElementsByClassName("message")[0].innerHTML.match(/.*(\d+) revision(|s) behind/)[1];
-    strictEqual(revisionsBehind, "1", "assert revisions behind");
+    var revisionsBehind = this.view.element.getElementsByClassName("message")[0].innerHTML.match(/.*(\d+) commit(|s) behind/)[1];
+    strictEqual(revisionsBehind, "1", "assert commits behind");
 });
 
 test("_popoverLinesForCommitRange", function()
@@ -213,6 +216,7 @@
         repository: {
             name: "openSource",
             trac: this.trac,
+            commits: this.commits,
             isSVN: true,
         }
     };
@@ -230,6 +234,7 @@
     var popover = new Dashboard.Popover();
     var context = {
         trac: this.trac,
+        commits: this.commits,
         branch: this.trunkBranch,
         firstRevision: "33018",
         lastRevision: "33020"
@@ -245,6 +250,7 @@
     var popover = new Dashboard.Popover();
     var context = {
         trac: this.trac,
+        commits: this.commits,
         branch: this.trunkBranch,
         firstRevision: "33020",
         lastRevision: "33018"
@@ -387,6 +393,7 @@
 module("BuildBotQueue", {
     setup: function() {
         Dashboard.Repository.OpenSource.trac = new MockTrac();
+        Dashboard.Repository.OpenSource.commits = new MockCommits();
         Dashboard.Repository.OpenSource.trac.recordedCommits = MockTrac.EXAMPLE_TRAC_COMMITS;
         Dashboard.Repository.OpenSource.trac.recordedCommitIndicesByRevisionNumber = MockTrac.recordedCommitIndicesByRevisionNumber;
         this.queue = new MockBuildbotQueue();

Modified: trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/index.html (293166 => 293167)


--- trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/index.html	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/CISupport/build-webkit-org/public_html/dashboard/index.html	2022-04-21 13:20:21 UTC (rev 293167)
@@ -38,6 +38,7 @@
     <script src=""
     <script src=""
     <script src=""
+    <script src=""
     <script src=""
     <script src=""
     <script src=""

Modified: trunk/Tools/ChangeLog (293166 => 293167)


--- trunk/Tools/ChangeLog	2022-04-21 12:14:17 UTC (rev 293166)
+++ trunk/Tools/ChangeLog	2022-04-21 13:20:21 UTC (rev 293167)
@@ -1,3 +1,29 @@
+2022-04-20  Jonathan Bedard  <jbed...@apple.com>
+
+        [build.webkit.org] Support identifiers on dashboard
+        https://bugs.webkit.org/show_bug.cgi?id=239473
+        <rdar://problem/76852365>
+
+        Reviewed by Aakash Jain.
+
+        * CISupport/build-webkit-org/public_html/dashboard/Scripts/Buildbot.js:
+        (Buildbot.prototype.layoutTestResultsDirectoryURLForIteration): Remove leading r.
+        * CISupport/build-webkit-org/public_html/dashboard/Scripts/BuildbotIteration.js:
+        (BuildbotIteration.prototype.get buildURL): Request identifier.
+        * CISupport/build-webkit-org/public_html/dashboard/Scripts/Dashboard.js: OpenSource should be considered a git checkout.
+        * CISupport/build-webkit-org/public_html/dashboard/Scripts/Initialization.js: Add Commit interface.
+        * CISupport/build-webkit-org/public_html/dashboard/Scripts/Main.js: Kick off periodic commits.webkit.org refresh.
+        * CISupport/build-webkit-org/public_html/dashboard/Scripts/QueueView.js:
+        (QueueView.prototype._appendPendingRevisionCount): Use commit.webkit.org interface instead of trac.
+        (QueueView.prototype._formatRevisionForDisplay): Don't truncate identifiers.
+        * CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/index.html: Import Commits.js.
+        * CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/MockCommits.js:
+        (MockCommits): Add mock commits.webkit.org interface.
+        * CISupport/build-webkit-org/public_html/dashboard/Scripts/tests/resources/tests.js:
+        (setup): Add commits.webkit.org interface.
+        (this.view._latestProductiveIteration):
+        * CISupport/build-webkit-org/public_html/dashboard/index.html:
+
 2022-04-21  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][WPE] Make make-dist script python3 only
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to