Add tox-ebuild-images

Add an entrypoint for tox so we can only build diskimages.

Change-Id: I911789f97d5a17a1e64a36819f3b746887f675e1
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-12-17 17:47:09 -05:00
parent add314d348
commit 5dd73001a4
2 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,40 @@
# Copyright 2016 Red Hat, 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: bastion.yaml
- include: bootstrap.yaml
- include: zookeeper.yaml
- include: nodepool-builder.yaml
- include: prove.yaml
- name: Publish diskimages.
hosts: bastion
connection: local
vars:
images_dir: "{{ lookup('env','WORKSPACE') }}/images"
tasks:
- name: Create images directory.
file:
path: "{{ images_dir }}"
state: directory
- name: Copy diskimages into images directory.
shell: "/bin/bash -c 'gzip -9 < /opt/nodepool/images/{{ item }}*.tar > {{ images_dir }}/{{ item }}.tgz'"
with_items:
- centos-7
- ubuntu-trusty
- ubuntu-xenial
tags: skip_ansible_lint

16
tox.ini
View File

@ -15,6 +15,22 @@ deps = -r{toxinidir}/requirements.txt
deps = bindep
commands = bindep test
[testenv:build-images]
deps = -r{toxinidir}/requirements.txt
commands =
{toxinidir}/tools/install_bindep.sh
{toxinidir}/tools/install_roles.sh
# NOTE(pabelanger): Because ansible default ansible_user to null now, we need to pass it via CLI.
ansible-playbook -i playbooks/inventory playbooks/build-images.yaml -e ansible_user={env:USER} {posargs}
passenv =
HOME
SSH_AUTH_SOCK
USER
WORKSPACE
setenv =
ANSIBLE_CONFIG = {toxinidir}/playbooks/ansible.cfg
PYTHONUNBUFFERED = 1
[testenv:deploy]
deps = -r{toxinidir}/requirements.txt
commands =