Dynamic provisioner update
[ta/caas-storage.git] / SPECS / dynamic_local_pv_provisioner.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 dynamic_local_pv_provisioner
16 %define RPM_NAME caas-%{COMPONENT}
17 %define RPM_MAJOR_VERSION 0.1.0
18 %define RPM_MINOR_VERSION 1
19 %define go_version 1.12.10
20 %define DEPENDENCY_MANAGER_VERSION 0.5.4
21 %define DYNAMIC_LOCAL_PV_PROVISIONER_VERSION bad28e8e568a892e7d92050d34bbba4a24671462
22 %define IMAGE_TAG %{RPM_MAJOR_VERSION}-%{RPM_MINOR_VERSION}
23 %define docker_build_dir %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-build
24 %define docker_save_dir %{_builddir}/%{RPM_NAME}-%{RPM_MAJOR_VERSION}/docker-save
25
26 Name:           %{RPM_NAME}
27 Version:        %{RPM_MAJOR_VERSION}
28 Release:        %{RPM_MINOR_VERSION}%{?dist}
29 Summary:        Containers as a Service %{COMPONENT} component
30 License:        %{_platform_license} and GNU General Public License v2.0 only and MIT license and BSD 3-clause New or Revised License and MIT License and Curl License and BSD
31 URL:            https://github.com/nokia/dynamic-local-pv-provisioner
32 BuildArch:      %{_arch}
33 Vendor:         %{_platform_vendor} and nokia/dynamic-local-pv-provisioner unmodified
34 Source0:        %{name}-%{version}.tar.gz
35
36 Requires: docker-ce >= 18.09.2, rsync
37 BuildRequires: docker-ce-cli >= 18.09.2, xz
38
39 %description
40 This rpm contains the dynamic local pv provisioner container for caas subsystem.
41
42 %prep
43 %autosetup
44
45 %build
46 docker build \
47   --network=host \
48   --no-cache \
49   --force-rm \
50   --build-arg HTTP_PROXY="${http_proxy}" \
51   --build-arg HTTPS_PROXY="${https_proxy}" \
52   --build-arg NO_PROXY="${no_proxy}" \
53   --build-arg http_proxy="${http_proxy}" \
54   --build-arg https_proxy="${https_proxy}" \
55   --build-arg no_proxy="${no_proxy}" \
56   --build-arg DYNAMIC_LOCAL_PV_PROVISIONER_VERSION="%{DYNAMIC_LOCAL_PV_PROVISIONER_VERSION}" \
57   --build-arg go_version="%{go_version}" \
58   --build-arg DEPENDENCY_MANAGER_VERSION="%{DEPENDENCY_MANAGER_VERSION}" \
59   --tag %{COMPONENT}:%{IMAGE_TAG} \
60   %{docker_build_dir}/%{COMPONENT}/
61 mkdir -p %{docker_save_dir}/
62 docker save %{COMPONENT}:%{IMAGE_TAG} | xz -z -T2 > %{docker_save_dir}/%{COMPONENT}:%{IMAGE_TAG}.tar
63 docker rmi %{COMPONENT}:%{IMAGE_TAG}
64
65 %install
66 mkdir -p %{buildroot}/%{_caas_container_tar_path}
67 rsync -av %{docker_save_dir}/%{COMPONENT}:%{IMAGE_TAG}.tar %{buildroot}/%{_caas_container_tar_path}/
68
69 %files
70 %{_caas_container_tar_path}/%{COMPONENT}:%{IMAGE_TAG}.tar
71
72 %preun
73
74 %post
75
76 %postun
77
78 %clean
79 rm -rf ${buildroot}
80