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
2 changes: 1 addition & 1 deletion .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
mkdir -p ~/.azure

- name: Build and run CLI
uses: devcontainers/ci@v0.2
uses: devcontainers/ci@v0.3
env:
GITHUB_TOKEN: ${{ secrets.GH_CROSS_REPO_TOKEN }}
BUILD_NUMBER: ${{ github.run_id }}
Expand Down
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ go 1.14
require (
github.com/blang/semver v3.5.1+incompatible
github.com/bradford-hamilton/dora v0.1.1
github.com/kyoh86/richgo v0.3.10 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/kyoh86/richgo v0.3.12 // indirect
github.com/rhysd/go-github-selfupdate v1.2.2
github.com/spf13/cobra v1.0.0
github.com/spf13/viper v1.4.0
github.com/stretchr/testify v1.7.0
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec // indirect
github.com/stretchr/testify v1.8.2
golang.org/x/sys v0.6.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

Expand Down
15 changes: 15 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,17 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kyoh86/richgo v0.3.10 h1:iSGvcjhtQN2IVrBDhPk0if0R/RMQnCN1E/9OyAW4UUs=
github.com/kyoh86/richgo v0.3.10/go.mod h1:2Odx7Qx2iJxXEWmoXVWaNbUcBXhHY43qSgyK7dbTaII=
github.com/kyoh86/richgo v0.3.12 h1:W66IRaaC1BWoCPIyI94t/PChWBQ38QFDRsF1nWu4904=
github.com/kyoh86/richgo v0.3.12/go.mod h1:op8jQyhnxSZQelHDyupswwJGerEDB6zkKfzCnuqAwx4=
github.com/kyoh86/xdg v1.2.0 h1:CERuT/ShdTDj+A2UaX3hQ3mOV369+Sj+wyn2nIRIIkI=
github.com/kyoh86/xdg v1.2.0/go.mod h1:/mg8zwu1+qe76oTFUBnyS7rJzk7LLC0VGEzJyJ19DHs=
github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng=
github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
Expand Down Expand Up @@ -125,10 +129,16 @@ github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU=
github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stuartleeks/dora v0.1.5 h1:/t8/kPA2t1qMUI9W0cASGGScpgyNDQ5O+QOYud8+AlQ=
github.com/stuartleeks/dora v0.1.5/go.mod h1:Xu0GCcuQv5e9Ta0U3PUiu/rgaXJnHn1+LTaQkCgYMhc=
github.com/tcnksm/go-gitconfig v0.1.2 h1:iiDhRitByXAEyjgBqsKi9QU4o2TNtv9kPP3RgPgXBPw=
Expand Down Expand Up @@ -177,6 +187,9 @@ golang.org/x/sys v0.0.0-20220926163933-8cfa568d3c25 h1:nwzwVf0l2Y/lkov/+IYgMMbFy
golang.org/x/sys v0.0.0-20220926163933-8cfa568d3c25/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -205,4 +218,6 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
38 changes: 32 additions & 6 deletions internal/pkg/devcontainers/dockerutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,27 @@ func ExecInDevContainer(containerID string, workDir string, args []string) error
fmt.Println("Continuing without overriding PATH...")
}

statusWriter.Printf("Getting code IPC SOCK")
ipcSock, err := getVscodeIpcSock(containerID)
statusWriter.Printf("Getting VSCODE_IPC_HOOK_CLI")
vscodeIpcSock, err := getVscodeIpcSock(containerID)
if err != nil {
ipcSock = ""
fmt.Printf("Warning; Failed to get VS Code IPC SOCK: %s\n", err)
vscodeIpcSock = ""
fmt.Printf("Warning; Failed to get VSCODE_IPC_HOOK_CLI: %s\n", err)
fmt.Println("Continuing without setting VSCODE_IPC_HOOK_CLI...")
}
statusWriter.Printf("Getting REMOTE_CONTAINERS_IPC")
remoteContainersIpcSock, err := getRemoteContainersIpcSock(containerID)
if err != nil {
remoteContainersIpcSock = ""
fmt.Printf("Warning; Failed to get REMOTE_CONTAINERS_IPC: %s\n", err)
fmt.Println("Continuing without setting REMOTE_CONTAINERS_IPC...")
}
statusWriter.Printf("Getting VSCODE_GIT_IPC_HANDLE")
vscodeGitIpcSock, err := getGitIpcSock(containerID)
if err != nil {
vscodeGitIpcSock = ""
fmt.Printf("Warning; Failed to get VSCODE_GIT_IPC_HANDLE: %s\n", err)
fmt.Println("Continuing without setting VSCODE_GIT_IPC_HANDLE...")
}

mountPath := sourceInfo.DockerMount.Destination
if workDir == "" {
Expand Down Expand Up @@ -319,8 +333,14 @@ func ExecInDevContainer(containerID string, workDir string, args []string) error
if containerPath != "" {
dockerArgs = append(dockerArgs, "--env", "PATH="+containerPath)
}
if ipcSock != "" {
dockerArgs = append(dockerArgs, "--env", "VSCODE_IPC_HOOK_CLI="+ipcSock)
if vscodeIpcSock != "" {
dockerArgs = append(dockerArgs, "--env", "VSCODE_IPC_HOOK_CLI="+vscodeIpcSock)
}
if remoteContainersIpcSock != "" {
dockerArgs = append(dockerArgs, "--env", "REMOTE_CONTAINERS_IPC="+remoteContainersIpcSock)
}
if vscodeGitIpcSock != "" {
dockerArgs = append(dockerArgs, "--env", "VSCODE_GIT_IPC_HANDLE="+vscodeGitIpcSock)
}
dockerArgs = append(dockerArgs, containerID)
dockerArgs = append(dockerArgs, args...)
Expand Down Expand Up @@ -372,6 +392,12 @@ func getVscodeServerPath(containerID string) (string, error) {
func getVscodeIpcSock(containerID string) (string, error) {
return getLatestFileMatch(containerID, "\"${TMPDIR:-/tmp}\"/vscode-ipc-*")
}
func getRemoteContainersIpcSock(containerID string) (string, error) {
return getLatestFileMatch(containerID, "\"${TMPDIR:-/tmp}\"/vscode-remote-containers-ipc-*")
}
func getGitIpcSock(containerID string) (string, error) {
return getLatestFileMatch(containerID, "\"${TMPDIR:-/tmp}\"/vscode-git-*")
}

// getLatestFileMatch lists files matching `pattern` in the container and returns the latest filename
func getLatestFileMatch(containerID string, pattern string) (string, error) {
Expand Down