how to use a regex in gerrit config file?

441 views
Skip to first unread message

William

unread,
Sep 13, 2022, 11:03:13 PM9/13/22
to Repo and Gerrit Discussion
Hi

I am trying to see if I do a regex for wlan_2150 ,wlan_2151,wlan_2152,wlan_2153 below like wlan_21* but it doesn't seem to work, is there a way to add a regx in config file?


[label "OK2Build"]

       function = MaxWithBlock  

      copyMinScore = true

       value = -1 Change not approved to merge

       value =  0 No Score

       value = +1 Change approved to merge

       branch = refs/heads/wlan_2150

       branch = refs/heads/wlan_2151

       branch = refs/heads/wlan_2152

       branch = refs/heads/wlan_2153

Sven Selberg

unread,
Sep 14, 2022, 4:05:26 AM9/14/22
to Repo and Gerrit Discussion
On Wednesday, September 14, 2022 at 5:03:13 AM UTC+2 William wrote:
Hi

I am trying to see if I do a regex for wlan_2150 ,wlan_2151,wlan_2152,wlan_2153 below like wlan_21* but it doesn't seem to work, is there a way to add a regx in config file?

In the documentation for label.LABEL.branch it seems like the field only supports wildcard so "refs/heads/wlan_21*" should work but I'm guessing it is the same as for most ref-fields in the documentation:

    If field starts_with '^':                # ^refs/heads/wlan_21.*
        handle_as_regexp(field)
    else-if field ends_with '*':         # refs/heads/wlan_21*
        handle_as_wildcard(field)
    else                                             # refs/heads/wlan_2150
        handle_as_exact(field)

Sven Selberg

unread,
Sep 14, 2022, 4:08:59 AM9/14/22
to Repo and Gerrit Discussion
On Wednesday, September 14, 2022 at 10:05:26 AM UTC+2 Sven Selberg wrote:
On Wednesday, September 14, 2022 at 5:03:13 AM UTC+2 William wrote:
Hi

I am trying to see if I do a regex for wlan_2150 ,wlan_2151,wlan_2152,wlan_2153 below like wlan_21* but it doesn't seem to work, is there a way to add a regx in config file?

In the documentation for label.LABEL.branch it seems like the field only supports wildcard so "refs/heads/wlan_21*" should work but I'm guessing it is the same as for most ref-fields in the documentation:

    If field starts_with '^':                # ^refs/heads/wlan_21.*
        handle_as_regexp(field)
    else-if field ends_with '*':         # refs/heads/wlan_21* 
        handle_as_wildcard(field)

Should be handle_as_namespace not handle_as_wildcard. 

Edwin Kempin

unread,
Sep 14, 2022, 4:09:35 AM9/14/22
to Sven Selberg, Repo and Gerrit Discussion
On Wed, Sep 14, 2022 at 10:05 AM Sven Selberg <sven.s...@axis.com> wrote:


On Wednesday, September 14, 2022 at 5:03:13 AM UTC+2 William wrote:
Hi

I am trying to see if I do a regex for wlan_2150 ,wlan_2151,wlan_2152,wlan_2153 below like wlan_21* but it doesn't seem to work, is there a way to add a regx in config file?

In the documentation for label.LABEL.branch it seems like the field only supports wildcard so "refs/heads/wlan_21*" should work but I'm guessing it is the same as for most ref-fields in the documentation:

    If field starts_with '^':                # ^refs/heads/wlan_21.*
        handle_as_regexp(field)
    else-if field ends_with '*':         # refs/heads/wlan_21*
        handle_as_wildcard(field)
    else                                             # refs/heads/wlan_2150
        handle_as_exact(field)


Normally we support 3 cases:
1. exact refs (e.g. 'refs/heads/master') 
2. ref patterns (e.g. 'refs/heads/*', here '*' can only be used as the last path segment, i.e. the pattern must end with '/*', '*' in other places is not taken into account)
3. reg exps (e.g. '^refs/heads/.*', must start with '^')

 


[label "OK2Build"]

       function = MaxWithBlock  

      copyMinScore = true

       value = -1 Change not approved to merge

       value =  0 No Score

       value = +1 Change approved to merge

       branch = refs/heads/wlan_2150

       branch = refs/heads/wlan_2151

       branch = refs/heads/wlan_2152

       branch = refs/heads/wlan_2153

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/3089366e-b019-4d99-b39d-d3e97d25fc0fn%40googlegroups.com.

William

unread,
Sep 20, 2022, 5:09:51 PM9/20/22
to Repo and Gerrit Discussion
On Wednesday, September 14, 2022 at 1:09:35 AM UTC-7 eke...@google.com wrote:
On Wed, Sep 14, 2022 at 10:05 AM Sven Selberg <sven.s...@axis.com> wrote:


On Wednesday, September 14, 2022 at 5:03:13 AM UTC+2 William wrote:
Hi

I am trying to see if I do a regex for wlan_2150 ,wlan_2151,wlan_2152,wlan_2153 below like wlan_21* but it doesn't seem to work, is there a way to add a regx in config file?

In the documentation for label.LABEL.branch it seems like the field only supports wildcard so "refs/heads/wlan_21*" should work but I'm guessing it is the same as for most ref-fields in the documentation:

    If field starts_with '^':                # ^refs/heads/wlan_21.*
        handle_as_regexp(field)
    else-if field ends_with '*':         # refs/heads/wlan_21*
        handle_as_wildcard(field)
    else                                             # refs/heads/wlan_2150
        handle_as_exact(field)


Normally we support 3 cases:
1. exact refs (e.g. 'refs/heads/master') 
2. ref patterns (e.g. 'refs/heads/*', here '*' can only be used as the last path segment, i.e. the pattern must end with '/*', '*' in other places is not taken into account)
3. reg exps (e.g. '^refs/heads/.*', must start with '^')

I tried in both ways as below,both of them didn't work for me ,only the exact match works, am on  an older version of gerrit 2.14

     branch = ^refs/heads/wlan_2.*

     branch = refs/heads/wlan_2* 

Matthias Sohn

unread,
Sep 20, 2022, 5:39:40 PM9/20/22
to William, Repo and Gerrit Discussion
On Tue, Sep 20, 2022 at 11:09 PM William <bacha....@gmail.com> wrote:


On Wednesday, September 14, 2022 at 1:09:35 AM UTC-7 eke...@google.com wrote:
On Wed, Sep 14, 2022 at 10:05 AM Sven Selberg <sven.s...@axis.com> wrote:


On Wednesday, September 14, 2022 at 5:03:13 AM UTC+2 William wrote:
Hi

I am trying to see if I do a regex for wlan_2150 ,wlan_2151,wlan_2152,wlan_2153 below like wlan_21* but it doesn't seem to work, is there a way to add a regx in config file?

In the documentation for label.LABEL.branch it seems like the field only supports wildcard so "refs/heads/wlan_21*" should work but I'm guessing it is the same as for most ref-fields in the documentation:

    If field starts_with '^':                # ^refs/heads/wlan_21.*
        handle_as_regexp(field)
    else-if field ends_with '*':         # refs/heads/wlan_21*
        handle_as_wildcard(field)
    else                                             # refs/heads/wlan_2150
        handle_as_exact(field)


Normally we support 3 cases:
1. exact refs (e.g. 'refs/heads/master') 
2. ref patterns (e.g. 'refs/heads/*', here '*' can only be used as the last path segment, i.e. the pattern must end with '/*', '*' in other places is not taken into account)
3. reg exps (e.g. '^refs/heads/.*', must start with '^')

I tried in both ways as below,both of them didn't work for me ,only the exact match works, am on  an older version of gerrit 2.14

you should consider to upgrade to a supported version, see https://www.gerritcodereview.com/support.html
 

William

unread,
Sep 23, 2022, 7:58:07 PM9/23/22
to Repo and Gerrit Discussion
On Tuesday, September 20, 2022 at 2:39:40 PM UTC-7 Matthias Sohn wrote:
On Tue, Sep 20, 2022 at 11:09 PM William <bacha....@gmail.com> wrote:


On Wednesday, September 14, 2022 at 1:09:35 AM UTC-7 eke...@google.com wrote:
On Wed, Sep 14, 2022 at 10:05 AM Sven Selberg <sven.s...@axis.com> wrote:


On Wednesday, September 14, 2022 at 5:03:13 AM UTC+2 William wrote:
Hi

I am trying to see if I do a regex for wlan_2150 ,wlan_2151,wlan_2152,wlan_2153 below like wlan_21* but it doesn't seem to work, is there a way to add a regx in config file?

In the documentation for label.LABEL.branch it seems like the field only supports wildcard so "refs/heads/wlan_21*" should work but I'm guessing it is the same as for most ref-fields in the documentation:

    If field starts_with '^':                # ^refs/heads/wlan_21.*
        handle_as_regexp(field)
    else-if field ends_with '*':         # refs/heads/wlan_21*
        handle_as_wildcard(field)
    else                                             # refs/heads/wlan_2150
        handle_as_exact(field)


Normally we support 3 cases:
1. exact refs (e.g. 'refs/heads/master') 
2. ref patterns (e.g. 'refs/heads/*', here '*' can only be used as the last path segment, i.e. the pattern must end with '/*', '*' in other places is not taken into account)
3. reg exps (e.g. '^refs/heads/.*', must start with '^')

I tried in both ways as below,both of them didn't work for me ,only the exact match works, am on  an older version of gerrit 2.14

you should consider to upgrade to a supported version, see https://www.gerritcodereview.com/support.html
Thanks, will do, is there support in future gerrit versions to update the gerrit config files automatically ?any API's are CLI method do facilitate these? 

William

unread,
Sep 26, 2022, 1:56:59 PM9/26/22
to Repo and Gerrit Discussion
On Friday, September 23, 2022 at 4:58:07 PM UTC-7 William wrote:
On Tuesday, September 20, 2022 at 2:39:40 PM UTC-7 Matthias Sohn wrote:
On Tue, Sep 20, 2022 at 11:09 PM William <bacha....@gmail.com> wrote:


On Wednesday, September 14, 2022 at 1:09:35 AM UTC-7 eke...@google.com wrote:
On Wed, Sep 14, 2022 at 10:05 AM Sven Selberg <sven.s...@axis.com> wrote:


On Wednesday, September 14, 2022 at 5:03:13 AM UTC+2 William wrote:
Hi

I am trying to see if I do a regex for wlan_2150 ,wlan_2151,wlan_2152,wlan_2153 below like wlan_21* but it doesn't seem to work, is there a way to add a regx in config file?

In the documentation for label.LABEL.branch it seems like the field only supports wildcard so "refs/heads/wlan_21*" should work but I'm guessing it is the same as for most ref-fields in the documentation:

    If field starts_with '^':                # ^refs/heads/wlan_21.*
        handle_as_regexp(field)
    else-if field ends_with '*':         # refs/heads/wlan_21*
        handle_as_wildcard(field)
    else                                             # refs/heads/wlan_2150
        handle_as_exact(field)


Normally we support 3 cases:
1. exact refs (e.g. 'refs/heads/master') 
2. ref patterns (e.g. 'refs/heads/*', here '*' can only be used as the last path segment, i.e. the pattern must end with '/*', '*' in other places is not taken into account)
3. reg exps (e.g. '^refs/heads/.*', must start with '^')

I tried in both ways as below,both of them didn't work for me ,only the exact match works, am on  an older version of gerrit 2.14

you should consider to upgrade to a supported version, see https://www.gerritcodereview.com/support.html
Thanks, will do, is there support in future gerrit versions to update the gerrit config files automatically ?any API's are CLI method do facilitate these? 
Gentlemen,Any word on this? 

Sven Selberg

unread,
Sep 27, 2022, 4:27:18 AM9/27/22
to Repo and Gerrit Discussion
On Monday, September 26, 2022 at 7:56:59 PM UTC+2 William wrote:
On Friday, September 23, 2022 at 4:58:07 PM UTC-7 William wrote:
On Tuesday, September 20, 2022 at 2:39:40 PM UTC-7 Matthias Sohn wrote:
On Tue, Sep 20, 2022 at 11:09 PM William <bacha....@gmail.com> wrote:


On Wednesday, September 14, 2022 at 1:09:35 AM UTC-7 eke...@google.com wrote:
On Wed, Sep 14, 2022 at 10:05 AM Sven Selberg <sven.s...@axis.com> wrote:


On Wednesday, September 14, 2022 at 5:03:13 AM UTC+2 William wrote:
Hi

I am trying to see if I do a regex for wlan_2150 ,wlan_2151,wlan_2152,wlan_2153 below like wlan_21* but it doesn't seem to work, is there a way to add a regx in config file?

In the documentation for label.LABEL.branch it seems like the field only supports wildcard so "refs/heads/wlan_21*" should work but I'm guessing it is the same as for most ref-fields in the documentation:

    If field starts_with '^':                # ^refs/heads/wlan_21.*
        handle_as_regexp(field)
    else-if field ends_with '*':         # refs/heads/wlan_21*
        handle_as_wildcard(field)
    else                                             # refs/heads/wlan_2150
        handle_as_exact(field)


Normally we support 3 cases:
1. exact refs (e.g. 'refs/heads/master') 
2. ref patterns (e.g. 'refs/heads/*', here '*' can only be used as the last path segment, i.e. the pattern must end with '/*', '*' in other places is not taken into account)
3. reg exps (e.g. '^refs/heads/.*', must start with '^')

I tried in both ways as below,both of them didn't work for me ,only the exact match works, am on  an older version of gerrit 2.14

you should consider to upgrade to a supported version, see https://www.gerritcodereview.com/support.html
Thanks, will do, is there support in future gerrit versions to update the gerrit config files automatically ?any API's are CLI method do facilitate these? 
Gentlemen,Any word on this? 

Reply all
Reply to author
Forward
0 new messages