Skip to content

Commit d49a68e

Browse files
gloursndeloof
authored andcommitted
bridge - run transformer container as current user
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
1 parent be83f63 commit d49a68e

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

pkg/bridge/convert.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"io"
2323
"os"
24+
"os/user"
2425
"path/filepath"
2526
"strconv"
2627

@@ -110,9 +111,14 @@ func convert(ctx context.Context, dockerCli command.Cli, model map[string]any, o
110111
return err
111112
}
112113

114+
user, err := user.Current()
115+
if err != nil {
116+
return err
117+
}
113118
created, err := dockerCli.Client().ContainerCreate(ctx, &container.Config{
114119
Image: transformation,
115120
Env: []string{"LICENSE_AGREEMENT=true"},
121+
User: user.Uid,
116122
}, &container.HostConfig{
117123
AutoRemove: true,
118124
Binds: binds,

pkg/e2e/bridge_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package e2e
1818

1919
import (
20-
"fmt"
20+
"path/filepath"
2121
"strings"
2222
"testing"
2323

@@ -31,7 +31,7 @@ func TestConvertAndTransformList(t *testing.T) {
3131
tmpDir := t.TempDir()
3232

3333
t.Run("kubernetes manifests", func(t *testing.T) {
34-
kubedir := fmt.Sprintf("%s/kubernetes", tmpDir)
34+
kubedir := filepath.Join(tmpDir, "kubernetes")
3535
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/bridge/compose.yaml", "--project-name", projectName, "bridge", "convert",
3636
"--output", kubedir)
3737
assert.NilError(t, res.Error)
@@ -41,7 +41,7 @@ func TestConvertAndTransformList(t *testing.T) {
4141
})
4242

4343
t.Run("helm charts", func(t *testing.T) {
44-
helmDir := fmt.Sprintf("%s/helm", tmpDir)
44+
helmDir := filepath.Join(tmpDir, "helm")
4545
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/bridge/compose.yaml", "--project-name", projectName, "bridge", "convert",
4646
"--output", helmDir, "--transformation", "docker/compose-bridge-helm")
4747
assert.NilError(t, res.Error)

0 commit comments

Comments
 (0)