This repository has been archived by the owner on Jun 26, 2020. It is now read-only.
/
repo_build_wheels.yml
129 lines (116 loc) · 4.7 KB
/
repo_build_wheels.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
# Copyright 2015, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Ensure that temporary folders from previous build failures are absent
file:
path: "{{ item }}"
state: "absent"
with_items:
- "{{ repo_build_dir }}"
- "{{ repo_build_output }}"
- name: Create temporary folders
file:
path: "{{ item }}"
state: directory
owner: "{{ repo_build_service_user_name }}"
with_items:
- "{{ repo_build_dir }}"
- "{{ repo_build_output }}"
- name: Download requirement pip sources
shell: >
yes i | pip install --timeout {{ repo_build_timeout }}
--download {{ repo_build_output }}
--no-binary :all:
--constraint {{ repo_build_release_path }}/requirements_constraints.txt
{% if repo_build_pip_default_index is defined %}
--index-url {{ repo_build_pip_default_index }}
--trusted-host {{ repo_build_pip_default_index | netloc_no_port }}
{% endif -%}
{% if repo_build_pip_extra_indexes is defined %}
--extra-index-url {{ repo_build_pip_extra_indexes | join(' --extra-index-url ') }}
--trusted-host {{ repo_build_pip_extra_indexes | map('netloc_no_port') | join(' --trusted-host ') }}
{% endif -%}
--log /var/log/repo/repo_builder.log
--requirement {{ repo_build_release_path }}/requirements.txt
when: repo_build_store_pip_sources | bool
- name: Create OpenStack-Ansible requirement wheels
command: >
pip wheel --timeout {{ repo_build_timeout }}
--wheel-dir {{ repo_build_output }}
--find-links {{ repo_build_global_links_path }}
--find-links {{ repo_build_output }}
--constraint {{ repo_build_release_path }}/requirements_constraints.txt
{% if repo_build_pip_no_binary is defined %}--no-binary {{ repo_build_pip_no_binary | join(' --no-binary ') }}{% endif %}
{% if repo_build_pip_default_index is defined %}--index-url {{ repo_build_pip_default_index }}
--trusted-host {{ repo_build_pip_default_index | netloc_no_port }}{% endif %}
{% if repo_build_pip_extra_indexes is defined %}--extra-index-url {{ repo_build_pip_extra_indexes | join(' --extra-index-url ') }}
--trusted-host {{ repo_build_pip_extra_indexes | map('netloc_no_port') | join(' --trusted-host ') }}{% endif %}
--build {{ repo_build_dir }}
--log /var/log/repo/repo_builder.log
--requirement {{ repo_build_release_path }}/requirements.txt
{{ pip_install_options }}
changed_when: false
- name: Register os-release files
find:
paths: "{{ repo_build_release_path }}"
patterns:
- "*{{ ansible_architecture | lower }}.whl"
- "*none-any.whl"
register: os_release_files
- name: Ensure os-release files are cleaned up
file:
path: "{{ item['path'] }}"
state: "absent"
with_items: "{{ os_release_files.files }}"
- name: Index built wheels
find:
paths: "{{ repo_build_output }}"
register: built_wheels
- name: Create release process script
template:
src: "op-release-script.sh.j2"
dest: "/opt/op-release-script.sh"
mode: "0755"
- name: Run release process script
shell: "/opt/op-release-script.sh"
args:
executable: "/bin/bash"
changed_when: false
# This task requires the use of the shell module, so we skip lint
# to avoid:
# ANSIBLE0013 Use shell only when shell functionality is required
tags:
- skip_ansible_lint
- name: Create absolute requirements
template:
src: "requirements_absolute_requirements.txt.j2"
dest: "{{ repo_build_release_path }}/requirements_absolute_requirements.txt"
- name: Copy get-pip script into release folder
copy:
src: "/opt/get-pip.py"
dest: "{{ repo_build_release_path }}/"
remote_src: yes
- name: Clean up temporary build folders to save space
file:
path: "{{ item }}"
state: "absent"
with_items:
- "{{ repo_build_dir }}"
- "{{ repo_build_output }}"
- name: Disable the wheel build requirement now that it is complete
ini_file:
dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: repo_build
option: need_wheel_build
value: False