-
Notifications
You must be signed in to change notification settings - Fork 6
Variables not working #13
Comments
Based on my understanding of what seems to be happening, this plugin is performing all of it's merge logic AFTER serverless already populated variables. Thus if you expect Though I don't have the best knowledge on this front, I think this plugin needs to utilize the serverless hooks to perform BEFORE the variable resolution happens. This "may" break things though if one expects a value in fileB to be used but is not because that same value is defined in fileA and thus not overriden on merge. |
FYI our solution was to use https://www.npmjs.com/package/@alexlafroscia/yaml-merge and make it one file before get to serverless |
@sunshineo that didnt work for us, as |
Seems we're on the same page. Serverless exposes lifecycle hooks which can allow the plugin to fire at specific times of the serverless operations. I believe it currently fires sometime after the variable resolution. I was previously able to get it to fire earlier but with mixed results. That was pre-v3 of Serverless though so it's been a hot-minute since I last did anything with plugins and couldn't tell you exactly how to do it anymore. Looks like you do something with |
I ended Up using `yq` to merge the files:
`yq ea '. as $item ireduce ({}; . * $item )' path/to/*.yml` and using this
file temporary file as config for sls.
Works flawless.
Joshua Morgan ***@***.***> schrieb am Do., 24. Feb. 2022,
15:18:
… i tried to change the plugin code to work earlier in the chain, but im not
familar with serverless plugins
I think this plugin needs to utilize the serverless hooks to perform
BEFORE the variable resolution happens
Seems we're on the same page. Serverless exposes lifecycle hooks which can
allow the plugin to fire at specific times of the serverless operations. I
believe it currently fires sometime after the variable resolution. I was
previously able to get it to fire earlier but with mixed results. That was
pre-v3 of Serverless though so it's been a hot-minute since I last did
anything with plugins and couldn't tell you exactly how to do it anymore.
Looks like you do something with this.hooks = { [hook: string]: () =>
void }. Someone made a cheatsheet of all the hooks:
https://gist.github.com/HyperBrain/50d38027a8f57778d5b0f135d80ea406
—
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHVVZCHNTIIHAOMADNXATU4Y43BANCNFSM45IGZAYQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you commented.Message ID:
***@***.***>
|
I have this:
Works totally fine in one file but if I try to move this to another file and import it using this plugin it does not work
The variables are no longer resolved
The text was updated successfully, but these errors were encountered: