Glob patterns document -- persist_to_workspace paths

Can someone expand on the documentation regarding things like glob patterns in persist_to_workspace…

the documentation shows a paths: - build/*, but what are the capabilities beyond that?

Is this a unix glob pattern?

If I had a set of directories (this is a lerna project FYI), i.e.

Could I use a pattern ./packages/**/lib/*

I can iteratively test this… but, would love to just see some better docs and examples here… would help the community right

We are using Glob from Go, and the pattern matches filepath.Match.

	{ term }
	'*'         matches any sequence of non-Separator characters
	'?'         matches any single non-Separator character
	'[' [ '^' ] { character-range } ']'
	            character class (must be non-empty)
	c           matches character c (c != '*', '?', '\\', '[')
	'\\' c      matches character c

	c           matches character c (c != '\\', '-', ']')
	'\\' c      matches character c
	lo '-' hi   matches character c for lo <= c <= hi

Per the Go docs:

The pattern may describe hierarchical names such as /usr/*/bin/ed (assuming the Separator is '/'). 

So in your specific example ./packages/*/lib/* should suffice.

Please note that everything must be relative to the work space root directory.

cc @michelle-luna we could probably just snag that right out of the Go docs and put it in ours since its the source of truth.

1 Like

This is great info, thanks a lot. This REALLY helps.

PS – this would be a great addition to the main documentation!!


Awesome, thanks for this! PR for the docs update is here


1 Like

Is this something available for save_cache as well? We’re using Yarn Workspaces, and could have large number of node_modules directories to cache.