-
-
Notifications
You must be signed in to change notification settings - Fork 157
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
[feature] Introduce user defined variables or rename fileGroups to vars #1569
Comments
Okay, I figured I can't use |
Variables are on the roadmap, but no ETA on when they will land. |
IMO it would be hard to generalise I did suggest project specific metadata in #1571 which I think could solve the issue here but as a personal recommendation abusing it could cause the project's Since these are task specific variables why not use
In the project's
This should work and you only define these for the task needing these vars. @milesj I don't know what are the planned vars but project global |
Yeah env var substitution is also possible. I always forget about that. It should inherit from the global |
@doron-cohen, @milesj thanks for the hint! I as well forgot about envs. Don't like the idea to use envs for that (potential conflict in envs space), but it's better than nothing. |
@milesj can we have the workspace defined envs? Seems like current yaml schema says there are no envs field available on a workspace level yet (as pointed by @doron-cohen) |
How about task variables?
These could be very handy when defining global tasks. Another pro is that you could fail to run the task when a required var is not defined instead of running the task with an empty string value to the env var. |
@doron-cohen I think this was the response from @milesj
|
I plan to migrate to pkl from yaml, which supports variables natively: https://pkl-lang.org/main/current/language-reference/index.html#let-expressions That's the main reason vars are on the backlog.
I'll think about it. |
That's cool! Can't wait to see it. |
Is your feature request related to a problem? Please describe.
I have this task:
There is at least two variables to extract:
Those are not files, but just an ordinary variables I need to use and substitute for the command to run, therefore using filesGroup feels kind awkward for this purpose.
Describe the solution you'd like
The title of the issue states this already. While filesGroup is called files, it actually behaves more like variables list section, because with the use of
@group(var)
token I can achieve variables substitution behaviour. Not ideal, but semantically means that fielsGroup is overspecified and can be reused for much broader automation.So, instead:
This should can be generalized like:
Because usage of this string is context dependent, and in one context it will be file in another it will be string. So we might have now situations like:
Generally I'd say all the pieces are there - but semantics is overly specific.
Describe alternatives you've considered
Quite a big one.
Introduce own very minimal config language, as yaml pretty quickly becoming a limiting factor for me, as I have lot's of custom tasks to do in a polylanguage monorepo of js, ts, python and c++ (not a final list).
I don't want to open discussion about Starlark (I think it's kinda niche cult like garbage language), but approach which Just took seems very viable and flexible, and if it would've been possible to have much tighter integration with
Just
(either just in moon directly, or moon parses extended Just syntax files) it will bring automation with moon onto the whole new level.Because besides variables, I'm actually missing an ability to solve lot's of different scenarios without offloading them into
Just
or bash or whatever external programming language I have, like detecting OS, small files generations fully embedded into build definition or based of complex templates, self-service tools, and anything which is missing in moon itself - I need to externalize it. Writing standalone plugin for that is kinda overkill.The text was updated successfully, but these errors were encountered: