97 lines
4.1 KiB
YAML
97 lines
4.1 KiB
YAML
---
|
|
# Copyright 2016, 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: Build repo
|
|
hosts: repo_all
|
|
user: root
|
|
pre_tasks:
|
|
- name: Check if this is an OpenStack-CI nodepool instance
|
|
stat:
|
|
path: /etc/nodepool/provider
|
|
register: nodepool
|
|
delegate_to: localhost
|
|
- name: Determine the existing Ubuntu repo URL (only on OpenStack-CI)
|
|
shell: 'awk "/^deb .*ubuntu\/? {{ ansible_distribution_release }} main/ {print \$2; exit}" /etc/apt/sources.list'
|
|
register: ubuntu_repo_url
|
|
changed_when: false
|
|
when:
|
|
- ansible_pkg_mgr == 'apt'
|
|
- nodepool.stat.exists | bool
|
|
delegate_to: localhost
|
|
- name: Set Ubuntu Cloud Archive repo URL based on discovered information
|
|
set_fact:
|
|
uca_apt_repo_url: "{{ ubuntu_repo_url.stdout | netorigin }}/ubuntu-cloud-archive"
|
|
when:
|
|
- ansible_pkg_mgr == 'apt'
|
|
- nodepool.stat.exists | bool
|
|
roles:
|
|
- "{{ rolename | basename }}"
|
|
post_tasks:
|
|
- name: List the files in the venv folder
|
|
command: ls -1 /var/www/repo/venvs/{{ repo_build_release_tag }}/{{ ansible_distribution | lower }}/
|
|
register: venv_folder_content
|
|
- name: Ensure that the keystone venv is present
|
|
assert:
|
|
that: "'keystone-{{ repo_build_release_tag }}.tgz' in venv_folder_content.stdout"
|
|
- name: Ensure that the tempest venv is present
|
|
assert:
|
|
that: "'tempest-{{ repo_build_release_tag }}.tgz' in venv_folder_content.stdout"
|
|
- name: Ensure that the nova venv is NOT present
|
|
assert:
|
|
that: "'nova-{{ repo_build_release_tag }}.tgz' not in venv_folder_content.stdout"
|
|
- name: Slurp upper constraints
|
|
slurp:
|
|
src: "{{ repo_build_git_dir }}/requirements/upper-constraints.txt"
|
|
register: slurp_upper_constraints
|
|
- name: Slurp requirements constraints
|
|
slurp:
|
|
src: "{{ repo_build_release_path }}/{{ repo_build_release_tag }}/requirements_constraints.txt"
|
|
register: slurp_requirements_constraints
|
|
- name: Set fact for requirements constraints content
|
|
set_fact:
|
|
requirements_constraints_content: "{{ slurp_requirements_constraints.content | b64decode }}"
|
|
- name: Set fact for upper constraints dictionary
|
|
set_fact:
|
|
upper_constraints_dict: >
|
|
{%- set constraints = {} %}
|
|
{%- for package in slurp_upper_constraints.content | b64decode | splitlines %}
|
|
{%- set name = package | regex_replace('===.*$','') %}
|
|
{%- set version = package | regex_replace('^.*===','') %}
|
|
{%- set _ = constraints.update({name: version}) %}
|
|
{%- endfor %}
|
|
{{- constraints -}}
|
|
- name: Set fact for upper constraints override
|
|
set_fact:
|
|
upper_constraints_override_list: >
|
|
{%- set override_packages = [] %}
|
|
{%- for override in repo_build_upper_constraints_overrides %}
|
|
{%- set name = override | regex_replace('(>=|<=|>|<|==|~=|!=).*$','') %}
|
|
{%- set _ = override_packages.append(name) %}
|
|
{%- endfor %}
|
|
{{- override_packages -}}
|
|
- name: Ensure that requirements constraints is applying upper constraints
|
|
assert:
|
|
that: requirements_constraints_content.find( "{{ item.key }}<={{ item.value }}" ) != -1
|
|
with_dict: upper_constraints_dict
|
|
when:
|
|
- item.key not in upper_constraints_override_list
|
|
- requirements_constraints_content.find(item.key) != -1
|
|
- name: Ensure that upper constraints overrides are applied
|
|
assert:
|
|
that: requirements_constraints_content.find( "{{ item }}" ) != -1
|
|
with_items: "{{ repo_build_upper_constraints_overrides }}"
|
|
vars_files:
|
|
- test-vars.yml
|