0

The context is a JenkinsFile in which I need to use the copyArtifacts function to catch a specific file among all the artifacts of another build. This function uses ANT-style path pattern. The build contains several artifacts:

  • foo_1.23.456_bar.baz
  • foo_1.23.456_qux_bar.baz
  • foo_1.23.456_thud.baz

And I only want to catch the first one, without catching another one. The 1.23.456 part is varying and can contain any set of decimal number (it's a version number).

What I tried so far

  • foo_*([0-9]).*([0-9]).*([0-9])_bar.baz
  • foo_*\.*\.*\._bar.baz
  • foo_*\\.*\\.*\\._bar.baz

In all those cases, I either get a Jenkins syntax error, or I don't catch any file at all, or I catch too many of them. I've thoroughly read this QA but this time it didn't help me.

Can someone help me figuring out the correct ANT-style path pattern for this specific usecase ?

Tim
  • 1,853
  • 2
  • 24
  • 36
  • 1
    In Ant you would use a general include pattern with a specific exclude pattern, rather than trying to do it in one. The Copy Artifacts docs say it supports exclude rules - worth looking in to. – martin clayton Mar 19 '20 at 08:50
  • Unfortunately the answer you reference is for Spring Ant paths, which support more patterns than standard Ant paths. Ant only supports *, **, and ? – martin clayton Mar 19 '20 at 09:34
  • @martinclayton Thank you, I didn't think about using exclude patterns. It works well ! Feel free to turn your first comment into an answer, I'll then upvote & accept it – Tim Mar 19 '20 at 10:12

0 Answers0