2

In Jenkins with Git Parameter plugin (which helps me filter out tags) I have this pattern *-rc this simply display all tags with -rc as a suffix. But how do I negate this pattern. I already have this (?!-rc).*$ but it is not working.

EDIT 1

I have tags named:

3.11.2-rc

3.11.1-rc

3.11.0

3.10.0

so on and so fort...

with this pattern *-rc I can simply display tags with '-rc'

now, what I want to achieve is display all tags without '-rc'

EDIT 2

jenkins git parameter config

botjaeger
  • 93
  • 8
  • What do you mean *exactly* by suffix? Can you please give examples of input that should match and input that should not? – Bohemian Jan 22 '19 at 06:36

2 Answers2

0

You need to first turn on the regex option - see this answer for how to do that.

Use this negative look behind based regex:

.*(?<!-rc)$

See live demo of this regex with your sample data.

The look behind, which is anchored to end of input via $, requires that the preceding chars not be "-rc".

Bohemian
  • 412,405
  • 93
  • 575
  • 722
0

As seen in this blog post, you could use the Extensible Choice plugin and:

  • add 'Extensible Choice' as a second parameter (as seen here)
  • write a groovy script which does the filtering for you

You can see an example here for branches, that you can adapt for tags.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    thank you for another option, but i think it is too much of an effort just to display a non '-rc' tags? – botjaeger Jan 22 '19 at 09:00