getExistingSecretsInRepo checks which secrets exist in the repository
(repoSlug string)
| 498 | |
| 499 | // getExistingSecretsInRepo checks which secrets exist in the repository |
| 500 | func getExistingSecretsInRepo(repoSlug string) (map[string]struct { |
| 501 | }, error) { |
| 502 | engineSecretsLog.Printf("Checking existing secrets for repo: %s", repoSlug) |
| 503 | |
| 504 | existingSecrets := make(map[string]struct { |
| 505 | }) |
| 506 | |
| 507 | // List secrets from repository |
| 508 | output, err := workflow.RunGHCombined("Checking secrets...", "secret", "list", "--repo", repoSlug) |
| 509 | if err != nil { |
| 510 | engineSecretsLog.Printf("Could not list secrets for %s: %v", repoSlug, err) |
| 511 | return existingSecrets, err |
| 512 | } |
| 513 | |
| 514 | // Check for all known engine secrets |
| 515 | secretNames := constants.GetAllEngineSecretNames() |
| 516 | |
| 517 | outputStr := string(output) |
| 518 | for _, name := range secretNames { |
| 519 | if stringContainsSecretName(outputStr, name) { |
| 520 | existingSecrets[name] = struct { |
| 521 | }{} |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | return existingSecrets, nil |
| 526 | } |
| 527 | |
| 528 | // GetEngineSecretNameAndValue returns the secret name and value for an engine. |
| 529 | // It checks if the secret exists in the repository and retrieves the value from environment if needed. |
no test coverage detected