This commit is contained in:
Calvinaud 2025-05-21 07:38:13 +02:00 committed by GitHub
commit 455d46ee42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 10 deletions

View File

@ -962,11 +962,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
}
@ -977,10 +983,16 @@ 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 {
@ -988,6 +1000,8 @@ func (c *chaosHubService) SyncDefaultChaosHubs() {
"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

View File

@ -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"`