Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/dev/preview/previewctl/cmd/ssh_vm.go
2500 views
1
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package cmd
6
7
import (
8
"github.com/sirupsen/logrus"
9
"github.com/spf13/cobra"
10
11
"github.com/gitpod-io/gitpod/previewctl/pkg/preview"
12
)
13
14
func newSSHPreviewCmd(logger *logrus.Logger) *cobra.Command {
15
cmd := &cobra.Command{
16
Use: "ssh",
17
Short: "SSH into a preview's Virtual Machine.",
18
RunE: func(cmd *cobra.Command, args []string) error {
19
err := preview.SSHPreview(branch)
20
if err != nil {
21
logger.WithFields(logrus.Fields{"err": err}).Fatal("Failed to SSH preview's VM.")
22
}
23
24
return err
25
},
26
}
27
28
return cmd
29
}
30
31