alertmanager/alertmanager.spec
guozhengxin e7f6a4141b update to v0.26.0
(cherry picked from commit 965909d4d75d6aae95e2e282f592b698f657034f)
2023-09-06 08:59:39 +08:00

100 lines
2.8 KiB
RPMSpec

%define debug_package %{nil}
Name: alertmanager
Version: 0.26.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
Source1: %{name}.service
Source2: %{name}.default
Source3: %{name}.yml
Source4: vendor.tar.gz
Patch0: 0001-use-local-promu.patch
BuildRequires: make
BuildRequires: golang >= 1.18.0
BuildRequires: promu
BuildRequires: systemd
%{?systemd_requires}
Requires(pre): shadow-utils
%description
The Alertmanager handles alerts sent by client applications such as the
Prometheus server. It takes care of deduplicating, grouping, and routing them to
the correct receiver integration such as email, PagerDuty, or OpsGenie. It also
takes care of silencing and inhibition of alerts.
%prep
%setup -q -n %{name}-%{version}
%patch0 -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"
make build
%install
mkdir -vp %{buildroot}%{_sharedstatedir}/prometheus
install -D -m 755 -vd %{buildroot}%{_bindir}
install -D -m 755 -vp alertmanager %{buildroot}%{_bindir}
install -D -m 755 -vp amtool %{buildroot}%{_bindir}
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
install -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/default/%{name}
install -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/prometheus/%{name}.yml
%pre
getent group prometheus >/dev/null || groupadd -r prometheus
getent passwd prometheus >/dev/null || \
useradd -r -g prometheus -d %{_sharedstatedir}/prometheus -s /sbin/nologin \
-c "Prometheus services" prometheus
exit 0
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
%files
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/prometheus/%{name}.yml
%{_bindir}/%{name}
%{_bindir}/amtool
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/default/%{name}
%dir %attr(755, prometheus, prometheus)%{_sharedstatedir}/prometheus
%changelog
* Tue Sep 5 2023 Zhengxin Guo <guozhengxin@kylinos.cn> - 0.26.0-1
- update to 0.26.0 to fix CVE-2023-40577
* Wed May 31 2023 Wenlong Zhang<zhangwenlong@loongson.cn> - 0.21.0-7
- update sys and net to support loong64
* Tue Mar 07 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 0.21.0-6
- Add strip and pie
* Fri Feb 03 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 0.21.0-5
- Add buildRequires systemd
* Sat Jan 29 2022 yangzhao <yangzhao1@kylinos.cn> - 0.21.0-4
- Build from source code
* Thu Aug 05 2021 herengui <herengui@uniontech.com> - 0.21.0-3
- Type: bugfix
- ID: #I4431I
- DESC: solve empty postun transaction issue.
* Tue Aug 11 2020 houjian <houjian@kylinos.cn> - 0.21.0-2
- Package init