On Tue, Jun 4, 2024 at 4:52 PM Clark Boylan <cboylan@sapwetik.org> wrote:
On Tue, Jun 4, 2024, at 1:06 PM, Brian Haley wrote:
> Hi Neutrinos,
>
> It was noticed today by Mohammed Naser that the neutron gate was only
> running the docs and pep8 jobs. We were able to track it down to the RE2
> patches that were recently merged [0]. Until the reverts land please
> don't +W anything since it could merge untested and would just need to
> be reverted.
>
> Other projects might have similar issues if they updated code using the
> 'negate' directive for regex recently as we found it doesn't actually
> work with RE2 when using negative lookahead [1].

Note this is very misleading. It is true that re2 does not support negative lookahead. Zuul's implementation does a positive match then negates the result. This is why you have to say things like regex: foo negate: true. This works outside of typical regex syntax to negate the result.

I think neutron's problem was assuming that negate will be in-place replacement for the use case. Now I don't see how it could in this specific scenario (where irrelevant-files filters are ORed.)
 

The problem here is not re2 or negative lookahead regexes themselves but instead a conversion to non equivalent regular expressions. If we look at an ironic example [2] the old working regex with native negative lookahead support said "all files in tools/ except for bandit.yml are an irrelevant file". The new converted regex said "all files but tools/bandit.yml are an irrelevant file". This meant only changes including updates to tools/bandit.yml would trigger the job.

We do still need to drop the use of native negative lookaheads in zuul configs as re2 regexes will be the only valid regexes in future zuul releases. Quick reverts are a good initial step, but I don't want to have an impression this is something we can revert then leave as is.


We are landing definitions that will list all files to ignore explicitly:

https://review.opendev.org/c/openstack/neutron-tempest-plugin/+/921330
https://review.opendev.org/c/openstack/neutron/+/921309

I suspect this could be cleaned up to reuse a single variable listing files to ignore through */& syntax.
 
>
> Thanks,
>
> -Brian
>
> [0] https://review.opendev.org/q/topic:"files-negate"
> [1] https://github.com/google/re2/issues/156

[2] https://review.opendev.org/c/openstack/ironic/+/921319/1/zuul.d/ironic-jobs.yaml