获取容器id
(sshRemote common.SSHRemote, workspaceInfo workspace.WorkspaceInfo, cmd *cobra.Command)
| 420 | |
| 421 | // 获取容器id |
| 422 | func getRemoteWorkspaceContainerId(sshRemote common.SSHRemote, workspaceInfo workspace.WorkspaceInfo, cmd *cobra.Command) string { |
| 423 | dcc, err := GetRemoteContainersWithServices(sshRemote, |
| 424 | workspaceInfo.WorkingDirectoryPath, []string{workspaceInfo.ConfigYaml.Workspace.DevContainer.ServiceName}) |
| 425 | if err != nil { |
| 426 | common.SmartIDELog.ImportanceWithError(err) |
| 427 | } |
| 428 | if len(dcc) == 0 { |
| 429 | common.SmartIDELog.Error("没有查找到运行的容器!") |
| 430 | } |
| 431 | containerId, err := sshRemote.ExeSSHCommand(fmt.Sprintf("docker ps -f 'name=%s' -q", dcc[len(dcc)-1].ContainerName)) |
| 432 | if err != nil { |
| 433 | common.SmartIDELog.Warning(err.Error()) |
| 434 | } |
| 435 | return containerId |
| 436 | } |
| 437 | |
| 438 | // 缓存git 用户名、密码 |
| 439 | func remoteContainerCredentialCache(sshRemote common.SSHRemote, containerId string, workspaceInfo workspace.WorkspaceInfo) { |
no test coverage detected