diff --git a/pkg/lint/recipe.go b/pkg/lint/recipe.go index cae797f3..d41ffa78 100644 --- a/pkg/lint/recipe.go +++ b/pkg/lint/recipe.go @@ -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)