Glob patterns document -- persist_to_workspace paths


#1

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.
./packages/
/package1/lib/*
/package2/lib/*

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


#2

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

pattern:
	{ term }
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

character-range:
	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.


#4

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

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


#5

Awesome, thanks for this! PR for the docs update is here https://github.com/circleci/circleci-docs/pull/1694

-Michelle


#6

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.


#7