Skip to content

The get-files action generates an error and stops the Workflow with a recursif pattern like '**/f*.txt'

For example, under Linux, in the case of a tree like below:

my_temp/    
  │  
  ├── file1.txt  
  ├── file2.txt  
  ├── file3.txt  
  ├── folder1/  
  │   ├── file1.txt  
  │   ├── picture.png  
  │   └── titi.csv  
  ├── folders2/  
  │   ├── file1.txt  
  │   └── subfolder22/  
  │       ├── file2.txt  
  │       ├── picture.png  
  │       └── toto.csv  
  ├── folders3/  
  │   ├── file1.txt  
  │   └── subfolders33/  
  │       ├── file2.txt  
  │       └── subfolder333/  
  │           ├── file3.txt  
  │           ├── picture.png  
  │           ├── tata.csv  
  │           ├── titi.csv  
  │           ├── toto.csv  
  │           └── tutu.csv  
  ├── folders4/  
  │   ├── picture_not_selected.png  
  │   └── subfolders44/  
  │       ├── picture.jpg  
  │       └── subfolders444/  
  │           ├── picture.jpeg  
  │           └── subfolder4444/  
  │               └── picture.png  
  ├── folders5/  
  │   └── subfolder55_empty  
  └── tata.csv  

With the '**/f*.txt' pattern, the following error appears in the logs of the orchestrator:

[["find: paths must precede expression: `file2.txt'\n", "find: possible unquoted pattern after predicate `-name'?\n"]]  

The opentf-ctl run workflow logs finish by:

[2022-06-15T17:34:44] [job 041ad489-c96a-4520-95a8-205569f747f7] Running action actionsget-filesv1
[2022-06-15T17:34:44] [job 041ad489-c96a-4520-95a8-205569f747f7]  Running command ['if test -z "$(find . -name \'f*.txt\' -print -quit)"; then echo "::warning::True"; else for f in $(find -name \\f*.txt); do echo "::attach::$(pwd)/$f" ; done fi']
[2022-06-15T17:34:45] [job 041ad489-c96a-4520-95a8-205569f747f7] Releasing execution environment for job 'linux-get-files-act-02-with-recursive-pattern'
[2022-06-15T17:34:45] [job 041ad489-c96a-4520-95a8-205569f747f7] find: paths must precede expression: `file2.txt'
[2022-06-15T17:34:45] [job 041ad489-c96a-4520-95a8-205569f747f7] find: possible unquoted pattern after predicate `-name'?

The error seems to come from the command (find -name \\f*.txt) where \\*.txt should be quoted.

To check also under Windows?

Edited by Jean-Marc BELORGANE