Require nonblank notification identities

This commit is contained in:
2026-08-13 00:21:20 +00:00
parent 706086e3de
commit 1d3ea64541
6 changed files with 40 additions and 4 deletions

View File

@@ -78,7 +78,14 @@ var distributorBatchIdempotencyTemplateVariables = map[string]struct{}{
var distributorBatchPipelineTemplateVariables = distributorBatchTemplateVariables
func RenderDistributorBundleID(template string, values DistributorTemplateValues) (string, error) {
return renderDistributorTemplate("notify.distributor.bundle_id_template", template, values, distributorTemplateVariables)
rendered, err := renderDistributorTemplate("notify.distributor.bundle_id_template", template, values, distributorTemplateVariables)
if err != nil {
return "", err
}
if strings.TrimSpace(rendered) == "" {
return "", fmt.Errorf("notify.distributor.bundle_id_template renders an empty bundle id")
}
return rendered, nil
}
func RenderDistributorPipelineID(template string, values DistributorTemplateValues) (string, error) {
@@ -93,7 +100,14 @@ func RenderDistributorPipelineID(template string, values DistributorTemplateValu
}
func RenderDistributorIdempotencyKey(template string, values DistributorTemplateValues) (string, error) {
return renderDistributorTemplate("notify.distributor.idempotency_key_template", template, values, distributorIdempotencyTemplateVariables)
rendered, err := renderDistributorTemplate("notify.distributor.idempotency_key_template", template, values, distributorIdempotencyTemplateVariables)
if err != nil {
return "", err
}
if strings.TrimSpace(rendered) == "" {
return "", fmt.Errorf("notify.distributor.idempotency_key_template renders an empty idempotency key")
}
return rendered, nil
}
func RenderDistributorBatchBundleID(template string, values DistributorBatchTemplateValues) (string, error) {