145 lines
4.7 KiB
YAML
145 lines
4.7 KiB
YAML
---
|
|
# 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: Create distutils configuration file with index mirror
|
|
ini_file:
|
|
dest: "~/.pydistutils.cfg"
|
|
section: easy_install
|
|
option: index_url
|
|
value: "{{ repo_build_pip_default_index }}"
|
|
when: repo_build_pip_default_index is defined
|
|
|
|
- name: Download requirement pip sources
|
|
shell: >-
|
|
set -o pipefail;
|
|
yes i | {{ repo_build_bin }}/pip install
|
|
--timeout {{ repo_build_timeout }}
|
|
--download {{ repo_build_output }}
|
|
--no-binary :all:
|
|
--constraint {{ repo_build_release_path }}/requirements_constraints.txt
|
|
--index-url {{ repo_build_pip_default_index }}
|
|
--trusted-host {{ repo_build_pip_default_index | netloc_no_port }}
|
|
{% 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 %}
|
|
--requirement {{ repo_build_release_path }}/requirements.txt
|
|
{{ pip_install_options }}
|
|
2>&1 | ts > /var/log/repo/source_download.log
|
|
args:
|
|
executable: "/bin/bash"
|
|
when: repo_build_store_pip_sources | bool
|
|
|
|
- name: Create OpenStack-Ansible requirement wheels
|
|
shell: >-
|
|
set -o pipefail;
|
|
{{ repo_build_bin }}/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 %}
|
|
--index-url {{ repo_build_pip_default_index }}
|
|
--trusted-host {{ repo_build_pip_default_index | netloc_no_port }}
|
|
{% 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 }}
|
|
--requirement {{ repo_build_release_path }}/requirements.txt
|
|
{{ pip_install_options }}
|
|
2>&1 | ts > /var/log/repo/wheel_build.log
|
|
args:
|
|
executable: "/bin/bash"
|
|
tags:
|
|
- skip_ansible_lint
|
|
|
|
- name: Register os-release files
|
|
find:
|
|
file_type: any
|
|
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: 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
|