bridge - run transformer container as current user
Signed-off-by: Guillaume Lours <705411+glours@users.noreply.github.com>
This commit is contained in:
parent
be83f63f26
commit
d49a68ecbf
@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
|
"os/user"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
@ -110,9 +111,14 @@ func convert(ctx context.Context, dockerCli command.Cli, model map[string]any, o
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
user, err := user.Current()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
created, err := dockerCli.Client().ContainerCreate(ctx, &container.Config{
|
created, err := dockerCli.Client().ContainerCreate(ctx, &container.Config{
|
||||||
Image: transformation,
|
Image: transformation,
|
||||||
Env: []string{"LICENSE_AGREEMENT=true"},
|
Env: []string{"LICENSE_AGREEMENT=true"},
|
||||||
|
User: user.Uid,
|
||||||
}, &container.HostConfig{
|
}, &container.HostConfig{
|
||||||
AutoRemove: true,
|
AutoRemove: true,
|
||||||
Binds: binds,
|
Binds: binds,
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
package e2e
|
package e2e
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ func TestConvertAndTransformList(t *testing.T) {
|
|||||||
tmpDir := t.TempDir()
|
tmpDir := t.TempDir()
|
||||||
|
|
||||||
t.Run("kubernetes manifests", func(t *testing.T) {
|
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",
|
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/bridge/compose.yaml", "--project-name", projectName, "bridge", "convert",
|
||||||
"--output", kubedir)
|
"--output", kubedir)
|
||||||
assert.NilError(t, res.Error)
|
assert.NilError(t, res.Error)
|
||||||
@ -41,7 +41,7 @@ func TestConvertAndTransformList(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
t.Run("helm charts", func(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",
|
res := c.RunDockerComposeCmd(t, "-f", "./fixtures/bridge/compose.yaml", "--project-name", projectName, "bridge", "convert",
|
||||||
"--output", helmDir, "--transformation", "docker/compose-bridge-helm")
|
"--output", helmDir, "--transformation", "docker/compose-bridge-helm")
|
||||||
assert.NilError(t, res.Error)
|
assert.NilError(t, res.Error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user