Repository navigation
#6031 Add the sls:stage variable - #9296
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9296 +/- ##
==========================================
+ Coverage 86.86% 86.93% +0.06%
==========================================
Files 316 316
Lines 11765 11827 +62
==========================================
+ Hits 10220 10282 +62
Misses 1545 1545
Continue to review full report at Codecov.
|
|
Just wanted to make sure this is what you expected ^^ Since you seem to be good with this I'll add the region. |
|
Oh 😄 This is why it was in draft. I'll remove the commit I just pushed then. |
|
OK all good, ready for review, there's just |
There was a problem hiding this comment.
It's technically a shortcut for ${opt:stage, self:provider.stage, "dev"}
There was a problem hiding this comment.
Let's update the signature to (configExt, options). It'll be more up to convention in other test files, and more portable for eventual future addition.
configExt should be a simply configuration extension to be applied via _.merge(config, configExt), and options, should be CLI options.
There was a problem hiding this comment.
This is invoked prior every test, even one which invokes initializeServerless() on it's own. So that's not clean.
Let's remove this, and simply invoke initializeServerless in context of it's
There was a problem hiding this comment.
We can reword to should resolve ${sls.instanceId}
There was a problem hiding this comment.
I would do one it("should resolve ${sls:stage}") and in it's context simply test one by one, all three variants
|
@medikoo I have pushed changes that should address all your comments. |
There was a problem hiding this comment.
Let's simplify this to if (configExt) {
There was a problem hiding this comment.
Let's simplify to options || {}
|
@mnapoli one more thing. I think it'll be nice to also update examples in our documentation, which use stage resolution (as e.g. I think those can easily be found by searching for |
|
@medikoo good idea! I just pushed again. |
|
Does |
|
@razor-x a quick search in the codebase shows no result for I also read here https://forum.serverless.com/t/process-env-serverless-stage-in-1-0/144:
It seems like it's no longer a feature indeed. I would say that no, this variable is not taken into account. I might be wrong though. |
|
I understand that |
|
@nikhilpr23 please open a different discussion. FYI you can set the default stage via |
${sls:stage}is a shortcut to:This is a new attempt at solving #6031, replacing older PR #6049.
As a start, I'm only introducing
${sls:stage}for now, and opening this PR as WIP. Once we're happy with the implementation, I'll addregionin this PR.Closes: #6031
Note:
npm run lintshows errors all over the codebase, so I'm ignoring it for now.