@@ -6,17 +6,18 @@ import (
66 "encoding/json"
77 "errors"
88 "fmt"
9+ "os"
10+ "path/filepath"
11+ "strconv"
12+ "strings"
13+ "time"
14+
915 "github.com/loft-sh/devspace/pkg/devspace/context/values"
1016 "github.com/loft-sh/devspace/pkg/devspace/kubectl"
1117 "github.com/loft-sh/devspace/pkg/util/downloader"
1218 "github.com/loft-sh/devspace/pkg/util/downloader/commands"
1319 "github.com/loft-sh/devspace/pkg/util/log"
1420 "github.com/sirupsen/logrus"
15- "os"
16- "path/filepath"
17- "strconv"
18- "strings"
19- "time"
2021
2122 "github.com/loft-sh/devspace/pkg/devspace/config/versions/latest"
2223 "github.com/loft-sh/devspace/pkg/devspace/plugin"
@@ -30,7 +31,7 @@ import (
3031type PredefinedVariableOptions struct {
3132 ConfigPath string
3233 KubeClient kubectl.Client
33- Profile string
34+ Profile [] string
3435}
3536
3637// PredefinedVariableFunction is the definition of a predefined variable
@@ -75,7 +76,10 @@ var predefinedVars = map[string]PredefinedVariableFunction{
7576 return randutil .GenerateRandomString (6 ), nil
7677 },
7778 "DEVSPACE_PROFILE" : func (ctx context.Context , options * PredefinedVariableOptions , log log.Logger ) (interface {}, error ) {
78- return options .Profile , nil
79+ return GetLastProfile (options .Profile ), nil
80+ },
81+ "DEVSPACE_PROFILES" : func (ctx context.Context , options * PredefinedVariableOptions , log log.Logger ) (interface {}, error ) {
82+ return strings .Join (options .Profile , " " ), nil
7983 },
8084 "DEVSPACE_USER_HOME" : func (ctx context.Context , options * PredefinedVariableOptions , log log.Logger ) (interface {}, error ) {
8185 homeDir , err := homedir .Dir ()
@@ -194,3 +198,10 @@ func (p *predefinedVariable) Load(ctx context.Context, definition *latest.Variab
194198
195199 return getVar (ctx , p .options , p .log )
196200}
201+
202+ func GetLastProfile (profiles []string ) string {
203+ if len (profiles ) == 0 {
204+ return ""
205+ }
206+ return profiles [len (profiles )- 1 ]
207+ }
0 commit comments