get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 138002,
    "url": "https://patches.dpdk.org/api/patches/138002/?format=api",
    "web_url": "https://patches.dpdk.org/project/ci/patch/20240305215624.2517037-1-aconole@redhat.com/",
    "project": {
        "id": 5,
        "url": "https://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": "<20240305215624.2517037-1-aconole@redhat.com>",
    "list_archive_url": "https://inbox.dpdk.org/ci/20240305215624.2517037-1-aconole@redhat.com",
    "date": "2024-03-05T21:56:24",
    "name": "[v2] cirrus: Add an initial polling mechanism",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "3d62ef729c05b7e18e43aab5b1100e288b6f1287",
    "submitter": {
        "id": 332,
        "url": "https://patches.dpdk.org/api/people/332/?format=api",
        "name": "Aaron Conole",
        "email": "aconole@redhat.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/ci/patch/20240305215624.2517037-1-aconole@redhat.com/mbox/",
    "series": [
        {
            "id": 31386,
            "url": "https://patches.dpdk.org/api/series/31386/?format=api",
            "web_url": "https://patches.dpdk.org/project/ci/list/?series=31386",
            "date": "2024-03-05T21:56:24",
            "name": "[v2] cirrus: Add an initial polling mechanism",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/31386/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/138002/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/138002/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 7B6C243C46;\n\tTue,  5 Mar 2024 22:56:30 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 715D0402AC;\n\tTue,  5 Mar 2024 22:56:30 +0100 (CET)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by mails.dpdk.org (Postfix) with ESMTP id D59BE40270\n for <ci@dpdk.org>; Tue,  5 Mar 2024 22:56:28 +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-232-7Icb3f6gN2iFr2DG-N8P2Q-1; Tue, 05 Mar 2024 16:56:25 -0500",
            "from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com\n [10.11.54.3])\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 D018A85A58C;\n Tue,  5 Mar 2024 21:56:24 +0000 (UTC)",
            "from RHTPC1VM0NT.bos.redhat.com (dhcp-17-72.bos.redhat.com\n [10.18.17.72])\n by smtp.corp.redhat.com (Postfix) with ESMTP id AD4CF112131D;\n Tue,  5 Mar 2024 21:56:24 +0000 (UTC)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1709675788;\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=+CBv4oWuYIXbjP5VifBw+cafdZNxSrFpy0CDcVLfdN0=;\n b=REkwtc8RHYFwr2AJfXl1Lv/IGRU75qFk6WWinqP3nKzJn7q32IzPhTyswUMgkQfEb2QHAO\n R8SszcfyYzLBBCrn24tDpf2+8ktLQFJ4h6a8UE8qZbfkzmYtDP/ygALgsmOc+A5WRU6shC\n QPAnmYxomI68M8I4E+SKjMH2BRN+8a4=",
        "X-MC-Unique": "7Icb3f6gN2iFr2DG-N8P2Q-1",
        "From": "Aaron Conole <aconole@redhat.com>",
        "To": "ci@dpdk.org",
        "Cc": "Michael Santana <msantana@redhat.com>, Ilya Maximets <i.maximets@ovn.org>,\n Patrick Robb <probb@iol.unh.edu>",
        "Subject": "[PATCH v2] cirrus: Add an initial polling mechanism",
        "Date": "Tue,  5 Mar 2024 16:56:24 -0500",
        "Message-ID": "<20240305215624.2517037-1-aconole@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.11.54.3",
        "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---\nv1->v2:\n  Addressed comments from Ilya and Michael\n  Added a User Agent to the curl command\n  Tested with a few different patches\n  Rebased on top of latest tree\n\n ci_mon           |   5 ++-\n cirrus_mon       | 103 +++++++++++++++++++++++++++++++++++++++++++++++\n series_db_lib.sh |  13 +++++-\n 3 files changed, 118 insertions(+), 3 deletions(-)\n create mode 100755 cirrus_mon",
    "diff": "diff --git a/ci_mon b/ci_mon\nindex 94ec1a3..81c80c3 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=\"|\" \\\ndiff --git a/cirrus_mon b/cirrus_mon\nnew file mode 100755\nindex 0000000..0c60f67\n--- /dev/null\n+++ b/cirrus_mon\n@@ -0,0 +1,103 @@\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>        URL for pw\"\n+        echo \"\"\n+        echo \"Options:\"\n+        echo \"  --cirrus-token=<token>          Sets token for web requests\"\n+        echo \"\"\n+        echo \"Script invocation form (used by ci_mon):\"\n+        echo \"$0 <pw_instance> <cirrus_token> <pw_project>\"\n+        echo \"\"\n+        echo \"  NOTE: For the script invocation from, pw_project is currently\"\n+        echo \"        ignored\"\n+        exit 0\n+    elif ! echo \"$1\" | grep -q -s -E ^-- ; then\n+        break\n+    fi\n+done\n+\n+if [ \"X\" = \"X$pw_instance\" -a \"X$1\" != \"X\" ]; then\n+    pw_instance=\"$1\"\n+    shift\n+fi\n+\n+if [ \"X\" = \"X$cirrus_token\" -a \"X$1\" != \"X\" ]; then\n+    cirrus_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 -A \"(pw-ci) cirrus_mon\" $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 0635469..4741d14 100644\n--- a/series_db_lib.sh\n+++ b/series_db_lib.sh\n@@ -141,6 +141,15 @@ check_url STRING\n EOF\n         run_db_command \"INSERT INTO series_schema_version(id) values (9);\"\n     fi\n+\n+    # 0010 - cirrus CI data\n+    run_db_command \"select * from series_schema_version;\" | egrep '^10$' >/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 (10);\"\n+    fi\n }\n \n function series_db_exists() {\n@@ -390,7 +399,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, obs_sync=1, cirrus_sync=1 where patchwork_instance=\\\"$instance\\\" and series_id=$series_id;\" | series_db_execute\n }\n \n function set_unsynced_for_series() {\n@@ -413,7 +422,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": [
        "v2"
    ]
}