Skip to content

Fix alertmanager reloading bug that removes user template files#7196

Merged
friedrichg merged 1 commit intocortexproject:masterfrom
CharlieTLe:cortex-alertmanager-stale-templates-bug
Jan 8, 2026
Merged

Fix alertmanager reloading bug that removes user template files#7196
friedrichg merged 1 commit intocortexproject:masterfrom
CharlieTLe:cortex-alertmanager-stale-templates-bug

Conversation

@CharlieTLe
Copy link
Copy Markdown
Member

What this PR does:

When the data_dir path is set to the default of data/, the path that Cortex uses to compare won't include the front leading /. This differs from safeTemplateFilepath which returns the fully-qualified path name that includes the front leading /. This will cause Cortex to delete the template files provided by the user on every other poll interval which causes inconsistent templating by the alertmanager.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Charlie Le <charlie_le@apple.com>
@CharlieTLe CharlieTLe force-pushed the cortex-alertmanager-stale-templates-bug branch from 505c5ed to d1cc2b1 Compare January 7, 2026 22:00
Copy link
Copy Markdown
Member

@SungJin1212 SungJin1212 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 8, 2026
@friedrichg friedrichg merged commit 8cd0727 into cortexproject:master Jan 8, 2026
72 of 77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/alertmanager lgtm This PR has been approved by a maintainer size/S type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants