get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/135070/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 135070,
    "url": "http://patches.dpdk.org/api/patches/135070/?format=api",
    "web_url": "http://patches.dpdk.org/project/ci/patch/20231212160813.371433-1-aconole@redhat.com/",
    "project": {
        "id": 5,
        "url": "http://patches.dpdk.org/api/projects/5/?format=api",
        "name": "CI",
        "link_name": "ci",
        "list_id": "ci.dpdk.org",
        "list_email": "ci@dpdk.org",
        "web_url": "",
        "scm_url": "git://dpdk.org/tools/dpdk-ci",
        "webscm_url": "https://git.dpdk.org/tools/dpdk-ci/",
        "list_archive_url": "https://inbox.dpdk.org/ci",
        "list_archive_url_format": "https://inbox.dpdk.org/ci/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231212160813.371433-1-aconole@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/ci/20231212160813.371433-1-aconole@redhat.com",
    "date": "2023-12-12T16:08:13",
    "name": "cirrus: add an initial polling mechanism",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "93016b21730365540955ea3af1cc687ac1da4b68",
    "submitter": {
        "id": 332,
        "url": "http://patches.dpdk.org/api/people/332/?format=api",
        "name": "Aaron Conole",
        "email": "aconole@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/ci/patch/20231212160813.371433-1-aconole@redhat.com/mbox/",
    "series": [
        {
            "id": 30526,
            "url": "http://patches.dpdk.org/api/series/30526/?format=api",
            "web_url": "http://patches.dpdk.org/project/ci/list/?series=30526",
            "date": "2023-12-12T16:08:13",
            "name": "cirrus: add an initial polling mechanism",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/30526/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/135070/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/135070/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<ci-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 4EE11436D3;\n\tTue, 12 Dec 2023 17:08:21 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 34C5F42E4F;\n\tTue, 12 Dec 2023 17:08:21 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by mails.dpdk.org (Postfix) with ESMTP id 4652A42E4E\n for <ci@dpdk.org>; Tue, 12 Dec 2023 17:08:20 +0100 (CET)",
            "from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com\n [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-411-bIaSnnGNM6qv-nDZnOIBaw-1; Tue, 12 Dec 2023 11:08:14 -0500",
            "from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com\n [10.11.54.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6F3AD101A555;\n Tue, 12 Dec 2023 16:08:14 +0000 (UTC)",
            "from RHTPC1VM0NT.redhat.com (unknown [10.22.32.214])\n by smtp.corp.redhat.com (Postfix) with ESMTP id 2DE1B2026D66;\n Tue, 12 Dec 2023 16:08:14 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1702397299;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=MreR94Yv2xValQoE1JaRmwzV1Iee9eAPAWE9sT5hhCc=;\n b=Mo1WdRyuAxtDqr0gbhvYuQWzbS2iln0F4nf0xuGggt3puxcvYtWLDGYWdPs3xFs+DxK4iP\n DV/cDxbwbOOj0oJ8VArrTOOyXX3zOJrr+5ilZ/XYgwqgtoC1Csv5U+y5qLfyW2o4ujI1nS\n 0YVpPAlo2XaYVi9m50/DIqOoEGQIGhc=",
        "X-MC-Unique": "bIaSnnGNM6qv-nDZnOIBaw-1",
        "From": "Aaron Conole <aconole@redhat.com>",
        "To": "ci@dpdk.org",
        "Cc": "Eelco Chaudron <echaudro@redhat.com>, Ilya Maximets <i.maximets@ovn.org>,\n Dumitru Ceara <dceara@redhat.com>, Michael Santana <msantana@redhat.com>",
        "Subject": "[PATCH] cirrus: add an initial polling mechanism",
        "Date": "Tue, 12 Dec 2023 11:08:13 -0500",
        "Message-ID": "<20231212160813.371433-1-aconole@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.4",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-BeenThere": "ci@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK CI discussions <ci.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/ci>,\n <mailto:ci-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/ci/>",
        "List-Post": "<mailto:ci@dpdk.org>",
        "List-Help": "<mailto:ci-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/ci>,\n <mailto:ci-request@dpdk.org?subject=subscribe>",
        "Errors-To": "ci-bounces@dpdk.org"
    },
    "content": "Cirrus-CI is used to provide a testing environment for FreeBSD, among\nothers.  As of now, the ci monitoring framework doesn't support checking\nfor cirrus-ci status, but that can be changed.  We add an initial polling\nsimilar to the original GitHub Actions or Travis-CI polling mechanisms\nthat merely provides pass/fail/warn with a URL.  This can be improved\nlater to provide logs on a per-task (similar to GHA Jobs) basis.\n\nSigned-off-by: Aaron Conole <aconole@redhat.com>\n---\n ci_mon           |   6 ++-\n cirrus_mon       | 100 +++++++++++++++++++++++++++++++++++++++++++++++\n series_db_lib.sh |  13 +++++-\n 3 files changed, 116 insertions(+), 3 deletions(-)\n create mode 100755 cirrus_mon",
    "diff": "diff --git a/ci_mon b/ci_mon\nindex 2e30da4..4b35d38 100755\n--- a/ci_mon\n+++ b/ci_mon\n@@ -140,13 +140,16 @@ if [ \"X\" = \"X$pw_instance\" ]; then\n    exit 1\n fi\n \n-for I in travis github obs dummy; do\n+for I in travis github obs cirrus dummy; do\n \n     token=${I}_token\n     disable=disable_${I}\n \n     if [ \"X${!disable}\" = \"Xyes\" ]; then\n+        echo \"Skiping ${I}\"\n         continue\n+    else\n+        echo \"Scanning ${I}\"\n     fi\n \n     ./${I}_mon $pw_instance ${!token} \"$pw_project\" | grep \"^pw|\" | while IFS=\"|\" \\\n@@ -163,6 +166,7 @@ for I in travis github obs dummy; do\n \n         patch_id=\"$(get_patch_id_by_series_id_and_sha \"$series_id\" \"$shasum\" \"$pw_chk_instance\")\"\n         if [ \"X$patch_id\" == \"X\" ]; then\n+            echo \"No patchid...\"\n             patch_id=$(echo $PATCHDATA | jq -rc '.patches[-1].id')\n         fi\n         PATCHDATA=\"$(echo \"$PATCHDATA\" | jq \".patches[] | select(.id==$patch_id)\")\"\ndiff --git a/cirrus_mon b/cirrus_mon\nnew file mode 100755\nindex 0000000..f307961\n--- /dev/null\n+++ b/cirrus_mon\n@@ -0,0 +1,100 @@\n+#!/bin/bash\n+# SPDX-Identifier: gpl-2.0-or-later\n+# Copyright (C) 2023, Red Hat, Inc.\n+#\n+# Monitors cirrus build history for builds in a series.\n+# Records the builds in the series database (and emits them on the\n+# stdout line for processing)\n+#\n+# Licensed under the terms of the GNU General Public License as published\n+# by the Free Software Foundation; either version 2 of the License, or\n+# (at your option) any later version.  You may obtain a copy of the\n+# license at\n+#\n+#    https://www.gnu.org/licenses/old-licenses/gpl-2.0.html\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n+# License for the specific language governing permissions and limitations\n+# under the License.\n+\n+[ -f \"$(dirname $0)/series_db_lib.sh\" ] && source \"$(dirname $0)/series_db_lib.sh\"\n+\n+while [ \"$1\" != \"\" ]; do\n+    if echo \"$1\" | grep -q -s -E ^--pw-instance= ; then\n+        pw_instance=$(echo \"$1\" | sed s/^--pw-instance=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--cirrus-token= ; then\n+        cirrus_token=$(echo \"$1\" | sed s/^--cirrus-token=//)\n+        shift\n+    elif echo \"$1\" | grep -q -s -E ^--help ; then\n+        echo \"Cirrus CI monitor script\"\n+        echo \"$0: args\"\n+        echo \"Required if not set in ~/.pwmon-rc file:\"\n+        echo \"  --pw-instance=<inst url>\tURL for pw\"\n+        echo \"\"\n+        echo \"Options:\"\n+        echo \"  --cirrus-token=<token>\t\tSets tokenfor web requests\"\n+        echo \"\"\n+        exit 0\n+    elif ! echo \"$1\" | grep -q -s -E ^-- ; then\n+        break\n+    fi\n+done\n+\n+echo \"scanning started \" >> /tmp/cirrus.log\n+\n+if [ \"X\" = \"X$pw_instance\" ]; then\n+    pw_instance=\"$1\"\n+    shift\n+fi\n+\n+if [ \"X\" = \"X$github_token\" ]; then\n+    github_token=\"$1\"\n+    shift\n+fi\n+\n+if [ \"X\" = \"X$pw_project\" -a \"X$1\" != \"X\" ]; then\n+    pw_project=\"$1\"\n+    shift\n+fi\n+\n+if [ \"X$cirrus_token\" != \"X\" ]; then\n+    AUTH=\"-H \\\"Authorization: Bearer $cirrus_token\\\"\"\n+fi\n+\n+ci_instance=\"cirrus_sync\"\n+\n+get_unsynced_series \"$pw_instance\" \"$ci_instance\" | \\\n+    while IFS=\"|\" read -r series_id patch_id patch_url patch_name sha patchwork_instance patchwork_project repo_name gap_sync obs_sync cirrus_sync; do\n+        repo_owner=$(echo \"$repo_name\" | cut -d/ -f1)\n+        repo_real=$(echo \"$repo_name\" | cut -d/ -f2)\n+\n+        graph_string=\"{ \\\"query\\\": \\\"query BuildBySHAQuery(\\$owner: String!, \\$name: String!, \\$SHA: String){ searchBuilds(repositoryOwner: \\$owner, repositoryName: \\$name, SHA: \\$SHA) { id, status } }\\\", \\\"variables\\\": { \\\"owner\\\": \\\"$repo_owner\\\", \\\"name\\\": \\\"$repo_real\\\", \\\"SHA\\\": \\\"$sha\\\" } }\"\n+        build_details=$(curl -s \"$AUTH\" -X POST --data \"$graph_string\" https://api.cirrus-ci.com/graphql)\n+\n+        id=$(echo \"$build_details\" | jq -rc '.data.searchBuilds[-1].id')\n+        status=$(echo \"$build_details\" | jq '.data.searchBuilds[-1].status')\n+        build_url=\"https://cirrus-ci.com/build/$id\"\n+\n+        result=\"in-progress\"\n+        if [ \"$status\" == \"\\\"COMPLETED\\\"\" ]; then\n+            result=\"passed\"\n+        elif [ \"$status\" == \"\\\"FAILED\\\"\" ]; then\n+            result=\"failed\"\n+        elif [ \"$status\" == \"\\\"ABORTED\\\"\" ]; then\n+            set_synced_patch \"$patch_id\" \"$patchwork_instance\" \"$ci_instance\"\n+            echo \"CIRRUS patch_id=$patch_id belonging to series=$series_id on $patchwork_instance was aborted\" 1>$2\n+            continue\n+        elif [ \"$status\" == \"\\\"ERRORED\\\"\" ]; then\n+            result=\"warn\"\n+        fi\n+\n+        if [ \"$result\" == \"in-progress\" ]; then\n+            echo \"CIRRUS patch_id=$patch_id belonging to series=$series_id is not completed[$status]. Skipping\" 1>&2\n+            continue\n+        fi\n+\n+        echo \"pw|$pw_instance|build|$series_id|SHA|$sha|$result|$build_url|$patch_name|$repo_name|$test_name\"\n+done\ndiff --git a/series_db_lib.sh b/series_db_lib.sh\nindex c5f42e0..e415870 100644\n--- a/series_db_lib.sh\n+++ b/series_db_lib.sh\n@@ -130,6 +130,15 @@ recheck_sync INTEGER\n EOF\n         run_db_command \"INSERT INTO series_schema_version(id) values (8);\"\n     fi\n+\n+    # 0009 - cirrus CI data\n+    run_db_command \"select * from series_schema_version;\" | egrep '^9$' >/dev/null 2>&1\n+    if [ $? -eq 1 ]; then\n+        sqlite3 ${HOME}/.series-db <<EOF\n+ALTER TABLE git_builds ADD COLUMN cirrus_sync INTEGER;\n+EOF\n+        run_db_command \"INSERT INTO series_schema_version(id) values (9);\"\n+    fi\n }\n \n function series_db_exists() {\n@@ -379,7 +388,7 @@ function set_synced_for_series() {\n \n     series_db_exists\n \n-    echo \"update git_builds set gap_sync=1, obs_sync=1 where patchwork_instance=\\\"$instance\\\" and series_id=$series_id;\" | series_db_execute\n+    echo \"update git_builds set gap_sync=1, cirrus_sync=1, obs_sync=1 where patchwork_instance=\\\"$instance\\\" and series_id=$series_id;\" | series_db_execute\n }\n \n function set_unsynced_for_series() {\n@@ -402,7 +411,7 @@ function insert_commit() {\n \n     series_db_exists\n \n-    echo \"INSERT INTO git_builds (series_id, patch_id, patch_url, patch_name, sha, patchwork_instance, patchwork_project, repo_name, gap_sync, obs_sync) VALUES($series_id, $patch_id, \\\"$patch_url\\\", \\\"$patch_name\\\", \\\"$sha\\\", \\\"$instance\\\", \\\"$project\\\", \\\"$repo_name\\\", 0, 0);\" | series_db_execute\n+    echo \"INSERT INTO git_builds (series_id, patch_id, patch_url, patch_name, sha, patchwork_instance, patchwork_project, repo_name, gap_sync, obs_sync, cirrus_sync) VALUES($series_id, $patch_id, \\\"$patch_url\\\", \\\"$patch_name\\\", \\\"$sha\\\", \\\"$instance\\\", \\\"$project\\\", \\\"$repo_name\\\", 0, 0, 0);\" | series_db_execute\n }\n \n function get_patch_id_by_series_id_and_sha() {\n",
    "prefixes": []
}