Keep tarball and release properties for release
[infra/stack/kubernetes.git] / playbooks / roles / package / tasks / main.yaml
1 ---
2 # ============LICENSE_START=======================================================
3 #  Copyright (C) 2019 The Nordix Foundation. All rights reserved.
4 # ================================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # SPDX-License-Identifier: Apache-2.0
18 # ============LICENSE_END=========================================================
19
20 - name: Prepare packaging
21   include_tasks: prepare-packaging.yaml
22
23 - name: Create folder to store dependencies for offline deployment
24   file:
25     path: "{{ offline_pkg_folder }}"
26     state: "{{ item }}"
27   with_items:
28     - absent
29     - directory
30
31 - name: Install packages on {{ ansible_os_family }}
32   include_tasks: "install-packages-{{ ansible_os_family }}.yml"
33
34 # TODO (fdegir): we need to switch to build with dib here
35 - name: Fetch operating system images for provisioning
36   include_tasks: dib.yaml
37
38 # collect apt packages
39 - name: Fetch operating system packages
40   include_tasks: "pkg-{{ ansible_os_family }}.yaml"
41
42 # clone git repositories
43 - name: Fetch git repositories
44   include_tasks: git.yaml
45
46 # download binaries
47 - name: Fetch binaries
48   include_tasks: binaries.yaml
49
50 # download pip packages
51 - name: Fetch pip python packages
52   include_tasks: pip.yaml
53
54 # fetch k8s container images
55 - name: Fetch container images
56   include_tasks: containers.yaml
57
58 # ensure we don't have leftovers
59 - name: Delete outdated files
60   file:
61     path: "{{ item }}"
62     state: absent
63   with_items:
64     - "{{ offline_pkg_file }}"
65     - "{{ offline_pkg_folder }}/install.sh"
66     - "{{ offline_installer_file }}"
67     - "/tmp/decompress.sh"
68
69 - name: Copy decompress and install scripts
70   copy:
71     src: "{{ item.src }}"
72     dest: "{{ item.dest }}"
73     mode: 0755
74   with_items:
75     - {src: "install.sh", dest: "{{ offline_pkg_folder }}/install.sh"}
76     - {src: "decompress.sh", dest: "/tmp/decompress.sh"}
77
78 # check if the packaging is run by release job by looking at /tmp/release.properties
79 - name: Check if /tmp/release.properties file exists
80   stat:
81     path: /tmp/release.properties
82   register: release_properties
83
84 # record repo shas in release.properties file if it exists and
85 # copy release.properties to tarball
86 - name: Record engine repo SHAs in release.properties
87   include_tasks: record-shas.yaml
88   when: release_properties.stat.exists
89
90 # create tarball
91 - name: Create engine installer file
92   script: build.sh
93   register: build_script
94
95 - name: Log build script output to console
96   debug:
97     msg: "{{ build_script.stdout_lines }}"
98
99 # vim: set ts=2 sw=2 expandtab: