Linux Media Controller development
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Matthieu Baerts <matttbe@kernel.org>
Cc: Derek Barbosa <debarbos@redhat.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Konstantin Ryabitsev <konstantin@linuxfoundation.org>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Steven Rostedt <rostedt@goodmis.org>,
	users@kernel.org,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: Linking Patchwork with Sashiko?
Date: Thu, 4 Jun 2026 08:52:01 +0200	[thread overview]
Message-ID: <20260604085201.177ad537@foz.lan> (raw)
In-Reply-To: <b9f7ca3a-fa72-4a8e-94bd-9991a0882f10@kernel.org>

On Wed, 3 Jun 2026 09:50:06 +1000
Matthieu Baerts <matttbe@kernel.org> wrote:

> Hi Mauro, Derek, Roman,
> 
> On 03/06/2026 06:39, Mauro Carvalho Chehab wrote:
> > On Tue, 02 Jun 2026 20:13:15 +0000
> > Roman Gushchin <roman.gushchin@linux.dev> wrote:  
> >> Derek Barbosa <debarbos@redhat.com> writes:  
> >>> On Sat, May 30, 2026 at 08:53:51PM +0200, Mauro Carvalho Chehab wrote:    
> 
> (...)
> 
> >>> - pw_tools is a workaround solution to get/set status on patchwork via bot-mail
> >>>   parsing. pw tokens also have broad permission scope.
> >>>
> >>> which that leaves us with two "methods" of integration:
> >>>
> >>> 1. The Sashiko daemon calls the pw_tools script directly to update the status.
> >>> 2. Sashiko sends a single-per-patch-email with parseable "status" to a mailing
> >>> list, where some running daemon will pickup the mail.    
> >>
> >> This feels a bit hacky.  
> > 
> > The alternative that would be acceptable, at least on media, is if 
> > one would add support on patchwork to have a separate permission just
> > for checks update.  
> 
> Indeed. It looks like there is an old feature request about that:
> 
>   https://github.com/getpatchwork/patchwork/issues/14
> 
> Linked to Mauro's email from Dec 2015 :)

If it is OK to have a global CI permission, I think this patch
would do the trick (currently untested):

diff --git a/patchwork/api/check.py b/patchwork/api/check.py
index 74bbc19e0078..79326a96a5bb 100644
--- a/patchwork/api/check.py
+++ b/patchwork/api/check.py
@@ -108,9 +108,23 @@ class CheckListCreate(CheckMixin, ListCreateAPIView):
     lookup_url_kwarg = 'patch_id'
     ordering = 'id'
 
+    def is_editable(self, user):
+        if not user.is_authenticated:
+            return False
+
+        # Only users with add_check permission can do it.
+        # Notice that this is a global permission: it allows
+        # adding checks to any project inside Patchwork.
+        if user.has_perm('patchwork.add_check'):
+            patch._edited_by = user
+            return True
+
+        # Being maintainer doesn't grant rights to create checks.
+        return False
+
     def create(self, request, patch_id, *args, **kwargs):
         p = get_object_or_404(Patch, id=patch_id)
-        if not p.is_editable(request.user):
+        if not self.is_editable(request.user):
             raise PermissionDenied()
         request.patch = p
         return super(CheckListCreate, self).create(request, *args, **kwargs)

The idea here is to use Patchwork Django's admin screen, at
Users section, setting:

	"patchwork | check | Can add check"

Created by Django's default_permissions[1] for class Check(models.Model)
(at patchwork/models.py).

[1] https://docs.djangoproject.com/en/6.0/topics/auth/default/#default-permissions

The only issue is that the permission would be granted patchwork-wide. 
I suspect that this is probably ok for Kernel.org.

On media, we have a VDR project with is not a kernel tree and has
separate maintainers, but we don't use CI there. So, it can work
for us as well.

I'm not a django expert, but perhaps there's a way to create also
a set of per-project permissions to allow to either set this globally
or per project.

Thanks,
Mauro

  parent reply	other threads:[~2026-06-04  6:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260528144627.1ae09ff2@foz.lan>
     [not found] ` <1372F826-5513-4EB2-AE27-1DC0D2DE0AEB@linux.dev>
     [not found]   ` <20260529083100.6710b6cd@foz.lan>
     [not found]     ` <20260529083801.2c7e8990@foz.lan>
     [not found]       ` <ahmwUk0uXTkdwohf@debarbos-thinkpadt14gen5.rmtusma.csb>
2026-05-30  8:30         ` Linking Patchwork with Sashiko? Mauro Carvalho Chehab
2026-05-30 15:57           ` Roman Gushchin
2026-05-30 18:00             ` Mauro Carvalho Chehab
2026-05-30 18:49               ` Mauro Carvalho Chehab
2026-05-30 18:53                 ` Mauro Carvalho Chehab
2026-06-02 15:51                   ` Derek Barbosa
2026-06-02 16:51                     ` Mauro Carvalho Chehab
2026-06-02 18:39                       ` Jason Gunthorpe
2026-06-02 20:29                         ` Mauro Carvalho Chehab
2026-06-02 20:13                     ` Roman Gushchin
2026-06-02 20:39                       ` Mauro Carvalho Chehab
2026-06-02 20:44                         ` Roman Gushchin
2026-06-02 23:50                         ` Matthieu Baerts
2026-06-03  3:35                           ` Mauro Carvalho Chehab
2026-06-03  3:49                             ` Roman Gushchin
2026-06-04  6:52                           ` Mauro Carvalho Chehab [this message]
2026-06-07 17:56                             ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260604085201.177ad537@foz.lan \
    --to=mchehab+huawei@kernel.org \
    --cc=debarbos@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=konstantin@linuxfoundation.org \
    --cc=linux-media@vger.kernel.org \
    --cc=matttbe@kernel.org \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=users@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox