Skip to content
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

Support for mixins with Jsonnet external-variables #36

Open
ArthurSens opened this issue May 12, 2021 · 2 comments
Open

Support for mixins with Jsonnet external-variables #36

ArthurSens opened this issue May 12, 2021 · 2 comments

Comments

@ArthurSens
Copy link

It is possible to generate mixins using jsonnet external variables, but not possible to use mixtool with those jsonnet files:

gitpod /workspace/observability $ mixtool lint monitoring-satellite/main.jsonnet 
RUNTIME ERROR: Undefined external variable: remote_write_url
        monitoring-satellite/main.jsonnet:11:7-37       builtin function <extVar>
        monitoring-satellite/main.jsonnet:89:57-59
        <std>:1293:24-25        thunk from <function <anonymous>>
        <std>:1293:5-33 function <anonymous>
        monitoring-satellite/main.jsonnet:89:40-77      $

        2:16-58 thunk <mixin> from <$>
        4:21-26 thunk from <$>
        <std>:1302:21-22        thunk from <function <anonymous>>
        <std>:1302:5-32 function <anonymous>
        4:4-47  $
        During evaluation

RUNTIME ERROR: Undefined external variable: remote_write_url
        monitoring-satellite/main.jsonnet:11:7-37       builtin function <extVar>
        monitoring-satellite/main.jsonnet:89:57-59
        <std>:1293:24-25        thunk from <function <anonymous>>
        <std>:1293:5-33 function <anonymous>
        monitoring-satellite/main.jsonnet:89:40-77      $

        2:16-58 thunk <mixin> from <$>
        4:21-26 thunk from <$>
        <std>:1302:21-22        thunk from <function <anonymous>>
        <std>:1302:5-32 function <anonymous>
        4:4-48  $
        During evaluation

2021/05/12 18:58:19 failed to lint the file monitoring-satellite/main.jsonnet: 2 lint errors found

It would be nice if we could run for example:

mixtool lint --ext-str remote_write_url='my-remote-backend-url' monitoring-satellite/main.jsonnet 
@metalmatze
Copy link
Collaborator

That sounds good. Happy to add this in a PR.

@rgeyer
Copy link
Contributor

rgeyer commented Jun 22, 2022

Mixtool should also support TLAs (Top-level arguments).

This is going to require fairly significant refactoring of the eval methods, since we can no longer assume that the content of the loaded mixin file will be a "simple" object with known properties. It could be a function in the case of TLAs, for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants