diff --git a/0001-use-local-promu.patch b/0001-use-local-promu.patch deleted file mode 100644 index 5424463dc6e7c5489e8854bd0a994229502ea1e6..0000000000000000000000000000000000000000 --- a/0001-use-local-promu.patch +++ /dev/null @@ -1,25 +0,0 @@ -From aff2dabb339e1b7a249ac60dd0b341a35210acc3 Mon Sep 17 00:00:00 2001 -From: yangzhao_kl -Date: Tue, 5 Sep 2023 15:52:42 +0800 -Subject: [PATCH] use local promu - ---- - Makefile.common | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/Makefile.common b/Makefile.common -index e372d34..52658d5 100644 ---- a/Makefile.common -+++ b/Makefile.common -@@ -195,7 +195,7 @@ common-unused: - @git diff --exit-code -- go.sum go.mod - - .PHONY: common-build --common-build: promu -+common-build: - @echo ">> building binaries" - $(PROMU) build --prefix $(PREFIX) $(PROMU_BINARIES) - --- -2.33.0 - diff --git a/alertmanager-0.27.0.tar.gz b/alertmanager-0.27.0.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..a05a16cfdb93bbaef75b3635de5495e7e91432c9 Binary files /dev/null and b/alertmanager-0.27.0.tar.gz differ diff --git a/vendor.tar.gz b/alertmanager-vendor.tar.gz similarity index 40% rename from vendor.tar.gz rename to alertmanager-vendor.tar.gz index 1cca14c26918fb97c20a14d86d24ab59b8ced02b..af063701c751c4345ec2a13134439bd6c2a9913b 100644 Binary files a/vendor.tar.gz and b/alertmanager-vendor.tar.gz differ diff --git a/alertmanager.spec b/alertmanager.spec index 2cb480261ece9ef8a75efb2742f024f7907c7042..caffd4ef13b9126ba8d6fb7936a974e3b08a55f0 100644 --- a/alertmanager.spec +++ b/alertmanager.spec @@ -1,19 +1,17 @@ %define debug_package %{nil} Name: alertmanager -Version: 0.26.0 -Release: 3 +Version: 0.27.0 +Release: 1 Summary: Prometheus Alertmanager. License: Apache-2.0 URL: https://github.com/prometheus/%{name} -Source0: https://github.com/prometheus/%{name}/archive/refs/tags/v%{version}.tar.gz +Source0: https://github.com/prometheus/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz Source1: %{name}.service Source2: %{name}.default Source3: %{name}.yml -Source4: vendor.tar.gz -Patch0: 0001-use-local-promu.patch -Patch1: backport-Fix-scheme-required-for-webhook-url-in-amtool.patch +Source4: %{name}-vendor.tar.gz BuildRequires: make BuildRequires: golang >= 1.18.0 @@ -31,20 +29,15 @@ takes care of silencing and inhibition of alerts. %prep %setup -q -n %{name}-%{version} -%patch 0 -p1 -%patch 1 -p1 tar -xzvf %{SOURCE4} %build -mkdir -p $(go env GOPATH)/bin/ -cp -n $(which promu) $(go env GOPATH)/bin/ - export GOFLAGS="-mod=vendor -buildmode=pie %ifarch riscv64 -gcflags=all=-d=wrapglobalmapctl=1 %endif " -make build +promu build %install mkdir -vp %{buildroot}%{_sharedstatedir}/prometheus @@ -81,6 +74,10 @@ exit 0 %dir %attr(755, prometheus, prometheus)%{_sharedstatedir}/prometheus %changelog +* Fri Jul 12 2024 jiangxinyu - 0.27.0-1 +- Update package to version 0.27.0 +- Microsoft Teams Integration: Introduced support for webhook_url_file + * Mon Jun 24 2024 jiangxinyu - 0.26.0-3 - Fix scheme required for webhook url in amtool diff --git a/backport-Fix-scheme-required-for-webhook-url-in-amtool.patch b/backport-Fix-scheme-required-for-webhook-url-in-amtool.patch deleted file mode 100644 index d4c8d4a53cd24123a5b7ba5521d3fa55923aafa5..0000000000000000000000000000000000000000 --- a/backport-Fix-scheme-required-for-webhook-url-in-amtool.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 6ce841ca22b4724b5ac40e501d4198a40a262ecc Mon Sep 17 00:00:00 2001 -From: George Robinson -Date: Tue, 5 Sep 2023 17:53:24 +0100 -Subject: [PATCH] Fix scheme required for webhook url in amtool (#3509) - -* Fix scheme required for webhook url in amtool - -This commit fixes issue #3505 where amtool would fail with -"error: scheme required for webhook url" when using amtool -with --alertmanager.url. - -The issue here is that UnmarshalYaml for WebhookConfig checks -if the scheme is present when c.URL is non-nil. However, -UnmarshalYaml for SecretURL returns a non-nil, default value -url.URL{} if the response from api/v2/status contains -as the webhook URL. - -Signed-off-by: George Robinson - -* Add test for config routes test - -Signed-off-by: George Robinson - ---------- - -Signed-off-by: George Robinson ---- - config/notifiers.go | 5 --- - test/cli/acceptance.go | 22 +++++++++++ - test/cli/acceptance/cli_test.go | 66 +++++++++++++++++++++++++++++++++ - 3 files changed, 88 insertions(+), 5 deletions(-) - -diff --git a/config/notifiers.go b/config/notifiers.go -index db86b1a2f1..2650db5f3b 100644 ---- a/config/notifiers.go -+++ b/config/notifiers.go -@@ -503,11 +503,6 @@ func (c *WebhookConfig) UnmarshalYAML(unmarshal func(interface{}) error) error { - if c.URL != nil && c.URLFile != "" { - return fmt.Errorf("at most one of url & url_file must be configured") - } -- if c.URL != nil { -- if c.URL.Scheme != "https" && c.URL.Scheme != "http" { -- return fmt.Errorf("scheme required for webhook url") -- } -- } - return nil - } - -diff --git a/test/cli/acceptance.go b/test/cli/acceptance.go -index a0bc09ac74..0229b6594f 100644 ---- a/test/cli/acceptance.go -+++ b/test/cli/acceptance.go -@@ -658,6 +658,28 @@ func (am *Alertmanager) UpdateConfig(conf string) { - } - } - -+func (am *Alertmanager) ShowRoute() ([]byte, error) { -+ return am.showRouteCommand() -+} -+ -+func (am *Alertmanager) showRouteCommand() ([]byte, error) { -+ amURLFlag := "--alertmanager.url=" + am.getURL("/") -+ args := []string{amURLFlag, "config", "routes", "show"} -+ cmd := exec.Command(amtool, args...) -+ return cmd.CombinedOutput() -+} -+ -+func (am *Alertmanager) TestRoute() ([]byte, error) { -+ return am.testRouteCommand() -+} -+ -+func (am *Alertmanager) testRouteCommand() ([]byte, error) { -+ amURLFlag := "--alertmanager.url=" + am.getURL("/") -+ args := []string{amURLFlag, "config", "routes", "test"} -+ cmd := exec.Command(amtool, args...) -+ return cmd.CombinedOutput() -+} -+ - func (am *Alertmanager) getURL(path string) string { - return fmt.Sprintf("http://%s%s%s", am.apiAddr, am.opts.RoutePrefix, path) - } -diff --git a/test/cli/acceptance/cli_test.go b/test/cli/acceptance/cli_test.go -index 3c4c835641..4d5f9bc1fd 100644 ---- a/test/cli/acceptance/cli_test.go -+++ b/test/cli/acceptance/cli_test.go -@@ -168,3 +168,69 @@ receivers: - t.Errorf("Incorrect number of silences queried, expected: %v, actual: %v", expectedSils, len(sils)) - } - } -+ -+func TestRoutesShow(t *testing.T) { -+ t.Parallel() -+ -+ conf := ` -+route: -+ receiver: "default" -+ group_by: [alertname] -+ group_wait: 1s -+ group_interval: 1s -+ repeat_interval: 1ms -+ -+receivers: -+- name: "default" -+ webhook_configs: -+ - url: 'http://%s' -+ send_resolved: true -+` -+ -+ at := NewAcceptanceTest(t, &AcceptanceOpts{ -+ Tolerance: 1 * time.Second, -+ }) -+ co := at.Collector("webhook") -+ wh := NewWebhook(co) -+ -+ amc := at.AlertmanagerCluster(fmt.Sprintf(conf, wh.Address()), 1) -+ require.NoError(t, amc.Start()) -+ defer amc.Terminate() -+ -+ am := amc.Members()[0] -+ _, err := am.ShowRoute() -+ require.NoError(t, err) -+} -+ -+func TestRoutesTest(t *testing.T) { -+ t.Parallel() -+ -+ conf := ` -+route: -+ receiver: "default" -+ group_by: [alertname] -+ group_wait: 1s -+ group_interval: 1s -+ repeat_interval: 1ms -+ -+receivers: -+- name: "default" -+ webhook_configs: -+ - url: 'http://%s' -+ send_resolved: true -+` -+ -+ at := NewAcceptanceTest(t, &AcceptanceOpts{ -+ Tolerance: 1 * time.Second, -+ }) -+ co := at.Collector("webhook") -+ wh := NewWebhook(co) -+ -+ amc := at.AlertmanagerCluster(fmt.Sprintf(conf, wh.Address()), 1) -+ require.NoError(t, amc.Start()) -+ defer amc.Terminate() -+ -+ am := amc.Members()[0] -+ _, err := am.TestRoute() -+ require.NoError(t, err) -+} diff --git a/v0.26.0.tar.gz b/v0.26.0.tar.gz deleted file mode 100644 index a0d9ab3f8941946be7246b212e26e97dda58a5b7..0000000000000000000000000000000000000000 Binary files a/v0.26.0.tar.gz and /dev/null differ