Updated the repo-build process
This commit changes the repo build play such that it no longer requires "yaprt". The intention here is to make the build process less of a blackbox, simpler, and faster. With recent improvements in OpenStack and PIP we're now able to do a lot more without the use of the "yaprt" tool. Repo building is now its own standalone role. This PR now reintroduces the repo-clone ability which is now made smarter. The repo-build process creates a manifest file which is used to provide the ability to sync exactly the contents of the tagged release. This will make repeatable deployments faster for downstream consumers. The repo-store-source.yml play was removed because it hasn't been used as the repo clone process is part of the main repo build process. DocImpact UpgradeImpact Change-Id: Icb0a4e3443491eb0242125ea59f8d5b50f89410b Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
e4b5bafe49
commit
975c232084
@ -14,9 +14,12 @@
|
||||
#
|
||||
# (c) 2015, Kevin Carter <kevin.carter@rackspace.com>
|
||||
|
||||
import os
|
||||
import re
|
||||
import urlparse
|
||||
import hashlib
|
||||
|
||||
from ansible import errors
|
||||
|
||||
"""Filter usage:
|
||||
|
||||
@ -108,6 +111,82 @@ def string_2_int(string):
|
||||
return int(hashed_name, 36) % 10240
|
||||
|
||||
|
||||
def pip_requirement_names(requirements):
|
||||
"""Return a ``str`` of requirement name and list of versions.
|
||||
:param requirement: Name of a requirement that may have versions within
|
||||
it. This will use the constant,
|
||||
VERSION_DESCRIPTORS.
|
||||
:type requirement: ``str``
|
||||
:return: ``str``
|
||||
"""
|
||||
|
||||
version_descriptors = "(>=|<=|>|<|==|~=|!=)"
|
||||
named_requirements = list()
|
||||
for requirement in requirements:
|
||||
requirement = requirement.split(';')[0]
|
||||
name = re.split(r'%s\s*' % version_descriptors, requirement)[0]
|
||||
if name and not name.startswith('#'):
|
||||
named_requirements.append(name.lower())
|
||||
|
||||
return sorted(set(named_requirements))
|
||||
|
||||
|
||||
def splitlines(string_with_lines):
|
||||
"""Return a ``list`` from a string with lines."""
|
||||
|
||||
return string_with_lines.splitlines()
|
||||
|
||||
|
||||
def filtered_list(list_one, list_two):
|
||||
|
||||
_list_one = set([i.lower() for i in list_one])
|
||||
_list_two = set([i.lower() for i in list_two])
|
||||
return list(_list_one-_list_two)
|
||||
|
||||
|
||||
def git_link_parse(repo):
|
||||
"""Return a dict containing the parts of a git repository.
|
||||
|
||||
:param repo: git repo string to parse.
|
||||
:type repo: ``str``
|
||||
:returns: ``dict``
|
||||
"""
|
||||
|
||||
if 'git+' in repo:
|
||||
_git_url = repo.split('git+', 1)[-1]
|
||||
else:
|
||||
_git_url = repo
|
||||
|
||||
if '@' in _git_url:
|
||||
url, branch = _git_url.split('@', 1)
|
||||
else:
|
||||
url = _git_url
|
||||
branch = 'master'
|
||||
|
||||
name = os.path.basename(url.rstrip('/'))
|
||||
_branch = branch.split('#')
|
||||
branch = _branch[0]
|
||||
|
||||
plugin_path = None
|
||||
# Determine if the package is a plugin type
|
||||
if len(_branch) > 1 and 'subdirectory=' in _branch[-1]:
|
||||
plugin_path = _branch[-1].split('subdirectory=')[-1].split('&')[0]
|
||||
|
||||
return {
|
||||
'name': name.split('.git')[0].lower(),
|
||||
'version': branch,
|
||||
'plugin_path': plugin_path,
|
||||
'url': url,
|
||||
'original': repo
|
||||
}
|
||||
|
||||
|
||||
def git_link_parse_name(repo):
|
||||
"""Return the name of a git repo."""
|
||||
|
||||
return git_link_parse(repo)['name']
|
||||
|
||||
|
||||
class FilterModule(object):
|
||||
"""Ansible jinja2 filters."""
|
||||
|
||||
@ -118,5 +197,10 @@ class FilterModule(object):
|
||||
'netloc': get_netloc,
|
||||
'netloc_no_port': get_netloc_no_port,
|
||||
'netorigin': get_netorigin,
|
||||
'string_2_int': string_2_int
|
||||
'string_2_int': string_2_int,
|
||||
'pip_requirement_names': pip_requirement_names,
|
||||
'splitlines': splitlines,
|
||||
'filtered_list': filtered_list,
|
||||
'git_link_parse': git_link_parse,
|
||||
'git_link_parse_name': git_link_parse_name
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ VERSION_DESCRIPTORS = ['>=', '<=', '==', '!=', '<', '>']
|
||||
|
||||
|
||||
REQUIREMENTS_FILE_TYPES = [
|
||||
'requirements.txt',
|
||||
'global-requirements.txt',
|
||||
'test-requirements.txt',
|
||||
'dev-requirements.txt',
|
||||
@ -44,6 +43,60 @@ BUILT_IN_PIP_PACKAGE_VARS = [
|
||||
]
|
||||
|
||||
|
||||
def git_pip_link_parse(repo):
|
||||
"""Return a tuple containing the parts of a git repository.
|
||||
|
||||
Example parsing a standard git repo:
|
||||
>>> git_pip_link_parse('git+https://github.com/username/repo@tag')
|
||||
('repo',
|
||||
'tag',
|
||||
None,
|
||||
'https://github.com/username/repo',
|
||||
'git+https://github.com/username/repo@tag')
|
||||
|
||||
Example parsing a git repo that uses an installable from a subdirectory:
|
||||
>>> git_pip_link_parse(
|
||||
... 'git+https://github.com/username/repo@tag#egg=plugin.name'
|
||||
... '&subdirectory=remote_path/plugin.name'
|
||||
... )
|
||||
('repo',
|
||||
'tag',
|
||||
'remote_path/plugin.name',
|
||||
'https://github.com/username/repo',
|
||||
'git+https://github.com/username/repo@tag#egg=plugin.name&'
|
||||
'subdirectory=remote_path/plugin.name')
|
||||
|
||||
:param repo: git repo string to parse.
|
||||
:type repo: ``str``
|
||||
:returns: ``tuple``
|
||||
"""
|
||||
|
||||
_git_url = repo.split('+')
|
||||
if len(_git_url) >= 2:
|
||||
_git_url = _git_url[1]
|
||||
else:
|
||||
_git_url = _git_url[0]
|
||||
|
||||
git_branch_sha = _git_url.split('@')
|
||||
if len(git_branch_sha) > 1:
|
||||
url, branch = git_branch_sha
|
||||
else:
|
||||
url = git_branch_sha[0]
|
||||
branch = 'master'
|
||||
|
||||
name = os.path.basename(url.rstrip('/'))
|
||||
_branch = branch.split('#')
|
||||
branch = _branch[0]
|
||||
|
||||
plugin_path = None
|
||||
# Determine if the package is a plugin type
|
||||
if len(_branch) > 1:
|
||||
if 'subdirectory' in _branch[-1]:
|
||||
plugin_path = _branch[1].split('subdirectory=')[1].split('&')[0]
|
||||
|
||||
return name.lower(), branch, plugin_path, url, repo
|
||||
|
||||
|
||||
class DependencyFileProcessor(object):
|
||||
def __init__(self, local_path):
|
||||
"""Find required files.
|
||||
@ -152,7 +205,7 @@ class DependencyFileProcessor(object):
|
||||
package = self.git_pip_install % (
|
||||
git_data['repo'], git_data['branch']
|
||||
)
|
||||
|
||||
package = '%s#egg=%s' % (package, git_pip_link_parse(package)[0].replace('-', '_'))
|
||||
git_data['fragments'] = loaded_yaml.get(
|
||||
'%s_git_install_fragments' % var_name.replace('.', '_')
|
||||
)
|
||||
@ -192,11 +245,15 @@ class DependencyFileProcessor(object):
|
||||
continue
|
||||
|
||||
for key, values in loaded_config.items():
|
||||
if key.endswith('git_repo'):
|
||||
self._process_git(
|
||||
loaded_yaml=loaded_config,
|
||||
git_item=key
|
||||
)
|
||||
# This conditional is set to ensure we're not processes git repos
|
||||
# from the defaults file which may conflict with what is being set
|
||||
# in the repo_packages files.
|
||||
if not '/defaults/main' in file_name:
|
||||
if key.endswith('git_repo'):
|
||||
self._process_git(
|
||||
loaded_yaml=loaded_config,
|
||||
git_item=key
|
||||
)
|
||||
|
||||
if [i for i in BUILT_IN_PIP_PACKAGE_VARS if i in key]:
|
||||
self.pip['py_package'].extend(values)
|
||||
@ -232,6 +289,10 @@ class LookupModule(object):
|
||||
if isinstance(terms, basestring):
|
||||
terms = [terms]
|
||||
|
||||
return_data = {
|
||||
'packages': list(),
|
||||
'remote_packages': list()
|
||||
}
|
||||
return_list = list()
|
||||
for term in terms:
|
||||
try:
|
||||
@ -248,27 +309,30 @@ class LookupModule(object):
|
||||
traceback.format_exc()
|
||||
)
|
||||
)
|
||||
else:
|
||||
return_data = {
|
||||
'packages': list(),
|
||||
'remote_packages': list()
|
||||
}
|
||||
for file_name in sorted(set(return_list)):
|
||||
is_url = file_name.startswith(('http:', 'https:', 'git+'))
|
||||
if is_url:
|
||||
if '@' not in file_name:
|
||||
return_data['packages'].append(file_name)
|
||||
else:
|
||||
return_data['remote_packages'].append(file_name)
|
||||
else:
|
||||
return_data['packages'].append(file_name)
|
||||
else:
|
||||
return_data['packages'] = ' '.join(
|
||||
['"%s"' % i for i in set(return_data['packages'])]
|
||||
)
|
||||
|
||||
return_data['remote_packages'] = ' '.join(
|
||||
['"%s"' % i for i in set(return_data['remote_packages'])]
|
||||
for item in sorted(set(return_list)):
|
||||
if item.startswith(('http:', 'https:', 'git+')):
|
||||
if '@' not in item:
|
||||
return_data['packages'].append(item)
|
||||
else:
|
||||
return_data['remote_packages'].append(item)
|
||||
else:
|
||||
return_data['packages'].append(item)
|
||||
else:
|
||||
return_data['packages'] = list(
|
||||
set([i.lower() for i in return_data['packages']])
|
||||
)
|
||||
return_data['remote_packages'] = list(
|
||||
set(return_data['remote_packages'])
|
||||
)
|
||||
keys = ['name', 'version', 'fragment', 'url', 'original']
|
||||
remote_package_parts = [
|
||||
dict(
|
||||
zip(
|
||||
keys, git_pip_link_parse(i)
|
||||
)
|
||||
) for i in return_data['remote_packages']
|
||||
]
|
||||
return_data['remote_package_parts'] = remote_package_parts
|
||||
|
||||
return [return_data]
|
||||
|
@ -1,5 +1,5 @@
|
||||
---
|
||||
# Copyright 2014, Rackspace US, Inc.
|
||||
# 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.
|
||||
@ -13,91 +13,28 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# The purpose here is to allow for the environment to update/build the
|
||||
# python wheel files from the CURRENT release, as set in the openstack_release
|
||||
# variable.
|
||||
- name: Build new repo packages for a given release
|
||||
hosts: repo_all[0]
|
||||
max_fail_percentage: 20
|
||||
gather_facts: false
|
||||
gather_facts: true
|
||||
user: root
|
||||
tasks:
|
||||
- name: Create a build report for all known packages within a release
|
||||
shell: |
|
||||
yaprt --quiet \
|
||||
create-report \
|
||||
--report-file {{ repo_service_home_folder }}/repo/reports/release-{{ openstack_release }}-report.json \
|
||||
--git-install-repos {{ item['remote_packages'] }} \
|
||||
--git-repo-path "{{ repo_service_home_folder }}/repo/openstackgit" \
|
||||
--packages {{ item['packages'] }}
|
||||
pre_tasks:
|
||||
- name: Load local packages
|
||||
debug:
|
||||
msg: "Loading Packages"
|
||||
with_py_pkgs: ../
|
||||
sudo: yes
|
||||
sudo_user: "{{ repo_service_user_name }}"
|
||||
register: local_packages
|
||||
tags:
|
||||
- repo-create-report
|
||||
|
||||
- name: Build all known python packages requirements
|
||||
shell: |
|
||||
yaprt --quiet \
|
||||
build-wheels \
|
||||
--report-file {{ repo_service_home_folder }}/repo/reports/release-{{ openstack_release }}-report.json \
|
||||
--storage-pool "{{ repo_service_home_folder }}/repo/pools" \
|
||||
--link-dir "{{ repo_service_home_folder }}/repo/os-releases/{{ openstack_release }}" \
|
||||
--pip-extra-link-dirs "{{ repo_service_home_folder }}/repo/links" \
|
||||
--pip-index "{{ repo_pip_default_index }}" \
|
||||
--pip-extra-index "https://pypi.python.org/simple/" \
|
||||
--pip-bulk-operation \
|
||||
--build-output "{{ repo_build_output }}" \
|
||||
--build-dir "{{ repo_build_dir }}" \
|
||||
--build-requirements \
|
||||
--git-repo-path "{{ repo_service_home_folder }}/repo/openstackgit" \
|
||||
--force-clean
|
||||
sudo: yes
|
||||
sudo_user: "{{ repo_service_user_name }}"
|
||||
- repo-clone-repos
|
||||
- repo-set-requirements
|
||||
- repo-get-global-requirements
|
||||
- repo-set-requirement-names
|
||||
- repo-set-requirement-names-filtered
|
||||
- repo-set-constraints
|
||||
- repo-build-constraints-file
|
||||
roles:
|
||||
- role: "repo_build"
|
||||
repo_build_release_tag: "{{ openstack_release }}"
|
||||
repo_build_pip_default_index: "https://rpc-repo.rackspace.com/pools"
|
||||
repo_build_pip_extra_index: "https://pypi.python.org/simple"
|
||||
tags:
|
||||
- repo-build-requirements
|
||||
|
||||
- name: Build all known python packages git sources
|
||||
shell: |
|
||||
yaprt --quiet \
|
||||
build-wheels \
|
||||
--report-file {{ repo_service_home_folder }}/repo/reports/release-{{ openstack_release }}-report.json \
|
||||
--storage-pool "{{ repo_service_home_folder }}/repo/pools" \
|
||||
--link-dir "{{ repo_service_home_folder }}/repo/os-releases/{{ openstack_release }}" \
|
||||
--pip-extra-link-dirs "{{ repo_service_home_folder }}/repo/links" \
|
||||
--pip-no-deps \
|
||||
--build-output "{{ repo_build_output }}" \
|
||||
--build-dir "{{ repo_build_dir }}" \
|
||||
--build-branches \
|
||||
--build-releases \
|
||||
--git-repo-path "{{ repo_service_home_folder }}/repo/openstackgit" \
|
||||
--force-clean
|
||||
sudo: yes
|
||||
sudo_user: "{{ repo_service_user_name }}"
|
||||
tags:
|
||||
- repo-build-git-sources
|
||||
|
||||
- name: Create html indexes
|
||||
shell: |
|
||||
yaprt --quiet \
|
||||
create-html-indexes \
|
||||
--repo-dir "{{ repo_service_home_folder }}/repo" \
|
||||
--dir-exclude "{{ repo_service_home_folder }}/repo/openstackgit"
|
||||
sudo: yes
|
||||
sudo_user: "{{ repo_service_user_name }}"
|
||||
tags:
|
||||
- repo-html-indexes
|
||||
|
||||
- name: Store all git source
|
||||
shell: |
|
||||
yaprt --quiet \
|
||||
store-repos \
|
||||
--report-file {{ repo_service_home_folder }}/repo/reports/release-{{ openstack_release }}-report.json \
|
||||
--git-repo-path "{{ repo_service_home_folder }}/repo/openstackgit"
|
||||
sudo: yes
|
||||
sudo_user: "{{ repo_service_user_name }}"
|
||||
tags:
|
||||
- repo-store-git-sources
|
||||
vars:
|
||||
repo_build_dir: "/tmp/openstack-builder"
|
||||
repo_build_output: "/tmp/openstack-wheel-output"
|
||||
- "repo-build"
|
||||
|
54
playbooks/repo-clone-mirror.yml
Normal file
54
playbooks/repo-clone-mirror.yml
Normal file
@ -0,0 +1,54 @@
|
||||
---
|
||||
# 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.
|
||||
|
||||
# This play was built to seed an environment with packages that may be used
|
||||
# from within the environment as found from a given mirror_source_host.
|
||||
# Currently the mirror source host is set to the Rackspace build servers but
|
||||
# could be targeted to wherever you'd like.
|
||||
|
||||
- name: Cloning the upstream repo mirror
|
||||
hosts: repo_all[0]
|
||||
gather_facts: false
|
||||
user: root
|
||||
tasks:
|
||||
- name: download MANIFEST.in
|
||||
get_url:
|
||||
url: "{{ repo_upstream_manifest_url }}"
|
||||
dest: /tmp/MANIFEST.in
|
||||
- name: Sync the upstream repo(s)
|
||||
shell: |
|
||||
{{ rsync_commands }} \
|
||||
{{ rsync_flags }} \
|
||||
--files-from=/tmp/MANIFEST.in \
|
||||
{{ repo_upstream_url | netloc }}::{{ mirror_name }} {{ mirror_path }}
|
||||
sudo: yes
|
||||
sudo_user: "{{ repo_service_user_name }}"
|
||||
- name: Sync supporting directories
|
||||
shell: |
|
||||
{{ rsync_commands }} \
|
||||
{{ rsync_flags }} \
|
||||
{{ repo_upstream_url | netloc }}::{{ mirror_name }}/{{ item }} {{ mirror_path }}
|
||||
with_items:
|
||||
- container_images
|
||||
- downloads
|
||||
- openstackgit
|
||||
vars:
|
||||
rsync_commands: rsync
|
||||
rsync_flags: "-avzlHAX"
|
||||
mirror_path: "{{ repo_service_home_folder }}/repo"
|
||||
mirror_name: "openstack_mirror"
|
||||
repo_upstream_url: "https://rpc-repo.rackspace.com"
|
||||
repo_upstream_manifest_url: "{{ repo_upstream_url }}/os-releases/{{ openstack_release }}/MANIFEST.in"
|
||||
repo_service_user_name: nginx
|
@ -58,11 +58,17 @@
|
||||
roles:
|
||||
- { role: "repo_server", tags: [ "repo-server" ] }
|
||||
- role: "rsyslog_client"
|
||||
rsyslog_client_log_rotate_file: repo_log_rotate
|
||||
rsyslog_client_log_rotate_file: repo_nginx_log_rotate
|
||||
rsyslog_client_log_dir: "/var/log/nginx"
|
||||
rsyslog_client_log_files:
|
||||
- /var/www/repo_builder.log
|
||||
- /var/log/rsyncd.log
|
||||
rsyslog_client_config_name: "99-repo-nginx-rsyslog-client.conf"
|
||||
tags:
|
||||
- "repo-nginx-rsyslog-client"
|
||||
- "rsyslog-client"
|
||||
- role: "rsyslog_client"
|
||||
rsyslog_client_log_rotate_file: repo_log_rotate
|
||||
rsyslog_client_log_dir: "/var/log/repo"
|
||||
rsyslog_client_config_name: "99-repo-rsyslog-client.conf"
|
||||
tags:
|
||||
- "repo-rsyslog-client"
|
||||
|
@ -1,32 +0,0 @@
|
||||
---
|
||||
# Copyright 2014, 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.
|
||||
|
||||
# The purpose here is to allow for the environment to update/build the
|
||||
# python wheel files from the CURRENT release, as set in the openstack_release
|
||||
# variable.
|
||||
- name: Build new repo packages for a given release
|
||||
hosts: repo_all[0]
|
||||
max_fail_percentage: 20
|
||||
gather_facts: false
|
||||
user: root
|
||||
tasks:
|
||||
- name: Store git repos
|
||||
shell: |
|
||||
yaprt store-repos --report-file {{ repo_service_home_folder }}/repo/reports/release-{{ openstack_release }}-report.json \
|
||||
--git-repo-path "{{ repo_service_home_folder }}/repo/openstackgit"
|
||||
sudo: yes
|
||||
sudo_user: "{{ repo_service_user_name }}"
|
||||
tags:
|
||||
- repo-store-git
|
102
playbooks/roles/repo_build/CONTRIBUTING.rst
Normal file
102
playbooks/roles/repo_build/CONTRIBUTING.rst
Normal file
@ -0,0 +1,102 @@
|
||||
OpenStack repo build
|
||||
####################
|
||||
:tags: openstack, repo, build, cloud, ansible
|
||||
:category: \*nix
|
||||
|
||||
contributor guidelines
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Filing Bugs
|
||||
-----------
|
||||
|
||||
Bugs should be filed on Launchpad, not GitHub: "https://bugs.launchpad.net/openstack-ansible"
|
||||
|
||||
|
||||
When submitting a bug, or working on a bug, please ensure the following
|
||||
criteria are met:
|
||||
|
||||
* The description clearly states or describes the original problem or root
|
||||
cause of the problem.
|
||||
* Include historical information on how the problem was identified.
|
||||
* Any relevant logs are included.
|
||||
* The provided information should be totally self-contained. External access to
|
||||
web services/sites should not be needed.
|
||||
* Steps to reproduce the problem if possible.
|
||||
|
||||
|
||||
Submitting Code
|
||||
---------------
|
||||
|
||||
Changes to the project should be submitted for review via the Gerrit tool,
|
||||
following the workflow documented at:
|
||||
"http://docs.openstack.org/infra/manual/developers.html#development-workflow"
|
||||
|
||||
Pull requests submitted through GitHub will be ignored and closed without
|
||||
regard.
|
||||
|
||||
|
||||
Extra
|
||||
-----
|
||||
|
||||
Tags:
|
||||
If it's a bug that needs fixing in a branch in addition to Master, add a
|
||||
'\<release\>-backport-potential' tag (eg ``juno-backport-potential``).
|
||||
There are predefined tags that will autocomplete.
|
||||
|
||||
Status:
|
||||
Please leave this alone, it should be New till someone triages the issue.
|
||||
|
||||
Importance:
|
||||
Should only be touched if it is a Blocker/Gating issue. If it is, please
|
||||
set to High, and only use Critical if you have found a bug that can take
|
||||
down whole infrastructures.
|
||||
|
||||
|
||||
Style guide
|
||||
-----------
|
||||
|
||||
When creating tasks and other roles for use in Ansible please create then using
|
||||
the YAML dictionary format.
|
||||
|
||||
Example YAML dictionary format:
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: The name of the tasks
|
||||
module_name:
|
||||
thing1: "some-stuff"
|
||||
thing2: "some-other-stuff"
|
||||
tags:
|
||||
- some-tag
|
||||
- some-other-tag
|
||||
|
||||
|
||||
Example **NOT** in YAML dictionary format:
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: The name of the tasks
|
||||
module_name: thing1="some-stuff" thing2="some-other-stuff"
|
||||
tags:
|
||||
- some-tag
|
||||
- some-other-tag
|
||||
|
||||
|
||||
Usage of the ">" and "|" operators should be limited to Ansible conditionals
|
||||
and command modules such as the ansible ``shell`` module.
|
||||
|
||||
|
||||
Issues
|
||||
------
|
||||
|
||||
When submitting an issue, or working on an issue please ensure the following
|
||||
criteria are met:
|
||||
|
||||
* The description clearly states or describes the original problem or root
|
||||
cause of the problem.
|
||||
* Include historical information on how the problem was identified.
|
||||
* Any relevant logs are included.
|
||||
* If the issue is a bug that needs fixing in a branch other than Master, add
|
||||
the ‘backport potential’ tag TO THE ISSUE (not the PR).
|
||||
* The provided information should be totally self-contained. External access to
|
||||
web services/sites should not be needed.
|
||||
* If the issue is needed for a hotfix release, add the 'expedite' label.
|
||||
* Steps to reproduce the problem if possible.
|
202
playbooks/roles/repo_build/LICENSE
Normal file
202
playbooks/roles/repo_build/LICENSE
Normal file
@ -0,0 +1,202 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
||||
|
17
playbooks/roles/repo_build/README.rst
Normal file
17
playbooks/roles/repo_build/README.rst
Normal file
@ -0,0 +1,17 @@
|
||||
OpenStack repo build
|
||||
#####################
|
||||
:tags: openstack, repo, build, cloud, ansible
|
||||
:category: \*nix
|
||||
|
||||
Role to deploy a repository build for both python packages and git sources.
|
||||
|
||||
.. code-block:: yaml
|
||||
|
||||
- name: Setup repo builds
|
||||
hosts: repo_all
|
||||
user: root
|
||||
roles:
|
||||
- { role: "repo_build", tags: [ "repo-build" ] }
|
||||
vars:
|
||||
memcached_builds: 127.0.0.1:11211
|
||||
memcached_encryption_key: secrete
|
32
playbooks/roles/repo_build/defaults/main.yml
Normal file
32
playbooks/roles/repo_build/defaults/main.yml
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
# 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.
|
||||
|
||||
repo_build_use_upper_constraints: true
|
||||
|
||||
repo_build_service_user_name: "nginx"
|
||||
|
||||
repo_build_global_links_path: "/var/www/repo/links"
|
||||
repo_build_release_path: "/var/www/repo/os-releases"
|
||||
repo_build_dir: "/tmp/openstack-builder"
|
||||
repo_build_output: "/tmp/openstack-wheel-output"
|
||||
repo_build_git_dir: "/var/www/repo/openstackgit"
|
||||
repo_build_pool_dir: "/var/www/repo/pools"
|
||||
|
||||
repo_build_release_tag: "untagged"
|
||||
|
||||
repo_build_pip_default_index: "https://pypi.python.org/simple"
|
||||
repo_build_pip_extra_index: "https://pypi.python.org/simple"
|
||||
|
||||
repo_build_timeout: 120
|
33
playbooks/roles/repo_build/meta/main.yml
Normal file
33
playbooks/roles/repo_build/meta/main.yml
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
# 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.
|
||||
|
||||
galaxy_info:
|
||||
author: rcbops
|
||||
description: Install package repo build
|
||||
company: Rackspace
|
||||
license: Apache2
|
||||
min_ansible_version: 1.9.3
|
||||
platforms:
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- trusty
|
||||
categories:
|
||||
- cloud
|
||||
- python
|
||||
- development
|
||||
- openstack
|
||||
dependencies:
|
||||
- apt_package_pinning
|
||||
- pip_install
|
20
playbooks/roles/repo_build/tasks/main.yml
Normal file
20
playbooks/roles/repo_build/tasks/main.yml
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
# 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.
|
||||
|
||||
- include: repo_clone_git.yml
|
||||
- include: repo_set_facts.yml
|
||||
- include: repo_pre_build.yml
|
||||
- include: repo_build.yml
|
||||
- include: repo_post_build.yml
|
50
playbooks/roles/repo_build/tasks/repo_build.yml
Normal file
50
playbooks/roles/repo_build/tasks/repo_build.yml
Normal file
@ -0,0 +1,50 @@
|
||||
---
|
||||
# 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: Create OpenStack global requirements wheels
|
||||
shell: |
|
||||
pip wheel --timeout {{ repo_build_timeout }} \
|
||||
--wheel-dir {{ repo_build_output }} \
|
||||
--allow-all-external \
|
||||
--find-links {{ repo_build_global_links_path }} \
|
||||
--constraint {{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_constraints.txt \
|
||||
--index-url {{ repo_build_pip_default_index }} \
|
||||
--trusted-host {{ repo_build_pip_default_index | netloc_no_port }} \
|
||||
--extra-index-url {{ repo_build_pip_extra_index }} \
|
||||
--trusted-host {{ repo_build_pip_extra_index | netloc_no_port }} \
|
||||
--build {{ repo_build_dir }} \
|
||||
--verbose \
|
||||
--log /var/log/repo/repo_builder.log \
|
||||
--requirement {{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_global_requirements.txt
|
||||
tags:
|
||||
- repo-build-global-requirement-wheels
|
||||
|
||||
- name: Create OpenStack-Ansible requirement wheels
|
||||
shell: |
|
||||
pip wheel --timeout {{ repo_build_timeout }} \
|
||||
--wheel-dir {{ repo_build_output }} \
|
||||
--allow-all-external \
|
||||
--find-links {{ repo_build_output }} \
|
||||
--constraint {{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_constraints.txt \
|
||||
--index-url {{ repo_build_pip_default_index }} \
|
||||
--trusted-host {{ repo_build_pip_default_index | netloc_no_port }} \
|
||||
--extra-index-url {{ repo_build_pip_extra_index }} \
|
||||
--trusted-host {{ repo_build_pip_extra_index | netloc_no_port }} \
|
||||
--build {{ repo_build_dir }} \
|
||||
--verbose \
|
||||
--log /var/log/repo/repo_builder.log \
|
||||
--requirement {{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_local_filtered.txt
|
||||
tags:
|
||||
- repo-build-openstack-ansible-requirement-wheels
|
25
playbooks/roles/repo_build/tasks/repo_clone_git.yml
Normal file
25
playbooks/roles/repo_build/tasks/repo_clone_git.yml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
# 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: Clone all upstream git repositories
|
||||
git:
|
||||
repo: "{{ item['url'] }}"
|
||||
dest: "{{ repo_build_git_dir }}/{{ item['name'] }}"
|
||||
clone: yes
|
||||
update: yes
|
||||
version: "{{ item['version'] }}"
|
||||
with_items: local_packages.results.0.item.remote_package_parts
|
||||
tags:
|
||||
- repo-clone-repos
|
116
playbooks/roles/repo_build/tasks/repo_post_build.yml
Normal file
116
playbooks/roles/repo_build/tasks/repo_post_build.yml
Normal file
@ -0,0 +1,116 @@
|
||||
---
|
||||
# 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: Index built wheels
|
||||
command: "ls -1 {{ repo_build_output }}"
|
||||
register: built_wheels
|
||||
tags:
|
||||
- repo-build-index-wheels
|
||||
- repo-create-pool
|
||||
- repo-copy-wheels-to-pool
|
||||
- repo-create-release-links
|
||||
- repo-create-links-index
|
||||
- repo-create-release-manifest
|
||||
|
||||
- name: Create wheel pool structure
|
||||
file:
|
||||
path: "{{ repo_build_pool_dir }}/{{ item.split('-')[0] | lower }}"
|
||||
state: directory
|
||||
owner: "{{ repo_build_service_user_name }}"
|
||||
with_items: built_wheels.stdout_lines
|
||||
tags:
|
||||
- repo-create-pool
|
||||
|
||||
- name: Remove pool indexes if found
|
||||
file:
|
||||
path: "{{ repo_build_pool_dir }}/{{ item.split('-')[0] | lower }}/index.html"
|
||||
state: absent
|
||||
with_items: built_wheels.stdout_lines
|
||||
tags:
|
||||
- repo-create-pool
|
||||
|
||||
- name: Move wheels into place and ensure permissions
|
||||
shell: |
|
||||
if [ ! -f "{{ repo_build_pool_dir }}/{{ item.split('-')[0] | lower }}/{{ item | lower }}" ];then
|
||||
mv {{ repo_build_output }}/{{ item }} {{ repo_build_pool_dir }}/{{ item.split('-')[0] | lower }}/{{ item | lower }}
|
||||
elif ! diff {{ repo_build_output }}/{{ item }} {{ repo_build_pool_dir }}/{{ item.split('-')[0] | lower }}/{{ item | lower }} > /dev/null;then
|
||||
mv {{ repo_build_output }}/{{ item }} {{ repo_build_pool_dir }}/{{ item.split('-')[0] | lower }}/{{ item | lower }}
|
||||
fi
|
||||
chown {{ repo_build_service_user_name }} {{ repo_build_pool_dir }}/{{ item.split('-')[0] | lower }}/{{ item | lower }}
|
||||
with_items: built_wheels.stdout_lines
|
||||
tags:
|
||||
- repo-copy-wheels-to-pool
|
||||
|
||||
- name: Create release pool links
|
||||
file:
|
||||
dest: "{{ repo_build_release_path }}/{{ repo_build_release_tag }}/{{ item | lower }}"
|
||||
src: "{{ repo_build_pool_dir }}/{{ item.split('-')[0] | lower }}/{{ item | lower }}"
|
||||
state: link
|
||||
owner: "{{ repo_build_service_user_name }}"
|
||||
with_items: built_wheels.stdout_lines
|
||||
tags:
|
||||
- repo-create-release-links
|
||||
|
||||
- name: Create release manifest
|
||||
template:
|
||||
src: "manifest.in.j2"
|
||||
dest: "{{ repo_build_release_path }}/{{ repo_build_release_tag }}/MANIFEST.in"
|
||||
tags:
|
||||
- repo-create-release-manifest
|
||||
|
||||
- name: Create absolute requirements
|
||||
template:
|
||||
src: "requirements_absolute_requirements.txt.j2"
|
||||
dest: "{{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_absolute_requirements.txt"
|
||||
tags:
|
||||
- repo-create-absolute-requirements
|
||||
|
||||
- name: Index built wheels
|
||||
command: "ls -1 {{ repo_build_release_path }}/{{ repo_build_release_tag }}"
|
||||
register: indexed_links
|
||||
tags:
|
||||
- repo-index-links
|
||||
- repo-create-release-index
|
||||
|
||||
- name: Create release index
|
||||
template:
|
||||
src: "release_index_links.html.j2"
|
||||
dest: "{{ repo_build_release_path }}/{{ repo_build_release_tag }}/index.html"
|
||||
tags:
|
||||
- repo-create-release-index
|
||||
|
||||
- name: Create general index links
|
||||
file:
|
||||
dest: "{{ repo_build_global_links_path }}/{{ item | lower }}"
|
||||
src: "../pools/{{ item.split('-')[0] | lower }}/{{ item | lower }}"
|
||||
state: link
|
||||
owner: "{{ repo_build_service_user_name }}"
|
||||
with_items: built_wheels.stdout_lines
|
||||
tags:
|
||||
- repo-create-links-index
|
||||
|
||||
- name: Index general links
|
||||
command: "ls -1 {{ repo_build_global_links_path }}"
|
||||
register: global_indexed_links
|
||||
tags:
|
||||
- repo-index-links
|
||||
- repo-create-global-release-index
|
||||
|
||||
- name: Create release index
|
||||
template:
|
||||
src: "global_indexed_links.html.j2"
|
||||
dest: "{{ repo_build_global_links_path }}/index.html"
|
||||
tags:
|
||||
- repo-create-global-release-index
|
66
playbooks/roles/repo_build/tasks/repo_pre_build.yml
Normal file
66
playbooks/roles/repo_build/tasks/repo_pre_build.yml
Normal file
@ -0,0 +1,66 @@
|
||||
---
|
||||
# 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 workspace files are cleaned up
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: "absent"
|
||||
with_items:
|
||||
- "{{ repo_build_dir }}"
|
||||
- "{{ repo_build_output }}"
|
||||
- "{{ repo_build_release_path }}/{{ repo_build_release_tag }}"
|
||||
- "{{ repo_build_pool_dir }}/index.html" # pool directory index is removed because its no longer used
|
||||
tags:
|
||||
- repo-clean-workspace
|
||||
|
||||
- name: Create release directory
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ repo_build_service_user_name }}"
|
||||
with_items:
|
||||
- "{{ repo_build_release_path }}/{{ repo_build_release_tag }}"
|
||||
- "{{ repo_build_global_links_path }}"
|
||||
tags:
|
||||
- repo-create-release-links-location
|
||||
|
||||
- name: Build global package requirements file
|
||||
template:
|
||||
src: "requirements_global_requirements.txt.j2"
|
||||
dest: "{{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_global_requirements.txt"
|
||||
tags:
|
||||
- repo-build-global-package-files
|
||||
|
||||
- name: Build filtered package requirements file
|
||||
template:
|
||||
src: "requirements_local_filtered.txt.j2"
|
||||
dest: "{{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_local_filtered.txt"
|
||||
tags:
|
||||
- repo-build-filtered-package-files
|
||||
|
||||
- name: Index cloned repos
|
||||
shell: "find {{ repo_build_git_dir }}/* -maxdepth 0 -type d"
|
||||
register: cloned_repos
|
||||
tags:
|
||||
- repo-index-cloned-repos
|
||||
- repo-build-constraints-file
|
||||
- repo-create-release-manifest
|
||||
|
||||
- name: Build package constraints file
|
||||
template:
|
||||
src: "requirements_constraints.txt.j2"
|
||||
dest: "{{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_constraints.txt"
|
||||
tags:
|
||||
- repo-build-constraints-file
|
64
playbooks/roles/repo_build/tasks/repo_set_facts.yml
Normal file
64
playbooks/roles/repo_build/tasks/repo_set_facts.yml
Normal file
@ -0,0 +1,64 @@
|
||||
---
|
||||
# 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: Retrieve global requirements content
|
||||
slurp:
|
||||
src: "{{ repo_build_git_dir }}/requirements/global-requirements.txt"
|
||||
register: slurp_global_requirements
|
||||
tags:
|
||||
- repo-set-requirement-names-filtered
|
||||
- repo-set-requirement-names
|
||||
- repo-set-requirements
|
||||
- repo-get-global-requirements
|
||||
|
||||
- name: Set requirements
|
||||
set_fact:
|
||||
global_requirement: "{{ slurp_global_requirements.content | b64decode | splitlines }}"
|
||||
tags:
|
||||
- repo-set-requirement-names-filtered
|
||||
- repo-set-requirement-names
|
||||
- repo-set-requirements
|
||||
|
||||
- name: Set requirement names
|
||||
set_fact:
|
||||
global_requirement_names: "{{ global_requirement | pip_requirement_names }}"
|
||||
tags:
|
||||
- repo-set-requirement-names-filtered
|
||||
- repo-set-requirement-names
|
||||
- repo-set-requirements
|
||||
|
||||
- name: Set filtered requirement names
|
||||
set_fact:
|
||||
global_requirement_names_filtered: "{{ local_packages.results.0.item.packages | filtered_list(global_requirement_names) }}"
|
||||
tags:
|
||||
- repo-set-requirement-names-filtered
|
||||
- repo-set-requirements
|
||||
|
||||
- name: Retrieve upper constraints content
|
||||
slurp:
|
||||
src: "{{ repo_build_git_dir }}/requirements/upper-constraints.txt"
|
||||
register: slurp_upper_constraints
|
||||
tags:
|
||||
- repo-set-constraints
|
||||
- repo-get-upper-constraints
|
||||
- repo-build-constraints-file
|
||||
|
||||
- name: Set upper constraints
|
||||
set_fact:
|
||||
upper_constraints: "{{ slurp_upper_constraints.content | b64decode | splitlines }}"
|
||||
when: slurp_upper_constraints | success
|
||||
tags:
|
||||
- repo-set-constraints
|
||||
- repo-build-constraints-file
|
@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
links for "{{ repo_build_release_tag }}"
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
{% for item in global_indexed_links.stdout_lines %}
|
||||
<a href="{{ item }}">{{ item }}</a><br />
|
||||
{% endfor %}
|
||||
</body>
|
||||
</html>
|
4
playbooks/roles/repo_build/templates/manifest.in.j2
Normal file
4
playbooks/roles/repo_build/templates/manifest.in.j2
Normal file
@ -0,0 +1,4 @@
|
||||
{% for item in built_wheels.stdout_lines %}
|
||||
{{ repo_build_pool_dir | basename }}/{{ item.split('-')[0] | lower }}/{{ item }}
|
||||
{{ repo_build_release_path | basename }}/{{ repo_build_release_tag }}/{{ item }}
|
||||
{% endfor %}
|
@ -0,0 +1,12 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
links for "{{ repo_build_release_tag }}"
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
{% for item in indexed_links.stdout_lines %}
|
||||
<a href="{{ item }}">{{ item }}</a><br />
|
||||
{% endfor %}
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,3 @@
|
||||
{% for item in built_wheels.stdout_lines %}
|
||||
{{ item.split('-')[0] | lower }}=={{ item.split('-')[1] | lower }}
|
||||
{% endfor %}
|
@ -0,0 +1,19 @@
|
||||
# Computed constraints
|
||||
{% set constraint_pkgs = [] -%}
|
||||
{% for clone_item in cloned_repos.stdout_lines -%}
|
||||
git+file://{{ clone_item }}#egg={{ clone_item | git_link_parse_name | replace('-', '_') | lower }}
|
||||
{% if constraint_pkgs.append(clone_item | git_link_parse_name | replace('-', '_') | lower) %}{% endif %}
|
||||
{% endfor %}
|
||||
# upper boundry constraints from requirements repo.
|
||||
{% for constraint_item in upper_constraints %}
|
||||
{%- set constraint_split = constraint_item.split('===') %}
|
||||
{%- set constraint_name = constraint_split[0] %}
|
||||
{%- set constraint_name_normalized = constraint_name | replace('-', '_') | lower %}
|
||||
{% if constraint_name_normalized not in constraint_pkgs %}
|
||||
{% if repo_build_use_upper_constraints | bool %}
|
||||
{{ constraint_split[0] | replace('-', '_') | lower }}<={{ constraint_split[1] }}
|
||||
{% else %}
|
||||
# {{ constraint_split[0] | replace('-', '_') | lower }}<={{ constraint_split[1] }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
@ -0,0 +1,3 @@
|
||||
{% for item in global_requirement %}
|
||||
{{ item }}
|
||||
{% endfor %}
|
@ -0,0 +1,3 @@
|
||||
{% for item in global_requirement_names_filtered %}
|
||||
{{ item }}
|
||||
{% endfor %}
|
Loading…
Reference in New Issue
Block a user