User regex filter not matching as expected

Issue #36 on hold
Former user created an issue

We're trying to stop pushed commits from our Jenkins CI pipeline via a user name. For example, if a user is named "jenkins", we do not want the build to trigger. We have tried various reg-ex's in the http request hook, but the build is triggered either way, on a match or no match. For example, ^(jenkins)$ triggers on a match or no-match, or ^(?!jenkins).*$ triggers a build on a motah or no match.

Comments (3)

  1. Alexander Renteln

    Hi,

    thanks for your feedback.

    I just tried to reproduce it. The following works fine with me:

    ^(?!jenkins).*$
    

    One thing that could be an issue is, that the matcher uses the user-slug (a unique URL-friendly variant of the user name).

    The code looks like this:

    String userSlug = authenticationContext.getCurrentUser().getSlug();
    

    and

    boolean matchesUserFilter = userSlug.matches(userFilter);
    

    Let me know, if you found the issue? I'm planning to add some kind of UI to test the filters without always having to push stuff.

    Best, Alex

  2. Log in to comment