tower-cli icon indicating copy to clipboard operation
tower-cli copied to clipboard

Partial matching behavior on tw pipelines command

Open markpanganiban opened this issue 2 years ago • 4 comments

The pipeline subcommand will return an error when there are multiple matches with the pipeline name.

Example below:

mark@LAPTOP-CURHNF2E:~/scripts/tw$ ./tw pipelines view -n 'mark-slurm' -w 'seqeralabs/testing'

 ERROR: Multiple pipelines match 'mark-slurm' at [seqeralabs / testing] workspace

mark@LAPTOP-CURHNF2E:~/scripts/tw$ ./tw pipelines view -n 'hello-mark-slurm' -w 'seqeralabs/testing'

  Pipeline at [seqeralabs / testing] workspace:

    --------------+-------------------------------------------
     ID           | 10884606264418
     Name         | hello-mark-slurm
     Description  |
     Repository   | https://github.com/markpanganiban/nf-test
     Compute env. | mark-slurm
     Labels       | No labels found

markpanganiban avatar Nov 09 '23 13:11 markpanganiban

Can you give it a try to this:

./tw pipelines view -n '"mark-slurm"' -w 'seqeralabs/testing'

The option to use quotes to do a exact search was added at API level few months ago, not sure if this works at CLI.

jordeu avatar Nov 09 '23 16:11 jordeu

It works with quotes! Thanks Jordi.

$ ./tw pipelines view -n '"mark-slurm"' -w 'seqeralabs/testing'

  Pipeline at [seqeralabs / testing] workspace:

    --------------+-------------------------------------------
     ID           | 149276434439194
     Name         | mark-slurm
     Description  |
     Repository   | https://github.com/markpanganiban/nf-test
     Compute env. | mark-slurm
     Labels       | No labels found

Shall we clarify this behavior on our tw-cli docs?

markpanganiban avatar Nov 09 '23 16:11 markpanganiban

I think that the CLI should automatically add the quotes (unless they are already added). This was not done when this was implemented because it was not supported on API side.

I don't see any use case that you want to do a partial string match here.

jordeu avatar Nov 09 '23 16:11 jordeu

Agree 👍🏽 Default behaviour should be exact matching.

drpatelh avatar Nov 10 '23 11:11 drpatelh