Skip to content

Commit

Permalink
fix: Fix the bug about uid (#447)
Browse files Browse the repository at this point in the history
Signed-off-by: Ce Gao <cegao@tensorchord.ai>
  • Loading branch information
gaocegege committed Jun 18, 2022
1 parent eff6ffa commit 3abef45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/lang/ir/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/cockroachdb/errors"
"github.com/moby/buildkit/client/llb"
"github.com/sirupsen/logrus"

"github.com/tensorchord/envd/pkg/progress/compileui"
"github.com/tensorchord/envd/pkg/types"
Expand Down Expand Up @@ -121,6 +122,10 @@ func (g Graph) Compile(uid, gid int) (llb.State, error) {

// TODO(gaocegege): Remove the hack for https://github.com/tensorchord/envd/issues/370
g.gid = 1001
logrus.WithFields(logrus.Fields{
"uid": g.uid,
"gid": g.gid,
}).Debug("compile LLB")

// TODO(gaocegege): Support more OS and langs.
base := g.compileBase()
Expand Down
2 changes: 1 addition & 1 deletion pkg/lang/ir/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func (g *Graph) compileBase() llb.State {
res := base.
Run(llb.Shlex(fmt.Sprintf("groupadd -g %d envd", g.gid)),
llb.WithCustomName("[internal] create user group envd")).
Run(llb.Shlex(fmt.Sprintf("useradd -p \"\" -u %d -g envd -s /bin/sh -m envd", g.gid)),
Run(llb.Shlex(fmt.Sprintf("useradd -p \"\" -u %d -g envd -s /bin/sh -m envd", g.uid)),
llb.WithCustomName("[internal] create user envd")).
Run(llb.Shlex("adduser envd sudo"),
llb.WithCustomName("[internal] add user envd to sudoers")).
Expand Down

0 comments on commit 3abef45

Please sign in to comment.