[SCM] PostGIS branch master updated. 3.7.0beta1-14-gdcae3e42e

git at osgeo.org git at osgeo.org
Thu Jul 23 12:59:48 PDT 2026


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  dcae3e42e53bec92c265846f8656997afed5b35e (commit)
       via  38d228b76268fcc1ce35faf1c4581a6e0efde7ca (commit)
      from  435127bbbbb1196881abeb3a4a74fb704a636144 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dcae3e42e53bec92c265846f8656997afed5b35e
Merge: 435127bbb 38d228b76
Author: Darafei Praliaskouski <komzpa at gmail.com>
Date:   Thu Jul 23 12:59:46 2026 -0700

    Merge pull request 'ci: prefer current Jenkins queue entries' (!497) from Komzpa/postgis:ci/jenkins-current-queue-status-20260723 into master
    
    Reviewed-on: https://gitea.osgeo.org/postgis/postgis/pulls/497


commit 38d228b76268fcc1ce35faf1c4581a6e0efde7ca
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Thu Jul 23 21:10:44 2026 +0400

    ci: prefer current Jenkins queue entries

diff --git a/utils/ci-status.py b/utils/ci-status.py
index 8ba4cf87c..66fb9ac2f 100755
--- a/utils/ci-status.py
+++ b/utils/ci-status.py
@@ -764,6 +764,31 @@ def jenkins_queue_item_matches(item, job_url, check, branch):
     return any(value == expected for name, value in params.items() if name == branch_parameter or name.lower() == branch_parameter.lower())
 
 
+def queued_jenkins_revision(item):
+    params = jenkins_parameters(item)
+    for name in ("after", "BRANCH", "commit", "GIT_COMMIT"):
+        value = params.get(name)
+        if value and len(value) == 40 and all(ch in "0123456789abcdefABCDEF" for ch in value):
+            return value
+    return None
+
+
+def jenkins_queue_item_rank(item, branch):
+    revision = queued_jenkins_revision(item)
+    is_current = False
+    if revision:
+        for ref in branch_compare_refs(branch):
+            distance = git_commit_distance(revision, ref)
+            if distance == 0:
+                is_current = True
+                break
+    return (
+        0 if is_current else 1,
+        -(item.get("inQueueSince") or 0),
+        item.get("id") or 0,
+    )
+
+
 def jenkins_queued_check(check, branch, job_url, timeout):
     if not check.get("branch_parameter"):
         return None
@@ -776,7 +801,7 @@ def jenkins_queued_check(check, branch, job_url, timeout):
         return None
     if not queued:
         return None
-    item = sorted(queued, key=lambda value: value.get("inQueueSince") or 0)[0]
+    item = sorted(queued, key=lambda value: jenkins_queue_item_rank(value, branch))[0]
     params = jenkins_parameters(item)
     message = f"queued item {item.get('id')}"
     if item.get("why"):
diff --git a/utils/test_ci_status.py b/utils/test_ci_status.py
index efdac188c..c775daa84 100644
--- a/utils/test_ci_status.py
+++ b/utils/test_ci_status.py
@@ -172,6 +172,61 @@ class RequiredFailureHtmlTest(unittest.TestCase):
         self.assertEqual("build 7808", result["message"])
         self.assertEqual("https://ci.example.test/job/PostGIS_Make_Dist/7808/", result["url"])
 
+    def test_jenkins_queue_prefers_current_branch_revision(self):
+        check_config = {
+            "name": "Jenkins / Berrie",
+            "provider": "jenkins",
+            "required": True,
+            "job_url": "https://ci.example.test/job/PostGIS_Worker_Run/label=berrie/",
+            "branch_parameter": "reference",
+        }
+        branch = {
+            "name": "master",
+            "label": "master",
+        }
+        old_revision = "7" * 40
+        current_revision = "4" * 40
+        queued = [
+            {
+                "id": 108699,
+                "task": {"url": "https://ci.example.test/job/PostGIS_Worker_Run/"},
+                "why": "Build #8,030 is already in progress",
+                "inQueueSince": 1784820000000,
+                "actions": [{"parameters": [
+                    {"name": "reference", "value": "refs/heads/master"},
+                    {"name": "after", "value": old_revision},
+                ]}],
+            },
+            {
+                "id": 108746,
+                "task": {"url": "https://ci.example.test/job/PostGIS_Worker_Run/"},
+                "why": "Build #8,030 is already in progress",
+                "inQueueSince": 1784821000000,
+                "actions": [{"parameters": [
+                    {"name": "reference", "value": "refs/heads/master"},
+                    {"name": "after", "value": current_revision},
+                ]}],
+            },
+        ]
+
+        def fake_distance(revision, ref):
+            return 0 if revision == current_revision else 26
+
+        with (
+            mock.patch.object(CI_STATUS, "jenkins_queue_items", return_value=queued),
+            mock.patch.object(CI_STATUS, "git_commit_distance", side_effect=fake_distance),
+        ):
+            result = CI_STATUS.jenkins_queued_check(
+                check_config,
+                branch,
+                "https://ci.example.test/job/PostGIS_Worker_Run/label=berrie/",
+                timeout=5,
+            )
+
+        self.assertEqual(CI_STATUS.IN_PROGRESS, result["status"])
+        self.assertEqual(current_revision, result["revision"])
+        self.assertEqual("queued item 108746: Build #8,030 is already in progress", result["message"])
+
     def test_woodpecker_failure_names_single_failed_workflow(self):
         check_config = {
             "name": "Woodpecker",

-----------------------------------------------------------------------

Summary of changes:
 utils/ci-status.py      | 27 +++++++++++++++++++++++-
 utils/test_ci_status.py | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list