bridge - run transformer container as current user

Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
Guillaume Lours 2025-05-26 17:12:15 +02:00 committed by Nicolas De loof
parent be83f63f26
commit d49a68ecbf
2 changed files with 9 additions and 3 deletions

View File

@ -21,6 +21,7 @@ import (
"fmt"
"io"
"os"
"os/user"
"path/filepath"
"strconv"
@ -110,9 +111,14 @@ func convert(ctx context.Context, dockerCli command.Cli, model map[string]any, o
return err
}
user, err := user.Current()
if err != nil {
return err
}
created, err := dockerCli.Client().ContainerCreate(ctx, &container.Config{
Image: transformation,
Env: []string{"LICENSE_AGREEMENT=true"},
User: user.Uid,
}, &container.HostConfig{
AutoRemove: true,
Binds: binds,

View File

@ -17,7 +17,7 @@
package e2e
import (
"fmt"
"path/filepath"
"strings"
"testing"
@ -31,7 +31,7 @@ func TestConvertAndTransformList(t *testing.T) {
tmpDir := t.TempDir()
t.Run("kubernetes manifests", func(t *testing.T) {
kubedir := fmt.Sprintf("%s/kubernetes", tmpDir)
kubedir := filepath.Join(tmpDir, "kubernetes")
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/bridge/compose.yaml", "--project-name", projectName, "bridge", "convert",
"--output", kubedir)
assert.NilError(t, res.Error)
@ -41,7 +41,7 @@ func TestConvertAndTransformList(t *testing.T) {
})
t.Run("helm charts", func(t *testing.T) {
helmDir := fmt.Sprintf("%s/helm", tmpDir)
helmDir := filepath.Join(tmpDir, "helm")
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/bridge/compose.yaml", "--project-name", projectName, "bridge", "convert",
"--output", helmDir, "--transformation", "docker/compose-bridge-helm")
assert.NilError(t, res.Error)