-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define how to reference remote objects #52
Comments
What about using
|
Don't know details of fmf format, however it would be nice to have some aliases defined within the fmf file of those repo prefixes so one can use them to shorten the text. So that something like this would work |
Make sense. We could also store these aliases under the special |
What about this syntax (I think CSS/XPATH have something like this): Also, I'm not sure but can FMF reference files within the structure? If not, then the same syntax could be reused for that, eg. |
Otherwise my plugin solves it: #54
|
Thanks to all for sharing your thoughts. To summarize, we need the following fragments in order to be able to address arbitrary nodes:
In order to make references concise and prevent unnecessary duplication we would also like to introduce aliases which would be stored under
Each remote has to define the
We could use that as a base and extend with additional fields using extra delimiters but it is true as Alois mentioned that introducing more special characters is not the best approach. He suggests this option:
Another option could be to name individual fragments, something like providing a dictionary including key names:
Something similar could be also possible using url and parameters:
I would be also good to provide a distinct way how to do relative references within a single git repo, something like:
Perhaps all references (even local within the same metadata tree) should be prefixed with a distinct string or special character to make it clear at the first sight that this is a reference and also to give a clear hint to the parser that it should (could) handle it in a special way. Not sure about the most suitable character.
End of today's brainstorm :) |
When I suggested
I actually only meant to suggest the general approach: have a small set of builtin functions that would usable to reference (or re-create) content. I didn't use a good example (I tried to incorporate all elements from your OP even though I did not really understand them.) I'll try to better illustrate:
...just returns body of whatever document there is. If you want to have git-specific reference (shouldn't just URL's let you do that, though?), then you can have another function for that, say:
Maybe you could have other kinds of functions; one that feels like would be immediately useful is:
or
One nice property this approach has is that it's infinitely extensible. well, you probably don't want to have infinite functions, but the immediate benefit is that you can start with implementing just the simple ones ( Maybe it could make sense to make it extensible on some kind of local versions of these functions, eg. you could have project or org specific libraries of extra functions that would help with facts about the project ( I'm not sure about the aliases. While it could save typing, it would introduce extra complexity, and even inconsistency: one project could have That said, you could actually solve it by local functions:
which could work even when the reference is not a single argument, and even when the identifier has to be somewhere in the middle of URL. About "relative references within a single git repo", I'm not sure what you mean but it sounds scary when you add revisions. You don't want to make it possible to reference ... to the past, do you? (Please say no and forgive me for asking.) |
@AloisMahdal, thanks much for your detailed thoughts. It seems the purpose of this issue is not completely clear. The intention was not to introduce new functions which would implement fetching/accessing objects but a generic specification how to reference (and possibly access) an fmf node which is not present in the local fmf tree. We will need this for example when test coverage for a single component is scattered across multiple repositories. When we have the spec defined we can discuss further details about handy functions. Last thought: Your idea of being able to reference to the past actually seems very interesting! But this is something very natural for all git repositories: Be able to reference different branches with different content. |
Well all of my examples were about referencing (and possibly accessing) stuff. The "functions" I'm talking about here really are the references. Eg, main.fmf:
would end up showing as
..if .jats/version contained that text. See? I'm just referencing a resource: content of a local text file. -- Anyway, I might have misunderstood the use case, but
does not illustrate the use case at all. How does the fact that coverage for single component is scattered, warrant the need for special kind of reference? What do you even need to reference where? -- (It's also not clear to me what you said about the git references, although it's probably getting OT so I'll let it be.) |
Today we've discussed the format with @lukaszachy, @hegerj, @pvalena and @t184256 with the following proposal: Similar to what @AloisMahdal suggested with the
Revision would default to
This is just a dictionary so multi line could be used as well where suitable:
As |
@psss, could you please provide wider context in the example? Is this supposed to be a part of a remote object reference or a part of a definition of an alias? |
The examples above show how the complete unique fmf identifier would look like. For aliases I imagine definition could look like this:
Let's add now a remote tmt metadata tree with tests:
Brainstorming possible options how to reference remote objects inside fmf files:
We could have some special characaters introduced to make is shorter (but then those characters cannot be used in path):
Here's a full variant without using the alias:
Of course it is still possible to use a multiline dictionary as well:
Finally, referencing local test would be simple as this:
Thoughts? |
OK, so it seems we have a concensus here. @kkaarreell, @AloisMahdal, @jscotka, @t184256, @thrix, @hegerj, can you confirm the proposal above is fine with you as well? Before I'm going to prepare a pull request with the specification last question about the key naming: Shall we make it aligned / consistent with some existing config / tooling? For example ansible
Shall we stay consistent with ansible/str and use |
Fine by me. 'Repository' and 'revision' are explicit and the meaning is clear, while 'reference' is, IIRC, a term for some internal git magic, which is different from revisions. |
As far as git terminology goes, "refspec" is specific to git-push/pull/remote and usually has the One thing I would definitely not do is try to merge it into the URL (like ie. Beaker Project did) as, like a filename on a filesystem, a git ref can have special characters in its name. |
Thanks for clarification, @comps. We would like to allow specifying individual commits too. Do you think that would fit under the |
The git protocol (well, Git v2.5.0 introduced this feature,
but virtually all major hosts (github, gitlab, etc.) have it disabled. You can however support it transparently just by giving Alternatively, if you always fully clone the remote repository (possibly with |
Well, currently we simply clone it, right? But, in case we want to optimise it, there should be no change from user-perspective, right? Could you possibly provide some example working with github.com? |
The problem is that refs and objects are very different things on the git internals level. Only some higher-level tools like I don't know how much you can change your current implementation w.r.t. user expectations or if you have some caches for the cloned repositories, but I would recommend unifying both ref and commit hash as:
With the
(You can re-use the same local repo for multiple fetches of unrelated remotes.) |
Thanks much for detailed feedback, @comps! Your proposal seems fine to me. For completeness I'm attaching description of ansible
Interesting that they are mentioning |
That's probably because
The
( I really would just call it |
Definition (for now without the commit key) ready for review in #71. Please, have a look. Thanks. |
Currently each node in the metadata tree structure has a unique identifier called
name
so it is possible to reference individual objects from other attributes. This can be useful for example for mapping test coverage where tests are referenced from requirements.This works nicely within a single metadata tree. However, we need to define a clear way how to reference objects which are outside of the current metadata tree. For this we could combine repository url with object name using a defined separator.
Also, in order to prevent too long identifiers and repeating urls it would be good to provide a way how to define a common prefix or remote repository shortcut. Perhaps it could work in a similar way how remotes like origin are defined in git.
The text was updated successfully, but these errors were encountered: