[SCM] PostGIS branch master updated. 3.7.0beta1-16-g1ba934e1f

git at osgeo.org git at osgeo.org
Fri Jul 24 03:35:36 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  1ba934e1f8a48188d39f88757379885e4ee3ebc5 (commit)
       via  1b5c8e6a8e4f7d73f7f149d18b03356bc00792fe (commit)
      from  dcae3e42e53bec92c265846f8656997afed5b35e (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 1ba934e1f8a48188d39f88757379885e4ee3ebc5
Merge: dcae3e42e 1b5c8e6a8
Author: Darafei Praliaskouski <komzpa at gmail.com>
Date:   Fri Jul 24 03:35:34 2026 -0700

    Merge pull request 'ci: use newest Woodpecker pipeline in status' (!500) from Komzpa/postgis:ci/woodie-current-order-20260724 into master
    
    Reviewed-on: https://gitea.osgeo.org/postgis/postgis/pulls/500


commit 1b5c8e6a8e4f7d73f7f149d18b03356bc00792fe
Author: Darafei Praliaskouski <me at komzpa.net>
Date:   Fri Jul 24 14:29:54 2026 +0400

    ci: use newest Woodpecker pipeline in status

diff --git a/utils/ci-status.py b/utils/ci-status.py
index 66fb9ac2f..c06c99da8 100755
--- a/utils/ci-status.py
+++ b/utils/ci-status.py
@@ -382,6 +382,15 @@ def woodpecker_matches_branch(build, check, branch):
     return build.get("ref") in (None, expected_ref)
 
 
+def woodpecker_build_sort_key(build):
+    return (
+        build.get("created") or build.get("created_at") or 0,
+        build.get("started") or build.get("started_at") or 0,
+        build.get("finished") or build.get("finished_at") or 0,
+        build.get("number") or 0,
+    )
+
+
 def woodpecker_workflow_label(workflow, duplicate_names):
     name = workflow.get("name") or f"workflow {workflow.get('pid') or workflow.get('id')}"
     pid = workflow.get("pid")
@@ -396,6 +405,13 @@ def woodpecker_workflow_url(web_url, pipeline, workflow):
     return f"{web_url}/pipeline/{pipeline['number']}/{workflow['pid']}"
 
 
+def woodpecker_pipeline_url(web_url, pipeline):
+    run_url = pipeline.get("link") or pipeline.get("url")
+    if not run_url and web_url and pipeline.get("number"):
+        run_url = f"{web_url}/pipeline/{pipeline['number']}"
+    return run_url
+
+
 def woodpecker_pipeline_detail_url(api_url, pipeline):
     if not pipeline.get("number"):
         return None
@@ -464,12 +480,14 @@ def woodpecker_check(check, branch, timeout):
     if not builds:
         return make_result(check, branch, UNKNOWN, message="no Woodpecker builds found", debug_url=url)
 
+    builds = sorted(builds, key=woodpecker_build_sort_key, reverse=True)
     current = builds[0]
-    previous = next((build for build in builds[1:] if normalize_woodpecker_status(build.get("status")) not in (IN_PROGRESS, UNKNOWN)), None)
+    previous = next(
+        (build for build in builds[1:] if normalize_woodpecker_status(build.get("status")) not in (IN_PROGRESS, UNKNOWN)),
+        None,
+    )
     web_url = check.get("web_url")
-    run_url = current.get("link") or current.get("url")
-    if not run_url and web_url and current.get("number"):
-        run_url = f"{web_url}/pipeline/{current['number']}"
+    run_url = woodpecker_pipeline_url(web_url, current)
     detail_url = woodpecker_pipeline_detail_url(api_url, current)
     if detail_url and "workflows" not in current:
         try:
@@ -493,6 +511,9 @@ def woodpecker_check(check, branch, timeout):
         message=message,
     )
     if previous:
+        previous_url = woodpecker_pipeline_url(web_url, previous)
+        if previous_url and not (previous.get("link") or previous.get("url")):
+            previous = {**previous, "url": previous_url}
         result.update(previous_fields(normalize_woodpecker_status(previous.get("status")), previous))
     return result
 
diff --git a/utils/test_ci_status.py b/utils/test_ci_status.py
index c775daa84..e27147347 100644
--- a/utils/test_ci_status.py
+++ b/utils/test_ci_status.py
@@ -300,6 +300,49 @@ class RequiredFailureHtmlTest(unittest.TestCase):
         self.assertEqual("running: regress", result["message"])
         self.assertEqual("https://woodie.example.test/repos/30/pipeline/5434/2", result["url"])
 
+    def test_woodpecker_uses_newest_pipeline_when_api_order_is_unstable(self):
+        check_config = {
+            "name": "Woodpecker",
+            "provider": "woodpecker",
+            "required": True,
+            "api_url": "https://woodie.example.test/api/repos/30/pipelines",
+            "web_url": "https://woodie.example.test/repos/30",
+        }
+        branch = {"name": "stable-3.4", "label": "3.4"}
+        older_failed = {
+            "number": 5415,
+            "event": "push",
+            "branch": "stable-3.4",
+            "ref": "refs/heads/stable-3.4",
+            "status": "failure",
+            "commit": "5" * 40,
+            "created": 1784787793,
+            "started": 1784787796,
+            "finished": 1784794269,
+            "message": "older failed pipeline",
+        }
+        newer_success = {
+            "number": 5425,
+            "event": "push",
+            "branch": "stable-3.4",
+            "ref": "refs/heads/stable-3.4",
+            "status": "success",
+            "commit": "5" * 40,
+            "created": 1784806066,
+            "started": 1784806067,
+            "finished": 1784812852,
+            "message": "newer successful pipeline",
+        }
+
+        with mock.patch.object(CI_STATUS, "http_json", side_effect=([older_failed, newer_success], newer_success)):
+            result = CI_STATUS.woodpecker_check(check_config, branch, timeout=5)
+
+        self.assertEqual(CI_STATUS.SUCCESS, result["status"])
+        self.assertEqual("https://woodie.example.test/repos/30/pipeline/5425", result["url"])
+        self.assertEqual("newer successful pipeline", result["message"])
+        self.assertEqual(CI_STATUS.FAILURE, result["previous_completed_status"])
+        self.assertEqual("https://woodie.example.test/repos/30/pipeline/5415", result["previous_completed_url"])
+
     def test_stale_summary_distinguishes_passed_and_failed(self):
         branch = {
             "name": "stable-synthetic",

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

Summary of changes:
 utils/ci-status.py      | 29 +++++++++++++++++++++++++----
 utils/test_ci_status.py | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list