Go updated to 1.12.9
[ta/caas-metrics.git] / SPECS / caas-custom_metrics.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 custom_metrics
16 %define RPM_NAME caas-%{COMPONENT}
17 %define RPM_MAJOR_VERSION 0.5.0
18 %define RPM_MINOR_VERSION 2
19 %define go_version 1.12.9
20 %define DEP_MAN_VERSION 0.5.0
21 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION}
22
23 Name:           %{RPM_NAME}
24 Version:        %{RPM_MAJOR_VERSION}
25 Release:        %{RPM_MINOR_VERSION}%{?dist}
26 Summary:        Containers as a Service Custom Metrics component
27 License:        %{_platform_license} and Apache License
28 URL:            https://github.com/DirectXMan12/k8s-prometheus-adapter
29 BuildArch:      x86_64
30 Vendor:         %{_platform_vendor} and DirectXMan12/k8s-prometheus-adapter unmodified
31 Source0:        %{name}-%{version}.tar.gz
32
33 Requires: docker-ce >= 18.09.2, rsync
34 BuildRequires: docker-ce-cli >= 18.09.2, xz
35
36 %description
37 This RPM contains the custom metrics container image for the CaaS subsystem.
38
39 %prep
40 %autosetup
41
42 %build
43 docker build \
44   --network=host \
45   --no-cache \
46   --force-rm \
47   --build-arg HTTP_PROXY="${http_proxy}" \
48   --build-arg HTTPS_PROXY="${https_proxy}" \
49   --build-arg NO_PROXY="${no_proxy}" \
50   --build-arg http_proxy="${http_proxy}" \
51   --build-arg https_proxy="${https_proxy}" \
52   --build-arg no_proxy="${no_proxy}" \
53   --build-arg CUSTOM_METRICS_VERSION="%{RPM_MAJOR_VERSION}" \
54   --build-arg go_version="%{go_version}" \
55   --tag %{COMPONENT}:%{IMAGE_TAG} \
56   %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build/%{COMPONENT}/
57
58 mkdir -p %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/
59
60 docker save %{COMPONENT}:%{IMAGE_TAG} | xz -z -T2 > %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/%{COMPONENT}:%{IMAGE_TAG}.tar
61
62 docker rmi -f %{COMPONENT}:%{IMAGE_TAG}
63
64 %install
65 mkdir -p %{buildroot}/%{_caas_container_tar_path}/
66 rsync -av %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save/%{COMPONENT}:%{IMAGE_TAG}.tar %{buildroot}/%{_caas_container_tar_path}/
67
68 %files
69 %{_caas_container_tar_path}/%{COMPONENT}:%{IMAGE_TAG}.tar
70
71 %preun
72
73 %post
74
75 %postun
76
77 %clean
78 rm -rf ${buildroot}
79