build-test-packages: cleanup

* remove the roles build function and relevant documentation that moved
  to the gate-quickstart role
* follow up the role rename in README.md
* add tripleo-ci to the skipped projects
* remove empty/placeholder files
* add and rename the playbook build-test-packages.yml used by the
  ci-scripts

Change-Id: I105824e4b3bc71a9fdaf00496f243a7a1f868783
This commit is contained in:
Attila Darazs 2016-12-05 16:44:44 +01:00
parent 1a3897c326
commit f77f89104a
12 changed files with 154 additions and 363 deletions

View File

@ -0,0 +1,31 @@
---
- name: Add the virthost to the inventory
hosts: localhost
tasks:
- name: Add virthost
add_host:
name: "{{ virthost }}"
groups: "virthost"
ansible_fqdn: "{{ virthost }}"
ansible_user: "root"
ansible_host: "{{ virthost }}"
tags:
- provision
- name: Inventory the virthost
hosts: localhost
gather_facts: yes
roles:
- tripleo-inventory
tags:
- provision
- include: teardown.yml
- include: provision.yml
- name: Build test packages using DLRN
hosts: virthost
roles:
- build-test-packages

View File

@ -1,5 +1,5 @@
ansible-role-tripleo-gate
=========================
build-test-packages
===================
An Ansible role for generating custom RPMSs from upstream Gerrit changes in the
TripleO project using DLRN. This repo then can be injected in the tested
@ -15,8 +15,6 @@ Role Variables
--------------
* `local_working_dir` -- the directory where tripleo-quickstart is located
* `artg_mode` -- either `dlrn` (the default, gating upstream tripleo packages)
or `roles` (gating ansible-role-tripleo repos like this one)
* `artg_dlrn_repo_url` -- the URL of the DLRN repository
* `artg_rdoinfo_repo_url` -- the URL of the rdoinfo repository that contains
the project definitions for DLRN
@ -65,7 +63,7 @@ Example Playbook
- name: Build custom RPMs
hosts: virthost
roles:
- tripleo-gate
- build-test-packages
```
License

View File

@ -2,18 +2,10 @@
# defaults file for ansible-role-tripleo-gate
local_working_dir: "{{ lookup('env', 'HOME') }}/.quickstart"
artg_mode: "dlrn"
artg_dlrn_repo_url: "https://github.com/openstack-packages/DLRN.git"
artg_rdoinfo_repo_url: "https://github.com/redhat-openstack/rdoinfo"
artg_compressed_gating_repo: "/home/stack/gating_repo.tar.gz"
artg_requirements:
- '{{ local_working_dir }}/tripleo-quickstart/requirements.txt'
- '{{ local_working_dir }}/tripleo-quickstart/quickstart-extras-requirements.txt'
# tripleo-quickstart is checked out directly in gate jobs instead of installed
# through requirements file so we cannot handle changes on it. This however
# allows us to include the gate role in quickstart gate jobs and still use the
# "Depends-On" functionality to gate extra role changes.
# This can be also useful to skip roles that cannot be built by DLRN
artg_skipped_projects:
- openstack/tripleo-quickstart
- openstack/tripleo-ci

View File

@ -1,2 +0,0 @@
---
# handlers file for ansible-role-tripleo-gate

View File

@ -1,173 +0,0 @@
galaxy_info:
author: your name
description:
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If travis integration is cofigured, only notification for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
#platforms:
#- name: EL
# versions:
# - all
# - 5
# - 6
# - 7
#- name: GenericUNIX
# versions:
# - all
# - any
#- name: Solaris
# versions:
# - all
# - 10
# - 11.0
# - 11.1
# - 11.2
# - 11.3
#- name: Fedora
# versions:
# - all
# - 16
# - 17
# - 18
# - 19
# - 20
# - 21
# - 22
# - 23
#- name: opensuse
# versions:
# - all
# - 12.1
# - 12.2
# - 12.3
# - 13.1
# - 13.2
#- name: IOS
# versions:
# - all
# - any
#- name: SmartOS
# versions:
# - all
# - any
#- name: eos
# versions:
# - all
# - Any
#- name: Windows
# versions:
# - all
# - 2012R2
#- name: Amazon
# versions:
# - all
# - 2013.03
# - 2013.09
#- name: GenericBSD
# versions:
# - all
# - any
#- name: Junos
# versions:
# - all
# - any
#- name: FreeBSD
# versions:
# - all
# - 10.0
# - 10.1
# - 10.2
# - 8.0
# - 8.1
# - 8.2
# - 8.3
# - 8.4
# - 9.0
# - 9.1
# - 9.1
# - 9.2
# - 9.3
#- name: Ubuntu
# versions:
# - all
# - lucid
# - maverick
# - natty
# - oneiric
# - precise
# - quantal
# - raring
# - saucy
# - trusty
# - utopic
# - vivid
# - wily
# - xenial
#- name: SLES
# versions:
# - all
# - 10SP3
# - 10SP4
# - 11
# - 11SP1
# - 11SP2
# - 11SP3
#- name: GenericLinux
# versions:
# - all
# - any
#- name: NXOS
# versions:
# - all
# - any
#- name: Debian
# versions:
# - all
# - etch
# - jessie
# - lenny
# - sid
# - squeeze
# - stretch
# - wheezy
galaxy_tags: []
# List tags for your role here, one per line. A tag is
# a keyword that describes and categorizes the role.
# Users find roles by searching for tags. Be sure to
# remove the '[]' above if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of
# alphanumeric characters. Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

View File

@ -1,122 +0,0 @@
---
# tasks file for ansible-role-tripleo-gate
- name: Ensure DLRN package dependencies
become: yes
yum: name={{ item }} state=present
with_flattened:
- createrepo
- gcc
- git
- libffi-devel
- mock
- openssl-devel
- python-virtualenv
- rpm-build
- sqlite
- name: Create mock group
become: yes
group: name=mock state=present
- name: Add user to mock group
become: yes
user:
name: '{{ ansible_user }}'
groups: mock
- name: Create virtualenv for DLRN
command: virtualenv {{ ansible_user_dir }}/dlrn-venv
args:
creates: '{{ ansible_user_dir }}/dlrn-venv'
- name: Check if DLRN was already cloned by other means
stat: path='{{ ansible_user_dir }}/DLRN'
register: dlrn_cloned
- name: Clone DLRN
git:
repo: '{{ artg_dlrn_repo_url }}'
dest: '{{ ansible_user_dir }}/DLRN'
when: not dlrn_cloned.stat.exists
#Remove the rpm install test to speed up delorean
#TODO: add an option for this in delorean
- name: Remove DLRN RPM install test
shell: >
sed -i -e 's%--postinstall%%'
{{ ansible_user_dir }}/DLRN/scripts/build_rpm.sh
- name: Update pip before requirements install
pip:
name: pip
state: latest
virtualenv: '{{ ansible_user_dir }}/dlrn-venv'
- name: Install DLRN requirements
pip:
requirements: '{{ ansible_user_dir }}/DLRN/requirements.txt'
virtualenv: '{{ ansible_user_dir }}/dlrn-venv'
- name: Install DLRN
shell: >
source {{ ansible_user_dir }}/dlrn-venv/bin/activate;
python setup.py install;
args:
chdir: '{{ ansible_user_dir }}/DLRN'
- name: Parse Jenkins changes
jenkins_deps:
host: "{{ lookup('env', 'GERRIT_HOST') }}"
change_id: "{{ lookup('env', 'GERRIT_CHANGE_ID') }}"
branch: "{{ lookup('env', 'GERRIT_BRANCH') }}"
patchset_rev: "{{ lookup('env', 'GERRIT_PATCHSET_REVISION') }}"
when: artg_change_list is not defined and "{{ lookup('env', 'GERRIT_HOST') }}" != ""
- name: Parse Zuul changes
zuul_deps:
host: "{{ lookup('env', 'ZUUL_HOST') }}"
changes: "{{ lookup('env', 'ZUUL_CHANGES') }}"
when: artg_change_list is not defined and "{{ lookup('env', 'ZUUL_HOST') }}" != ""
- name: Clone and build the specific DLRN projects
include: dlrn-build.yml artg_change={{ item }}
with_items: '{{ artg_change_list }}'
when: item.project not in artg_skipped_projects
- name: Create a directory to hold the rpms
file:
path: '{{ ansible_user_dir }}/gating_repo'
state: directory
- name: Copy the generated rpms
shell: >
rm -rf {{ ansible_user_dir }}/gating_repo/*;
find {{ ansible_user_dir }}/DLRN/data/repos -type f -name '*.rpm' -print0 | xargs -0 cp -t {{ ansible_user_dir }}/gating_repo;
- name: Run createrepo on generated rpms
shell: 'createrepo gating_repo'
args:
chdir: '{{ ansible_user_dir }}'
- name: Compress the repo
shell: 'tar czf {{ artg_compressed_gating_repo }} gating_repo'
args:
chdir: '{{ ansible_user_dir }}'
- name: Clean up
file:
path: '{{ item }}'
state: absent
with_items:
- '{{ ansible_user_dir }}/dlrn-venv'
- '{{ ansible_user_dir }}/gating_repo'
- name: Clean up DLRN if it was cloned by the playbook
file:
path: '{{ ansible_user_dir }}/DLRN'
state: absent
when: not dlrn_cloned.stat.exists
- name: Trigger repo injection for quickstart
set_fact: compressed_gating_repo={{ artg_compressed_gating_repo }}

View File

@ -1,8 +1,121 @@
---
- name: Run DLRN gate
include: dlrn.yml
when: artg_mode == 'dlrn'
- name: Run roles gate
include: roles.yml
when: artg_mode == 'roles'
- name: Ensure DLRN package dependencies
become: yes
yum: name={{ item }} state=present
with_flattened:
- createrepo
- gcc
- git
- libffi-devel
- mock
- openssl-devel
- python-virtualenv
- rpm-build
- sqlite
- name: Create mock group
become: yes
group: name=mock state=present
- name: Add user to mock group
become: yes
user:
name: '{{ ansible_user }}'
groups: mock
- name: Create virtualenv for DLRN
command: virtualenv {{ ansible_user_dir }}/dlrn-venv
args:
creates: '{{ ansible_user_dir }}/dlrn-venv'
- name: Check if DLRN was already cloned by other means
stat: path='{{ ansible_user_dir }}/DLRN'
register: dlrn_cloned
- name: Clone DLRN
git:
repo: '{{ artg_dlrn_repo_url }}'
dest: '{{ ansible_user_dir }}/DLRN'
when: not dlrn_cloned.stat.exists
#Remove the rpm install test to speed up delorean
#TODO: add an option for this in delorean
- name: Remove DLRN RPM install test
shell: >
sed -i -e 's%--postinstall%%'
{{ ansible_user_dir }}/DLRN/scripts/build_rpm.sh
- name: Update pip before requirements install
pip:
name: pip
state: latest
virtualenv: '{{ ansible_user_dir }}/dlrn-venv'
- name: Install DLRN requirements
pip:
requirements: '{{ ansible_user_dir }}/DLRN/requirements.txt'
virtualenv: '{{ ansible_user_dir }}/dlrn-venv'
- name: Install DLRN
shell: >
source {{ ansible_user_dir }}/dlrn-venv/bin/activate;
python setup.py install;
args:
chdir: '{{ ansible_user_dir }}/DLRN'
- name: Parse Jenkins changes
jenkins_deps:
host: "{{ lookup('env', 'GERRIT_HOST') }}"
change_id: "{{ lookup('env', 'GERRIT_CHANGE_ID') }}"
branch: "{{ lookup('env', 'GERRIT_BRANCH') }}"
patchset_rev: "{{ lookup('env', 'GERRIT_PATCHSET_REVISION') }}"
when: artg_change_list is not defined and "{{ lookup('env', 'GERRIT_HOST') }}" != ""
- name: Parse Zuul changes
zuul_deps:
host: "{{ lookup('env', 'ZUUL_HOST') }}"
changes: "{{ lookup('env', 'ZUUL_CHANGES') }}"
when: artg_change_list is not defined and "{{ lookup('env', 'ZUUL_HOST') }}" != ""
- name: Clone and build the specific DLRN projects
include: dlrn-build.yml artg_change={{ item }}
with_items: '{{ artg_change_list }}'
when: item.project not in artg_skipped_projects
- name: Create a directory to hold the rpms
file:
path: '{{ ansible_user_dir }}/gating_repo'
state: directory
- name: Copy the generated rpms
shell: >
rm -rf {{ ansible_user_dir }}/gating_repo/*;
find {{ ansible_user_dir }}/DLRN/data/repos -type f -name '*.rpm' -print0 | xargs -0 cp -t {{ ansible_user_dir }}/gating_repo;
- name: Run createrepo on generated rpms
shell: 'createrepo gating_repo'
args:
chdir: '{{ ansible_user_dir }}'
- name: Compress the repo
shell: 'tar czf {{ artg_compressed_gating_repo }} gating_repo'
args:
chdir: '{{ ansible_user_dir }}'
- name: Clean up
file:
path: '{{ item }}'
state: absent
with_items:
- '{{ ansible_user_dir }}/dlrn-venv'
- '{{ ansible_user_dir }}/gating_repo'
- name: Clean up DLRN if it was cloned by the playbook
file:
path: '{{ ansible_user_dir }}/DLRN'
state: absent
when: not dlrn_cloned.stat.exists
- name: Trigger repo injection for quickstart
set_fact: compressed_gating_repo={{ artg_compressed_gating_repo }}

View File

@ -1,25 +0,0 @@
---
- name: Get the project name
set_fact:
artg_project_name: '{{ artg_change.project | regex_replace("^.*/", "") }}'
- name: Clone the gated change
git:
repo: 'https://{{ artg_change.host }}/{{ artg_change.project }}'
dest: '{{ local_working_dir }}/gated_roles/{{ artg_project_name }}'
refspec: '{{ artg_change.refspec }}'
version: 'FETCH_HEAD'
- name: Modify requirements
replace:
dest: '{{ req_item }}'
regexp: '^.*egg={{ artg_project_name }}$'
replace: 'file://{{ local_working_dir }}/gated_roles/{{ artg_project_name }}/#egg={{ artg_project_name }}'
with_items: '{{ artg_requirements }}'
loop_control:
loop_var: req_item
- name: Make sure the package is not installed in our venv
pip:
name: '{{ artg_project_name }}'
state: absent

View File

@ -1,13 +0,0 @@
---
- name: Parse Jenkins changes
jenkins_deps:
host: "{{ lookup('env', 'GERRIT_HOST') }}"
change_id: "{{ lookup('env', 'GERRIT_CHANGE_ID') }}"
branch: "{{ lookup('env', 'GERRIT_BRANCH') }}"
patchset_rev: "{{ lookup('env', 'GERRIT_PATCHSET_REVISION') }}"
when: artg_change_list is not defined and "{{ lookup('env', 'GERRIT_HOST') }}" != ""
- name: Clone and inject the specific changes
include: roles-clone.yml artg_change={{ item }}
with_items: '{{ artg_change_list }}'
when: item.project not in artg_skipped_projects

View File

@ -1 +0,0 @@
localhost

View File

@ -1,5 +0,0 @@
---
- hosts: localhost
remote_user: root
roles:
- ansible-role-tripleo-gate

View File

@ -1,2 +0,0 @@
---
# vars file for ansible-role-tripleo-gate