alertmanager icon indicating copy to clipboard operation
alertmanager copied to clipboard

Support templating in webhook url fields

Open waltherlee opened this issue 2 months ago • 2 comments

It's an old thread, but there's been some discussion here about supporting templating in webhook url fields: https://github.com/prometheus/alertmanager/issues/684

The issue was closed in 2017 because the alertmanager didn't support templating for any http/url fields, but there're some examples where it does support it now, for example SlackAction.URL and PushoverConfig.URL, so I think we can re-evaluate adding support for this.

There's some good use cases described by others in the thread since it was closed.

This change adds templating to the fields. Existing tests already check that secret URL is still not exposed.

waltherlee avatar Dec 05 '25 04:12 waltherlee

Sure, I can add the change for those too and some tests. Thanks Solomon

waltherlee avatar Dec 05 '25 23:12 waltherlee

The change from SecretURL to Secret was breaking some tests and validations, so I created a new SecretTemplURL to keep all the existing checks at config-level for URLs without templating.

I added tests for templated urls in webhook but won't change the other URL fields from other configs in this PR to keep it small. I'll send a second one with just the switch to SecretTemplURL.

waltherlee avatar Dec 08 '25 02:12 waltherlee