You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Variables: Introduce access to resolved stage via sls:stage #6031
@mnapoliVariables.js is old resolver which will be removed with v3, we keep it just for legacy compliance but do not extend with new features. So let's not update that one.
Concerning testing, all related need to be put it into get-sls.test.js (it'll be nice to keep there 100% tests coverage)
Activity
mnapoli commentedon Apr 23, 2019
@pmuens you added the
needs feedbacklabel, are you waiting for feedback from me? Let me know if I need to do anything to make the issue clearer.mnapoli commentedon Apr 25, 2019
I have opened a PR: #6049
[-]DX: simplify region and stage variables[/-][+]Improve design of variables contexts[/+]medikoo commentedon Apr 12, 2021
This is pretty easy now to implement with a new variables resolver. It's a question of extending the
slssource configured here: https://github.com/serverless/serverless/blob/master/lib/configuration/variables/sources/instance-dependent/get-sls.js.All properties that are passed to
resolveare listed here:serverless/lib/configuration/variables/resolve.js
Lines 464 to 474 in 5392a7d
Therefore e.g.
stagecan be resolved as:PR's welcome!
[-]Improve design of variables contexts[/-][+]Variables: Introduce access to resolved `stage` via `sls:stage`[/+]mnapoli commentedon Apr 12, 2021
Ohh yeah, and thanks a lot for the guidance! I'll try to work on this tomorrow! (famous last words)
mnapoli commentedon Apr 13, 2021
@medikoo I'm confused by the fact that
${sls:XXX}variables are defined in 2 places:Should I edit both?
Regarding tests as well: should I also add tests in
Variables.test.js?So far I'm editing
get-sls.test.js, are there functional tests to edit/create somewhere?medikoo commentedon Apr 13, 2021
@mnapoli
Variables.jsis old resolver which will be removed with v3, we keep it just for legacy compliance but do not extend with new features. So let's not update that one.Concerning testing, all related need to be put it into
get-sls.test.js(it'll be nice to keep there 100% tests coverage)mnapoli commentedon Apr 13, 2021
OK thanks, that answers my questions. Because I need to run tests in different scenarios:
provider.stageprovider.stagedefinedI need to edit the test a little bit. I'll open the PR and feel free to let me know how to reorganize things the way you prefer.
mnapoli commentedon Apr 13, 2021
I've opened #9296