Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions pkg/skaffold/debug/transform_nodejs.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ func isLaunchingNpm(args []string) bool {
}

func (t nodeTransformer) IsApplicable(config imageConfiguration) bool {
if _, found := config.env["NODE_VERSION"]; found {
return true
// NODE_VERSION defined in Official Docker `node` image
// NODEJS_VERSION defined in RedHat's node base image
// NODE_ENV is a common var found to toggle debug and production
for _, v := range []string{"NODE_VERSION", "NODEJS_VERSION", "NODE_ENV"} {
if _, found := config.env[v]; found {
return true
}
}
if len(config.entrypoint) > 0 {
return isLaunchingNode(config.entrypoint) || isLaunchingNpm(config.entrypoint)
Expand Down
10 changes: 10 additions & 0 deletions pkg/skaffold/debug/transform_nodejs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ func TestNodeTransformer_IsApplicable(t *testing.T) {
source: imageConfiguration{env: map[string]string{"NODE_VERSION": "10"}},
result: true,
},
{
description: "NODEJS_VERSION",
source: imageConfiguration{env: map[string]string{"NODEJS_VERSION": "12"}},
result: true,
},
{
description: "NODE_ENV",
source: imageConfiguration{env: map[string]string{"NODE_ENV": "production"}},
result: true,
},
{
description: "entrypoint node",
source: imageConfiguration{entrypoint: []string{"node", "init.js"}},
Expand Down