Add warning for long secret names.
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Rich M 2023-09-27 18:58:07 +01:00
parent f18f0b6f82
commit 82bcaaa86f
1 changed files with 17 additions and 0 deletions

View File

@ -115,6 +115,13 @@ var LintRules = map[string][]LintRule{
HowToResolve: "upload your recipe to git.coopcloud.tech/coop-cloud/...",
Function: LintHasRecipeRepo,
},
{
Ref: "R014",
Level: "warn",
Description: "Long secret names",
HowToResolve: "Reduce the lenght of secret names to 12 characters.",
Function: LintSecretLengths,
},
},
"error": {
{
@ -401,6 +408,16 @@ func LintHasRecipeRepo(recipe recipe.Recipe) (bool, error) {
return true, nil
}
func LintSecretLengths(recipe recipe.Recipe) (bool, error) {
for name := range recipe.Config.Secrets {
if len(name) > 12 {
return false, fmt.Errorf("secret %s is longer than 12 characters", name)
}
}
return true, nil
}
func LintValidTags(recipe recipe.Recipe) (bool, error) {
recipeDir := path.Join(config.RECIPES_DIR, recipe.Name)