Skip to content
George Robinson edited this page Feb 8, 2024 · 9 revisions

Purpose

This is our fork of the Alertmanager. Its purpose is to help us move forward with both the Grafana and Alertmanager development by testing out features we might need with a higher degree of urgency than upstream (prometheus/alertmanager).

It is not meant to be a replacement for upstream but more of an avenue that encourages us to explore and feel more comfortable with the Alertmanager codebase.

Update (sync with upstream) guide

When upgrading, we prefer to bring the main branch up to date and then re-add our changes to our top. For this to work cleanly, we need each feature that has not been upstreamed yet to be compacted into a single commit that you can then cherry-pick through a pull request once you've fast-forwarded main.

Let's go ahead and guide you step by step:

  1. Make sure your local copy of the main branch is up to date.
  2. Create a local copy of the main branch as backup by executing $ git checkout main and then $ git checkout -b main-backup.
  3. Create a branch for the current head of main by executing git checkout -b main-$(git rev-parse HEAD | head -c 7) and push it. This is required for Go modules, so older versions of Grafana can still be built.
  4. In https://github.com/grafana/prometheus-alertmanager, click the "Sync fork" and make sure you discard all commits. These commits should match 1:1 the number of features we have not upstreamed yet and should still be on their dedicated feature branches. Refer to the list of feature branches to get an understanding of what feature branches you'll need to re-introduce.
  5. Now that main is in sync with upstream, we want to introduce our changes 1 by 1.
  6. For each feature branch, re-create a pull request by cherry-picking the commit of the change into a new branch. Make sure to resolve conflicts as much as possible.
  7. Merge into main and ensure it is all squash into a single commit if there's more than one on the feature branch.
  8. You're done 🎉 - you can now delete your backup of the main branch with git branch -D main-backup

Active Feature Branches

Adding a new feature

When introducing a new feature that has not been upstreamed yet, please make sure to:

  1. You must introduce the whole feature via a single commit. You can spread the introduction of your feature across multiple commits if you'd like but please make sure that when merging the feature to main you introduce just a single commit. This enables a clean cherry-pick workflow later on.
  2. You must document the feature on the "active feature branches" section to let the next person know what kind of changes they should add when they update the fork next.
Clone this wiki locally