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
32 changes: 23 additions & 9 deletions chaoscenter/graphql/server/pkg/chaoshub/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -963,11 +963,17 @@ func (c *chaosHubService) GetChaosHubStats(ctx context.Context, projectID string

func (c *chaosHubService) listDefaultHubs() *model.ChaosHub {
defaultHubs := &model.ChaosHub{
ID: DefaultHubID,
Name: "Litmus ChaosHub",
RepoURL: utils.Config.DefaultHubGitURL,
RepoBranch: utils.Config.DefaultHubBranchName,
IsDefault: true,
ID: DefaultHubID,
Name: utils.Config.DefaultHubName,
RepoURL: utils.Config.DefaultHubGitURL,
RepoBranch: utils.Config.DefaultHubBranchName,
IsPrivate: utils.Config.DefaultHubIsPrivate,
AuthType: model.AuthType(utils.Config.DefaultHubAuthType),
Token: &utils.Config.DefaultHubToken,
UserName: &utils.Config.DefaultHubUserName,
Password: &utils.Config.DefaultHubPassword,
SSHPrivateKey: &utils.Config.DefaultHubSshPrivateKey,
IsDefault: true,
}
return defaultHubs
}
Expand All @@ -978,17 +984,25 @@ func (c *chaosHubService) SyncDefaultChaosHubs() {
defaultHub := c.listDefaultHubs()

chartsInput := model.CloningInput{
Name: defaultHub.Name,
RepoURL: defaultHub.RepoURL,
RepoBranch: defaultHub.RepoBranch,
IsDefault: true,
Name: defaultHub.Name,
RepoURL: defaultHub.RepoURL,
RepoBranch: defaultHub.RepoBranch,
IsPrivate: defaultHub.IsPrivate,
AuthType: defaultHub.AuthType,
Token: defaultHub.Token,
UserName: defaultHub.UserName,
Password: defaultHub.Password,
SSHPrivateKey: defaultHub.SSHPrivateKey,
IsDefault: true,
}
err := chaosHubOps.GitSyncDefaultHub(chartsInput)
if err != nil {
log.WithFields(log.Fields{
"repoUrl": defaultHub.RepoURL,
"repoBranch": defaultHub.RepoBranch,
"hubName": defaultHub.Name,
"isPrivate": defaultHub.IsPrivate,
"AuthType": defaultHub.AuthType,
}).WithError(err).Error("failed to sync default chaos hubs")
}
// Syncing Completed
Expand Down
9 changes: 8 additions & 1 deletion chaoscenter/graphql/server/utils/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ type Configuration struct {
RestPort string `split_words:"true" default:"8080"`
GrpcPort string `split_words:"true" default:"8000"`
InfraCompatibleVersions string `required:"true" split_words:"true"`
DefaultHubGitURL string `required:"true" default:"https://github.com/litmuschaos/chaos-charts"`
GitUsername string `required:"true" split_words:"true" default:"litmus"`
DefaultHubName string `required:"true" split_words:"true" default:"Litmus ChaosHub"`
DefaultHubGitURL string `required:"true" default:"https://github.com/litmuschaos/chaos-charts"`
DefaultHubBranchName string `required:"true" split_words:"true"`
DefaultHubIsPrivate bool `required:"true" split_words:"true" default:"false"`
DefaultHubAuthType string `split_words:"true"`
DefaultHubToken string `split_words:"true"`
DefaultHubUserName string `split_words:"true"`
DefaultHubPassword string `split_words:"true"`
DefaultHubSshPrivateKey string `split_words:"true"`
CustomChaosHubPath string `split_words:"true" default:"/tmp/"`
DefaultChaosHubPath string `split_words:"true" default:"/tmp/default/"`
EnableGQLIntrospection string `split_words:"true" default:"false"`
Expand Down
Loading