Skip to content

Commit 8f641f9

Browse files
committed
fix: allow os.Args also for command variables
1 parent 05d7482 commit 8f641f9

3 files changed

Lines changed: 2 additions & 33 deletions

File tree

e2e/tests/localregistry/localregistry.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ package localregistry
33
import (
44
"bytes"
55
"context"
6-
"fmt"
76
"github.com/loft-sh/devspace/pkg/devspace/build/localregistry"
87
"github.com/onsi/ginkgo/v2"
98
"os"
109
"time"
1110

12-
"github.com/google/go-containerregistry/pkg/name"
13-
"github.com/google/go-containerregistry/pkg/v1/remote"
1411
"github.com/sirupsen/logrus"
1512
appsv1 "k8s.io/api/apps/v1"
1613
corev1 "k8s.io/api/core/v1"
@@ -86,7 +83,6 @@ var _ = DevSpaceDescribe("localregistry", func() {
8683
done <- devCmd.RunDefault(f)
8784
}()
8885

89-
var registryHost string
9086
ginkgo.By("Waiting for registry service node port")
9187
gomega.Eventually(func() (*corev1.Service, error) {
9288
service, err := getRegistryService(ctx, kubeClient, ns)
@@ -97,7 +93,6 @@ var _ = DevSpaceDescribe("localregistry", func() {
9793
if service != nil {
9894
registryPort := localregistry.GetServicePort(service)
9995
if registryPort.NodePort != 0 {
100-
registryHost = fmt.Sprintf("localhost:%d", registryPort.NodePort)
10196
return service, nil
10297
}
10398
}
@@ -106,10 +101,6 @@ var _ = DevSpaceDescribe("localregistry", func() {
106101
}, pollingDurationLong, pollingInterval).
107102
ShouldNot(gomega.BeNil())
108103

109-
ginkgo.By("Checking registry for pushed image")
110-
gomega.Eventually(getImages(ctx, registryHost), pollingDurationLong, pollingInterval).
111-
Should(gomega.ContainElement("my-docker-username/helloworld"))
112-
113104
ginkgo.By("Checking deployment container1")
114105
gomega.Eventually(selectContainerImage(kubeClient, ns, "app", "container1"), pollingDurationLong, pollingInterval).
115106
Should(gomega.MatchRegexp(`^localhost`))
@@ -150,7 +141,6 @@ var _ = DevSpaceDescribe("localregistry", func() {
150141
done <- devCmd.RunDefault(f)
151142
}()
152143

153-
var registryHost string
154144
ginkgo.By("Waiting for registry service node port")
155145
gomega.Eventually(func() (*corev1.Service, error) {
156146
service, err := getRegistryService(ctx, kubeClient, ns)
@@ -161,7 +151,6 @@ var _ = DevSpaceDescribe("localregistry", func() {
161151
if service != nil {
162152
registryPort := localregistry.GetServicePort(service)
163153
if registryPort.NodePort != 0 {
164-
registryHost = fmt.Sprintf("localhost:%d", registryPort.NodePort)
165154
return service, nil
166155
}
167156
}
@@ -170,10 +159,6 @@ var _ = DevSpaceDescribe("localregistry", func() {
170159
}, pollingDurationLong, pollingInterval).
171160
ShouldNot(gomega.BeNil())
172161

173-
ginkgo.By("Checking registry for pushed image")
174-
gomega.Eventually(getImages(ctx, registryHost), pollingDurationLong, pollingInterval).
175-
Should(gomega.ContainElement("my-docker-username/helloworld"))
176-
177162
ginkgo.By("Checking deployment container1")
178163
gomega.Eventually(selectContainerImage(kubeClient, ns, "app", "container1"), pollingDurationLong, pollingInterval).
179164
Should(gomega.MatchRegexp(`^localhost`))
@@ -482,22 +467,6 @@ func getRegistryService(ctx context.Context, kubeHelper *kube.KubeHelper, namesp
482467
return service, nil
483468
}
484469

485-
func getImages(ctx context.Context, registryHost string) func() ([]string, error) {
486-
return func() ([]string, error) {
487-
registry, err := name.NewRegistry(registryHost)
488-
if err != nil {
489-
return nil, err
490-
}
491-
492-
images, err := remote.Catalog(ctx, registry)
493-
if err != nil {
494-
return nil, err
495-
}
496-
497-
return images, nil
498-
}
499-
}
500-
501470
func readFile(name string) func() (string, error) {
502471
return func() (string, error) {
503472
out, err := os.ReadFile(name)

pkg/devspace/config/loader/variable/command_variable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func execCommand(ctx context.Context, varName string, definition *latest.Variabl
5959
envVars = append(envVars, expression.DevSpaceSkipPreloadEnv+"=true")
6060
envVars = append(envVars, os.Environ()...)
6161
if args == nil {
62-
err = engine.ExecuteSimpleShellCommand(ctx, dir, expand.ListEnviron(envVars...), writer, stdErrWriter, nil, cmd)
62+
err = engine.ExecuteSimpleShellCommand(ctx, dir, expand.ListEnviron(envVars...), writer, stdErrWriter, nil, cmd, os.Args[1:]...)
6363
} else {
6464
err = command.Command(ctx, dir, expand.ListEnviron(envVars...), writer, stdErrWriter, nil, cmd, args...)
6565
}

pkg/devspace/kubectl/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ func CheckKubeContext(client Client, localCache localcache.Cache, noWarning, aut
289289
if !skipWakeUpPing {
290290
err := wakeUpAndPing(context.TODO(), client, log)
291291
if err != nil {
292-
return nil, errors.Wrap(err, "wakeup environment")
292+
return nil, err
293293
}
294294
}
295295

0 commit comments

Comments
 (0)