Update versions
[ta/caas-metrics.git] / SPECS / caas-prometheus.spec
1 # Copyright 2019 Nokia
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 %define COMPONENT prometheus
16 %define RPM_NAME caas-%{COMPONENT}
17 %define RPM_MAJOR_VERSION 2.13.1
18 %define RPM_MINOR_VERSION 0
19 %define go_version 1.13.1
20 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION}
21
22 Name:           %{RPM_NAME}
23 Version:        %{RPM_MAJOR_VERSION}
24 Release:        %{RPM_MINOR_VERSION}%{?dist}
25 Summary:        Containers as a Service Prometheus component
26 License:        %{_platform_license} and BSD and Apache License and MIT license and Mozilla Public License and Lesser General Public License and GNU General Public License v2.0 only
27 URL:            https://github.com/prometheus/prometheus
28 BuildArch:      %{_arch}
29 Vendor:         %{_platform_vendor} and prometheus/prometheus unmodified
30 Source0:        %{name}-%{version}.tar.gz
31
32 Requires: docker-ce >= 18.09.2, rsync
33 BuildRequires: docker-ce-cli >= 18.09.2, xz
34
35 %description
36 This RPM contains the prometheus container image for the CaaS subsystem.
37
38 %prep
39 %autosetup
40
41 %build
42 docker build \
43   --network=host \
44   --no-cache \
45   --force-rm \
46   --build-arg HTTP_PROXY="${http_proxy}" \
47   --build-arg HTTPS_PROXY="${https_proxy}" \
48   --build-arg NO_PROXY="${no_proxy}" \
49   --build-arg http_proxy="${http_proxy}" \
50   --build-arg https_proxy="${https_proxy}" \
51   --build-arg no_proxy="${no_proxy}" \
52   --build-arg PROMETHEUS_VERSION="%{RPM_MAJOR_VERSION}" \
53   --build-arg go_version="%{go_version}" \
54   --tag %{COMPONENT}:%{IMAGE_TAG} \
55   %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build/%{COMPONENT}/
56
57 mkdir -p %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/
58
59 docker save %{COMPONENT}:%{IMAGE_TAG} | xz -z -T2 > %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/%{COMPONENT}:%{IMAGE_TAG}.tar
60
61 docker rmi -f %{COMPONENT}:%{IMAGE_TAG}
62
63 %install
64 mkdir -p %{buildroot}/%{_caas_container_tar_path}/
65 rsync -av %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/%{COMPONENT}:%{IMAGE_TAG}.tar %{buildroot}/%{_caas_container_tar_path}/
66
67 %files
68 %{_caas_container_tar_path}/%{COMPONENT}:%{IMAGE_TAG}.tar
69
70 %preun
71
72 %post
73
74 %postun
75
76 %clean
77 rm -rf ${buildroot}