BuildStream-Migration-Bot opened a new issue #1411:
URL: https://github.com/apache/buildstream/issues/1411


   [See original issue on 
GitLab](https://gitlab.com/BuildStream/buildstream/-/issues/1411)
   In GitLab by [[Gitlab user @tristanvb]](https://gitlab.com/tristanvb) on Nov 
19, 2020, 07:06
   
   We need something more explicit for commands which support both artifact 
names and element names, and then additionally support globbing of the provided 
artifact names and element names.
   
   
   ## Background
   
   Glob patterns were originally added when adding the artifact commands, and 
at the same time, it was decided that it would be convenient to also support 
element names in artifact commands.
   
   In the case that the user is interested in the artifact which a project 
element currently produces (which is a likely case), then supporting element 
names in artifact commands provides a short cut so that the user need not 
manually discover the cache key and derive the artifact name.
   
   Originally, there was a hidden *"trick"* being done under the hood, which 
cause only glob patterns ending in *".bst"* to be matched against elements - 
this is sneaky and ugly, and provides a worse experience for commands which 
accept elements but do not accept artifacts, like `bst show`, which also 
support glob patterns, but would report no results if the user did not know 
about specifying this hacky *".bst"* required suffix to the glob pattern.
   
   When fixing the above, we discovered that we now have commands which 
ambiguously match the same glob pattern to both element targets and artifact 
names, so we caused this to be an error.
   
   
   ## Original comment reference
   
   The following discussion from !2102 should be addressed:
   
   - [ ] [[Gitlab user @juergbi]](https://gitlab.com/juergbi) started a 
[discussion](https://gitlab.com/BuildStream/buildstream/-/merge_requests/2102#note_448763866):
 
   
       > > globs are not discriminated against for having `.bst`
       > >
       > > * For a command which only supports elements, then `**` will match 
all elements in the project as one would expect
       > > * For a command which supports both elements and artifacts, the 
pattern `**` will now match all elements **and** all artifacts
       > 
       > I'm worried about patterns that can match both elements and artifacts. 
It would mean that the same pattern leads to different results for different 
commands (commands only accepting elements and commands accepting both). And I 
can't think of a reasonable use case for wanting to match both in a single 
pattern. Especially given that one is specific to the current project state and 
the other potentially matches artifacts from random projects.
       > 
       > I think it's important to fix this before 2.0 but we don't have to 
block this MR on that discussion.
       > 
       > Could it make sense to error out when a single glob matches both 
elements and artifacts until this is discussed and fixed properly? This would 
make sure nobody starts relying on this odd behavior.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to