-
Notifications
You must be signed in to change notification settings - Fork 31
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
CLI tool is not replacing '$' placeholders with environment variables #145
Comments
I'm not sure this is valid input. According to the spec, an
in the It's possible that the spec hasn't been updated, but the tests have been (I encountered this for #138 (comment)). However, I went through all the test fixtures and none of them had the scenario you had, which makes me believe it is not supported. |
does structuring inputs like:
work? |
@tysonnorris yes this is supported, $VAR being an env variable. What's not supported, is what the issue mentions, i.e. multi level input objects with env vars |
@shazron in that case should we mark this as an enhancement instead of a bug? EDIT: more details: what I mean is that as of now we can set object inputs in the manifest (even if we don't officially support it) but $VAR are not replaced in such objects. So my question is should we support input objects officially in which case I feel we should also support the $VAR? |
Since we are currently following the |
Compatibility is as of today a paramount for our manifest and I'm not in favor of deviating from the original specifications unless there's a very good reason and benefit for our end-users. I propose then to close the issue for the time being and reevaluate if we see this as a recurring need. |
Reopening as @ekremney has some more information to provide |
According to the specification, parameter types include
Object type is explained at the bottom of the page
As a developer who uses Openwhisk, I would like to be able to group my parameters so that I can address them differently in my code. It especially comes very handy if you use openwhisk wrappers. Ie: inputs:
logging:
host: <host>
token: <token>
index: <index>
service:
host: <host>
token: <token>
... Then you can just initialize your wrappers: ...
new LoggingWrapper(params.logging);
... FYI, we are migrating from |
Also, multi-level inputs test file: https://github.com/apache/openwhisk-wskdeploy/blob/master/tests/dat/manifest_validate_multiline_params.yaml and the test case: I kindly ask you to add feature parity with wskdeploy in this case. single-level configurations are super ugly and unreadable. |
Thanks @ekremney, it is clear now. I didn't see this file. I'll send a PR to the There doesn't seem to be any test fixtures in |
PR filed: apache/openwhisk-wskdeploy#1094 |
@solaris007 I don't think there is any question that we will try to achieve parity with wskdeploy, we were trying to determine if it is in the spec, which it has been clarified that it is. With regards to the tests you mentioned, the closest I see is for type |
Why not simply replace env vars in all of the manifest.yml in a first pass of the text file itself before parsing the yaml? Makes the code simpler and it works everywhere. If done right you can also do arrays etc. in the replacement. I don’t know if that will create a conflict with the wskdeploy spec but aio is different already. Here is my workaround for that using npm scripts: Install envsub:
In package.json add:
Then run Note it is slightly dangerous since if deploy fails then it will not run postdeploy and restore the original manifest. So you might have a modified manifest with e.g. credentials present, and could mistakenly commit them. So watch out. |
Hi @alexkli, This issue just pinpoints the discrepancy between That's a nice workaround you mention. In fact, we used inputs:
auth: &auth
public-key: $PUBLIC_KEY
db: &db
host: $DB_HOST
password: $DB_PASS
logging: &logging
host: $LOGGING_HOST
token: $LOGGING_TOKEN
packages:
__APP_PACKAGE__:
actions:
login:
function: actions/login
inputs:
<<: *auth
<<: *logging
getSomething:
function: actions/getSomething
inputs:
<<: *db
<<: *logging
doSomething:
function: actions/doSomething
inputs:
<<: *logging |
@ekremney but your setup doesn't create nested input objects, it just ends up being flat. if you really want nested inputs/params in your actions then this doesn't help... or am I missing something? |
Describe the bug
CLI tool is not replacing '$' placeholders (indented more than one level) with environment variables.
To Reproduce
Example manifest file:
Expected behavior
I expect aio cli tool to replace $ placeholders with environment variables regardless of the indentation level.
Additional context
An example error:
The text was updated successfully, but these errors were encountered: