Skip to main content
Version: QB12

File Pattern Reference

Definition

File patterns are widely used in QuickBuild to specify a set of directories or files. For example, the artifact publishing step has a property File Patterns which is used to specify files and directories to be published as artifacts.

File patterns are described using EBNF:

file patterns::=file pattern,{",",file pattern}
file pattern::=[+|-]Ant pattern

where:

  1. Ant pattern refers to Ant based path patterns
  2. File pattern can be constructed by prefixing"+" or "-" character before an Ant pattern:
    • if prefixed with "+", the file pattern will include files or directories specified in the Ant pattern (default)
    • if prefixed with "-", the file pattern will exclude files or directories specified in the Ant pattern
    • if not prefixed, the file pattern will include files or directories specified in the Ant pattern (it has the same effect as prefixing a "+" character)
  3. File patterns are a series of file pattern connected with the comma character

Examples

We will use the artifact publishing step to give examples of the file patterns in QuickBuild. Let's suppose that:

  1. The configuration workspace is located in /opt/quickbuild2/configurations/1/workspace , and it contains the following directories and files:

    file0.zip
    file0.doc
    dir1/
    file1.zip
    file1.doc
    dir2/
    file2.zip
    file2.doc
    dir3/
    file3.zip
    file3.doc
  2. The build artifacts directory is located in /opt/quickbuild2/builds/1/artifacts

  3. The property From Directory of the artifact publishing step is left empty, which means that the workspace directory will be used as the base directory of the file pattern matching.

  4. The property Destination Directory of the artifact publishing step is left empty, which means matched files and directories will be copied over to the artifacts directory.

Let's examine several file patterns to see what the artifacts directory will look like after the publishing step:

  1. **
    All files and directories will be published from the workspace directory to the artifacts directory recursively. The artifacts directory will look just the same as the workspace directory:

    file0.zip
    file0.doc
    dir1/
    file1.zip
    file1.doc
    dir2/
    file2.zip
    file2.doc
    dir3/
    file3.zip
    file3.doc
  2. **/*.zip
    All zip files will be published recursively. The artifacts direcory will look like:

    file0.zip
    dir1/
    file1.zip
    dir2/
    file2.zip
    dir3/
    file3.zip
  3. *.zip
    All zip files that are directly in the workspace directory will be published. The artifacts directory will look like:

    file0.zip
  4. **/*.zip,-dir2/**
    Publishes all zip files recursively, but excludes all the files under the dir2 directory recursively. The artifacts
    directory will look like:

    file0.zip
    dir1/
    file1.zip
  5. **/*.zip,-dir2/*
    Publishes all zip files recursively, but excludes all the files that are directly in the dir2 directory. The artifacts
    directory will look like:

    file0.zip
    dir1/
    file1.zip
    dir2/
    dir3/
    file3.zip