Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions cmd/internal/agentcontainer/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"syscall"
"time"

"github.com/devsy-org/devsy/pkg/agent"
config2 "github.com/devsy-org/devsy/pkg/config"
agentd "github.com/devsy-org/devsy/pkg/daemon/agent"
"github.com/devsy-org/devsy/pkg/devcontainer/config"
Expand All @@ -25,7 +24,7 @@ import (
)

const (
RootDir = agent.ContainerDataDir
RootDir = config2.ContainerDataDir
DaemonConfigPath = "/var/run/secrets/" + config2.BinaryName + "/daemon_config"
)

Expand Down Expand Up @@ -68,13 +67,13 @@ func (cmd *DaemonCmd) Run(c *cobra.Command, args []string) error {
}
if timeoutDuration > 0 {
if err := os.WriteFile(
agent.ContainerActivityFile,
config2.ContainerActivityFile,
nil,
0o666,
); err != nil { // #nosec G306
return fmt.Errorf("failed to create activity file: %w", err)
}
if err := os.Chmod(agent.ContainerActivityFile, 0o666); err != nil { // #nosec G302
if err := os.Chmod(config2.ContainerActivityFile, 0o666); err != nil { // #nosec G302
return fmt.Errorf("failed to set activity file permissions: %w", err)
}
}
Expand Down Expand Up @@ -197,7 +196,7 @@ func runTimeoutMonitor(
case <-ctx.Done():
return nil
case <-ticker.C:
stat, err := os.Stat(agent.ContainerActivityFile)
stat, err := os.Stat(config2.ContainerActivityFile)
if err != nil {
continue
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/internal/agentworkspace/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (

"github.com/devsy-org/devsy/cmd/flags"
"github.com/devsy-org/devsy/pkg/agent"
"github.com/devsy-org/devsy/pkg/config"
"github.com/devsy-org/devsy/pkg/devcontainer"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -61,8 +62,8 @@ func (cmd *LogsCmd) Run(ctx context.Context) error {

// create new runner
runner, err := devcontainer.NewRunner(
agent.ContainerDevsyHelperLocation,
agent.DefaultAgentDownloadURL(),
config.ContainerDevsyHelperLocation,
config.DefaultAgentDownloadURL(),
workspaceInfo,
)
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions cmd/internal/agentworkspace/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ func CreateRunner(
workspaceInfo *provider.AgentWorkspaceInfo,
) (devcontainer.Runner, error) {
return devcontainer.NewRunner(
agent.ContainerDevsyHelperLocation,
agent.DefaultAgentDownloadURL(),
config.ContainerDevsyHelperLocation,
config.DefaultAgentDownloadURL(),
workspaceInfo,
)
}
Expand Down Expand Up @@ -544,6 +544,7 @@ func prepareWorkspace(params prepareWorkspaceParams) error {
params.workspaceInfo.Workspace.Source.LocalFolder != "" {
params.workspaceInfo.ContentFolder = agent.GetAgentWorkspaceContentDir(
params.workspaceInfo.Origin,
params.workspaceInfo.Workspace.UID,
)
}

Expand Down
28 changes: 13 additions & 15 deletions cmd/internal/container_tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,23 +86,21 @@ func (cmd *ContainerTunnelCmd) Run(ctx context.Context) error {
os.Exit(0)
}()

// create tunnel into container.
err = agent.Tunnel(
ctx,
func(ctx context.Context, user string, command string, stdin io.Reader, stdout io.Writer, stderr io.Writer) error {
return agent.Tunnel(ctx, agent.TunnelOptions{
Exec: func(
ctx context.Context,
user, command string,
stdin io.Reader,
stdout, stderr io.Writer,
) error {
return runner.Command(ctx, user, command, stdin, stdout, stderr)
},
cmd.User,
os.Stdin,
os.Stdout,
os.Stderr,
workspaceInfo.InjectTimeout,
)
if err != nil {
return err
}

return nil
User: cmd.User,
Stdin: os.Stdin,
Stdout: os.Stdout,
Stderr: os.Stderr,
Timeout: workspaceInfo.InjectTimeout,
})
}

func startDevContainer(
Expand Down
4 changes: 2 additions & 2 deletions cmd/internal/fleet_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"github.com/devsy-org/devsy/cmd/flags"
"github.com/devsy-org/devsy/pkg/agent"
"github.com/devsy-org/devsy/pkg/config"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -62,7 +62,7 @@ func (c *FleetServerCmd) Run(cmd *cobra.Command, _ []string) error {
// if ouf last occurrence of notify if "Notify ID connected"
// we have an active session, so let's keep alive
if strings.Contains(connString[len(connString)-1][0], "is connected") {
file, _ := os.Create(agent.ContainerActivityFile)
file, _ := os.Create(config.ContainerActivityFile)
_ = file.Close()
}
case <-cmd.Context().Done():
Expand Down
Loading
Loading