Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package okteto for openSUSE:Factory checked in at 2023-06-13 16:10:26 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/okteto (Old) and /work/SRC/openSUSE:Factory/.okteto.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "okteto" Tue Jun 13 16:10:26 2023 rev:52 rq:1092769 version:2.16.3 Changes: -------- --- /work/SRC/openSUSE:Factory/okteto/okteto.changes 2023-05-31 21:54:50.953130145 +0200 +++ /work/SRC/openSUSE:Factory/.okteto.new.15902/okteto.changes 2023-06-13 16:10:27.595221631 +0200 @@ -1,0 +2,10 @@ +Mon Jun 12 20:14:43 UTC 2023 - ka...@b1-systems.de + +- Update to version 2.16.3: + * [Backport release-2.16] fix: variable expansion on buildargs + that only have one env (#3691) + * Fix variables deploy installer (#3696) (#3697) + * fix: endpoints should only return the json if the flag specify + it (#3682) (#3687) + +------------------------------------------------------------------- Old: ---- okteto-2.16.2.obscpio New: ---- okteto-2.16.3.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ okteto.spec ++++++ --- /var/tmp/diff_new_pack.FYkOuq/_old 2023-06-13 16:10:29.179230976 +0200 +++ /var/tmp/diff_new_pack.FYkOuq/_new 2023-06-13 16:10:29.187231023 +0200 @@ -19,7 +19,7 @@ %define __arch_install_post export NO_BRP_STRIP_DEBUG=true Name: okteto -Version: 2.16.2 +Version: 2.16.3 Release: 0 Summary: Develop your applications directly in your Kubernetes Cluster License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.FYkOuq/_old 2023-06-13 16:10:29.235231306 +0200 +++ /var/tmp/diff_new_pack.FYkOuq/_new 2023-06-13 16:10:29.235231306 +0200 @@ -3,10 +3,10 @@ <param name="url">https://github.com/okteto/okteto</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">2.16.2</param> + <param name="revision">2.16.3</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> - <param name="match-tag">2.16.2</param> + <param name="match-tag">2.16.3</param> </service> <service name="set_version" mode="disabled"> <param name="basename">okteto</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.FYkOuq/_old 2023-06-13 16:10:29.263231471 +0200 +++ /var/tmp/diff_new_pack.FYkOuq/_new 2023-06-13 16:10:29.263231471 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/okteto/okteto</param> - <param name="changesrevision">9333b3ea40903714cf80bb45346851151006ef61</param></service></servicedata> + <param name="changesrevision">9f680c59234781cacc41ddaf5a33b8ba3f5587ce</param></service></servicedata> (No newline at EOF) ++++++ okteto-2.16.2.obscpio -> okteto-2.16.3.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/cmd/build/v2/config_test.go new/okteto-2.16.3/cmd/build/v2/config_test.go --- old/okteto-2.16.2/cmd/build/v2/config_test.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/cmd/build/v2/config_test.go 2023-06-02 12:52:02.000000000 +0200 @@ -173,7 +173,7 @@ func TestGetTextToHash(t *testing.T) { fs := afero.NewMemMapFs() afero.WriteFile(fs, "secret", []byte("bar"), 0600) - + t.Setenv("BAR", "bar") type input struct { repo fakeConfigRepo buildInfo *model.BuildInfo @@ -264,6 +264,32 @@ }, expected: "commit:;target:target;build_args:;secrets:secret=bar;context:context;dockerfile:dockerfile;image:image;", }, + { + name: "arg with expansion", + input: input{ + repo: fakeConfigRepo{ + sha: "", + isClean: true, + err: assert.AnError, + }, + buildInfo: &model.BuildInfo{ + Args: model.BuildArgs{ + { + Name: "foo", + Value: "$BAR", + }, + }, + Target: "target", + Secrets: model.BuildSecrets{ + "secret": "secret", + }, + Context: "context", + Dockerfile: "dockerfile", + Image: "image", + }, + }, + expected: "commit:;target:target;build_args:foo=bar;secrets:secret=bar;context:context;dockerfile:dockerfile;image:image;", + }, } for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/cmd/deploy/cfghandler.go new/okteto-2.16.3/cmd/deploy/cfghandler.go --- old/okteto-2.16.2/cmd/deploy/cfghandler.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/cmd/deploy/cfghandler.go 2023-06-02 12:52:02.000000000 +0200 @@ -30,6 +30,7 @@ translateConfigMapAndDeploy(context.Context, *pipeline.CfgData) (*apiv1.ConfigMap, error) updateConfigMap(context.Context, *apiv1.ConfigMap, *pipeline.CfgData, error) error updateEnvsFromCommands(context.Context, string, string, []string) error + getConfigmapVariablesEncoded(ctx context.Context, name, namespace string) (string, error) } // deployInsideDeployConfigMapHandler is the runner used when the okteto is executed @@ -67,6 +68,14 @@ return pipeline.TranslateConfigMapAndDeploy(ctx, data, c) } +func (ch *defaultConfigMapHandler) getConfigmapVariablesEncoded(ctx context.Context, name, namespace string) (string, error) { + c, _, err := ch.k8sClientProvider.Provide(okteto.Context().Cfg) + if err != nil { + return "", err + } + return pipeline.GetConfigmapVariablesEncoded(ctx, name, namespace, c) +} + func (ch *defaultConfigMapHandler) updateConfigMap(ctx context.Context, cfg *apiv1.ConfigMap, data *pipeline.CfgData, errMain error) error { c, _, err := ch.k8sClientProvider.Provide(okteto.Context().Cfg) if err != nil { @@ -102,6 +111,10 @@ return nil, nil } +func (*deployInsideDeployConfigMapHandler) getConfigmapVariablesEncoded(_ context.Context, _, _ string) (string, error) { + return "", nil +} + // updateConfigMap with the receiver deployInsideDeployConfigMapHandler doesn't do anything // because we have to control the cfmap in the main execution. If both handled the configmap we will be // overwritten the cfmap and leave it in a inconsistent status diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/cmd/deploy/deploy.go new/okteto-2.16.3/cmd/deploy/deploy.go --- old/okteto-2.16.2/cmd/deploy/deploy.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/cmd/deploy/deploy.go 2023-06-02 12:52:02.000000000 +0200 @@ -27,6 +27,7 @@ "github.com/okteto/okteto/cmd/utils" "github.com/okteto/okteto/pkg/analytics" "github.com/okteto/okteto/pkg/cmd/pipeline" + "github.com/okteto/okteto/pkg/config" "github.com/okteto/okteto/pkg/constants" "github.com/okteto/okteto/pkg/divert" oktetoErrors "github.com/okteto/okteto/pkg/errors" @@ -91,8 +92,9 @@ DivertDriver divert.Driver PipelineCMD pipelineCMD.PipelineDeployerInterface - PipelineType model.Archetype - isRemote bool + PipelineType model.Archetype + isRemote bool + runningInInstaller bool } type ExternalResourceInterface interface { @@ -197,6 +199,7 @@ CfgMapHandler: NewConfigmapHandler(k8sClientProvider), Fs: afero.NewOsFs(), PipelineCMD: pc, + runningInInstaller: config.RunningInInstaller(), } startTime := time.Now() @@ -306,6 +309,19 @@ return err } + if dc.isRemote || dc.runningInInstaller { + currentVars, err := dc.CfgMapHandler.getConfigmapVariablesEncoded(ctx, deployOptions.Name, deployOptions.Manifest.Namespace) + if err != nil { + return err + } + + // when running in remote or installer variables should be retrieved from the saved value at configmap + deployOptions.Variables = []string{} + for _, v := range types.DecodeStringToDeployVariable(currentVars) { + deployOptions.Variables = append(deployOptions.Variables, fmt.Sprintf("%s=%s", v.Name, v.Value)) + } + } + data := &pipeline.CfgData{ Name: deployOptions.Name, Namespace: deployOptions.Manifest.Namespace, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/cmd/deploy/deploy_test.go new/okteto-2.16.3/cmd/deploy/deploy_test.go --- old/okteto-2.16.2/cmd/deploy/deploy_test.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/cmd/deploy/deploy_test.go 2023-06-02 12:52:02.000000000 +0200 @@ -161,6 +161,10 @@ return nil, nil } +func (f *fakeCmapHandler) getConfigmapVariablesEncoded(context.Context, string, string) (string, error) { + return "", nil +} + func (f *fakeCmapHandler) updateConfigMap(context.Context, *apiv1.ConfigMap, *pipeline.CfgData, error) error { return nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/cmd/destroy/local.go new/okteto-2.16.3/cmd/destroy/local.go --- old/okteto-2.16.2/cmd/destroy/local.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/cmd/destroy/local.go 2023-06-02 12:52:02.000000000 +0200 @@ -2,8 +2,6 @@ import ( "context" - "encoding/base64" - "encoding/json" "errors" "fmt" "os" @@ -62,21 +60,6 @@ return err } -// getVariablesFromCfgmap given a cfgmap this returns the variables as []EnvVar in it -func decodeConfigMapVariables(stringVariables string) []types.DeployVariable { - decodedStringVariables, err := base64.StdEncoding.DecodeString(stringVariables) - if err != nil { - return nil - } - - var variables []types.DeployVariable - if err := json.Unmarshal(decodedStringVariables, &variables); err != nil { - return nil - } - - return variables -} - func (ld *localDestroyCommand) runDestroy(ctx context.Context, opts *Options) error { err := ld.manifest.ExpandEnvVars() if err != nil { @@ -95,7 +78,7 @@ return err } - cfgVariables := decodeConfigMapVariables(cfgVariablesString) + cfgVariables := types.DecodeStringToDeployVariable(cfgVariablesString) for _, variable := range cfgVariables { opts.Variables = append(opts.Variables, fmt.Sprintf("%s=%s", variable.Name, variable.Value)) if strings.TrimSpace(variable.Value) != "" { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/cmd/destroy/local_test.go new/okteto-2.16.3/cmd/destroy/local_test.go --- old/okteto-2.16.2/cmd/destroy/local_test.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/cmd/destroy/local_test.go 1970-01-01 01:00:00.000000000 +0100 @@ -1,44 +0,0 @@ -package destroy - -import ( - "testing" - - "github.com/okteto/okteto/pkg/types" - "github.com/stretchr/testify/assert" -) - -func Test_decodeConfigMapVariables(t *testing.T) { - tests := []struct { - name string - input string - expected []types.DeployVariable - }{ - { - name: "empty variable", - input: "", - expected: nil, - }, - { - name: "error decoding variables", - input: "test", - expected: nil, - }, - { - name: "success decoding variables", - input: "W3sibmFtZSI6InRlc3QiLCJ2YWx1ZSI6InZhbHVlIn1d", - expected: []types.DeployVariable{ - { - Name: "test", - Value: "value", - }, - }, - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - res := decodeConfigMapVariables(tt.input) - assert.Equal(t, tt.expected, res) - }) - } -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/cmd/preview/endpoints.go new/okteto-2.16.3/cmd/preview/endpoints.go --- old/okteto-2.16.2/cmd/preview/endpoints.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/cmd/preview/endpoints.go 2023-06-02 12:52:02.000000000 +0200 @@ -49,7 +49,9 @@ if err := contextCMD.NewContextCommand().Run(ctx, &contextCMD.ContextOptions{}); err != nil { return err } - oktetoLog.Information("Using %s @ %s as context", previewName, okteto.RemoveSchema(okteto.Context().Name)) + if output != "json" { + oktetoLog.Information("Using %s @ %s as context", previewName, okteto.RemoveSchema(okteto.Context().Name)) + } if !okteto.IsOkteto() { return oktetoErrors.ErrContextIsNotOktetoCluster diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/go.mod new/okteto-2.16.3/go.mod --- old/okteto-2.16.2/go.mod 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/go.mod 2023-06-02 12:52:02.000000000 +0200 @@ -4,7 +4,7 @@ require ( github.com/Masterminds/semver/v3 v3.1.1 - github.com/a8m/envsubst v1.3.0 + github.com/a8m/envsubst v1.4.2 github.com/alessio/shellescape v1.4.1 github.com/briandowns/spinner v1.23.0 github.com/cheggaaa/pb/v3 v3.1.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/go.sum new/okteto-2.16.3/go.sum --- old/okteto-2.16.2/go.sum 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/go.sum 2023-06-02 12:52:02.000000000 +0200 @@ -121,8 +121,8 @@ github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow= github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4= -github.com/a8m/envsubst v1.3.0 h1:GmXKmVssap0YtlU3E230W98RWtWCyIZzjtf1apWWyAg= -github.com/a8m/envsubst v1.3.0/go.mod h1:MVUTQNGQ3tsjOOtKCNd+fl8RzhsXcDvvAEzkhGtlsbY= +github.com/a8m/envsubst v1.4.2 h1:4yWIHXOLEJHQEFd4UjrWDrYeYlV7ncFWJOCBRLOZHQg= +github.com/a8m/envsubst v1.4.2/go.mod h1:MVUTQNGQ3tsjOOtKCNd+fl8RzhsXcDvvAEzkhGtlsbY= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= github.com/acomagu/bufpipe v1.0.3 h1:fxAGrHZTgQ9w5QqVItgzwj235/uYZYgbXitB+dLupOk= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/pkg/cmd/pipeline/translate.go new/okteto-2.16.3/pkg/cmd/pipeline/translate.go --- old/okteto-2.16.2/pkg/cmd/pipeline/translate.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/pkg/cmd/pipeline/translate.go 2023-06-02 12:52:02.000000000 +0200 @@ -245,14 +245,16 @@ iconField: data.Icon, }, } + + // only include field when variables exist + if len(data.Variables) > 0 { + cmap.Data[variablesField] = translateVariables(data.Variables) + } + if data.Repository != "" { cmap.Data[filenameField] = data.Filename } - variables := translateVariables(data.Variables) - if variables != "" { - cmap.Data[variablesField] = variables - } output := oktetoLog.GetOutputBuffer() outputData := translateOutput(output) cmap.Data[outputField] = base64.StdEncoding.EncodeToString([]byte(outputData)) @@ -295,12 +297,12 @@ cmap.Data[branchField] = data.Branch } - currentVariables := cmap.Data[variablesField] - variables := translateVariables(data.Variables) - if currentVariables != "" && variables == "" { + // only update field when variables exist + if len(data.Variables) > 0 { + cmap.Data[variablesField] = translateVariables(data.Variables) + } else { + // if data.Variables is empty, update cmap by removing the field delete(cmap.Data, variablesField) - } else if variables != "" { - cmap.Data[variablesField] = variables } output := oktetoLog.GetOutputBuffer() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/pkg/model/dev.go new/okteto-2.16.3/pkg/model/dev.go --- old/okteto-2.16.2/pkg/model/dev.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/pkg/model/dev.go 2023-06-02 12:52:02.000000000 +0200 @@ -140,7 +140,11 @@ } func (v *BuildArg) String() string { - return fmt.Sprintf("%s=%s", v.Name, v.Value) + value, err := ExpandEnv(v.Value, true) + if err != nil { + return fmt.Sprintf("%s=%s", v.Name, v.Value) + } + return fmt.Sprintf("%s=%s", v.Name, value) } // BuildArgs is a list of arguments used on the build step. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/pkg/model/dev_test.go new/okteto-2.16.3/pkg/model/dev_test.go --- old/okteto-2.16.2/pkg/model/dev_test.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/pkg/model/dev_test.go 2023-06-02 12:52:02.000000000 +0200 @@ -1057,38 +1057,50 @@ } func Test_ExpandEnv(t *testing.T) { - os.Setenv("BAR", "bar") + t.Setenv("BAR", "bar") tests := []struct { - name string - value string - result string + name string + value string + expandIfEmpty bool + result string }{ { - name: "no-var", - value: "value", - result: "value", + name: "no-var", + value: "value", + expandIfEmpty: true, + result: "value", }, { - name: "var", - value: "value-${BAR}-value", - result: "value-bar-value", + name: "var", + value: "value-${BAR}-value", + expandIfEmpty: true, + result: "value-bar-value", }, { - name: "default", - value: "value-${FOO:-foo}-value", - result: "value-foo-value", + name: "default", + value: "value-${FOO:-foo}-value", + expandIfEmpty: true, + result: "value-foo-value", + }, + { + name: "only bar expanded", + value: "${BAR}", + expandIfEmpty: true, + result: "bar", + }, + { + name: "only bar not expand if empty", + value: "${FOO}", + expandIfEmpty: false, + result: "${FOO}", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - result, err := ExpandEnv(tt.value, true) - if err != nil { - t.Errorf("error in test '%s': %s", tt.name, err.Error()) - } - if result != tt.result { - t.Errorf("error in test '%s': '%s', expected: '%s'", tt.name, result, tt.result) - } + result, err := ExpandEnv(tt.value, tt.expandIfEmpty) + assert.NoError(t, err) + assert.Equal(t, tt.result, result) }) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/pkg/model/serializer.go new/okteto-2.16.3/pkg/model/serializer.go --- old/okteto-2.16.2/pkg/model/serializer.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/pkg/model/serializer.go 2023-06-02 12:52:02.000000000 +0200 @@ -1279,7 +1279,7 @@ err := unmarshal(&rawList) if err == nil { for _, buildArg := range rawList { - value, err := ExpandEnv(buildArg.Value, true) + value, err := ExpandEnv(buildArg.Value, false) if err != nil { return nil, err } @@ -1293,7 +1293,7 @@ return nil, err } for key, value := range rawMap { - result[key], err = ExpandEnv(value, true) + result[key], err = ExpandEnv(value, false) if err != nil { return nil, err } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/pkg/model/serializer_test.go new/okteto-2.16.3/pkg/model/serializer_test.go --- old/okteto-2.16.2/pkg/model/serializer_test.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/pkg/model/serializer_test.go 2023-06-02 12:52:02.000000000 +0200 @@ -2470,7 +2470,7 @@ expected: BuildArgs{ { Name: "KEY", - Value: "", + Value: "$VALUE", }, }, env: map[string]string{}, @@ -2483,7 +2483,7 @@ expected: BuildArgs{ { Name: "KEY", - Value: "", + Value: "$VALUE", }, { Name: "KEY2", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/pkg/types/deploy.go new/okteto-2.16.3/pkg/types/deploy.go --- old/okteto-2.16.2/pkg/types/deploy.go 2023-05-31 11:29:49.000000000 +0200 +++ new/okteto-2.16.3/pkg/types/deploy.go 2023-06-02 12:52:02.000000000 +0200 @@ -13,7 +13,27 @@ package types +import ( + "encoding/base64" + "encoding/json" +) + type DeployVariable struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Value string `json:"value,omitempty" yaml:"value,omitempty"` } + +// DecodeStringToDeployVariable given an encoded string it returns the DeployVariables +func DecodeStringToDeployVariable(s string) []DeployVariable { + decodedStringVariables, err := base64.StdEncoding.DecodeString(s) + if err != nil { + return nil + } + + var variables []DeployVariable + if err := json.Unmarshal(decodedStringVariables, &variables); err != nil { + return nil + } + + return variables +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/okteto-2.16.2/pkg/types/deploy_test.go new/okteto-2.16.3/pkg/types/deploy_test.go --- old/okteto-2.16.2/pkg/types/deploy_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/okteto-2.16.3/pkg/types/deploy_test.go 2023-06-02 12:52:02.000000000 +0200 @@ -0,0 +1,43 @@ +package types + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func Test_DecodeStringToDeployVariable(t *testing.T) { + tests := []struct { + name string + input string + expected []DeployVariable + }{ + { + name: "empty variable", + input: "", + expected: nil, + }, + { + name: "error decoding variables", + input: "test", + expected: nil, + }, + { + name: "success decoding variables", + input: "W3sibmFtZSI6InRlc3QiLCJ2YWx1ZSI6InZhbHVlIn1d", + expected: []DeployVariable{ + { + Name: "test", + Value: "value", + }, + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + res := DecodeStringToDeployVariable(tt.input) + assert.Equal(t, tt.expected, res) + }) + } +} ++++++ okteto.obsinfo ++++++ --- /var/tmp/diff_new_pack.FYkOuq/_old 2023-06-13 16:10:29.595233430 +0200 +++ /var/tmp/diff_new_pack.FYkOuq/_new 2023-06-13 16:10:29.599233453 +0200 @@ -1,5 +1,5 @@ name: okteto -version: 2.16.2 -mtime: 1685525389 -commit: 9333b3ea40903714cf80bb45346851151006ef61 +version: 2.16.3 +mtime: 1685703122 +commit: 9f680c59234781cacc41ddaf5a33b8ba3f5587ce ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/okteto/vendor.tar.gz /work/SRC/openSUSE:Factory/.okteto.new.15902/vendor.tar.gz differ: char 5, line 1