Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/components/ws-daemon/cmd/debug-run-initializer.go
2498 views
1
// Copyright (c) 2020 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
"context"
9
10
"github.com/gitpod-io/gitpod/common-go/log"
11
"github.com/gitpod-io/gitpod/content-service/api"
12
"github.com/gitpod-io/gitpod/content-service/pkg/storage"
13
"github.com/gitpod-io/gitpod/ws-daemon/pkg/content"
14
"github.com/spf13/cobra"
15
)
16
17
// debugRunInitializer represents the generate command
18
var debugRunInitializer = &cobra.Command{
19
Use: "run-initializer",
20
Short: "Runs the content initializer",
21
Args: cobra.ExactArgs(1),
22
RunE: func(cmd *cobra.Command, args []string) error {
23
dst := args[0]
24
log.WithField("dst", dst).Info("running content initializer")
25
_, err := content.RunInitializer(context.Background(), dst, &api.WorkspaceInitializer{
26
Spec: &api.WorkspaceInitializer_Git{
27
Git: &api.GitInitializer{
28
RemoteUri: "https://github.com/gitpod-io/gitpod.git",
29
TargetMode: api.CloneTargetMode_REMOTE_BRANCH,
30
CloneTaget: "refs/heads/main",
31
CheckoutLocation: "foo",
32
Config: &api.GitConfig{
33
Authentication: api.GitAuthMethod_NO_AUTH,
34
},
35
},
36
},
37
}, make(map[string]storage.DownloadInfo), content.RunInitializerOpts{})
38
return err
39
},
40
}
41
42
func init() {
43
debugCmd.AddCommand(debugRunInitializer)
44
}
45
46