Add entry point to tox to publish images

This allows use to gate in image builds, but only publish them in
periodic or post pipelines.

Change-Id: I09fd247f557a777f2b09f83a5e4d7f0206c04838
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-12-20 19:27:32 -05:00
parent 5dd73001a4
commit 666a2d4df1
3 changed files with 52 additions and 22 deletions

View File

@ -17,24 +17,3 @@
- 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

View File

@ -0,0 +1,36 @@
# 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: build-images.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

17
tox.ini
View File

@ -26,7 +26,6 @@ passenv =
HOME
SSH_AUTH_SOCK
USER
WORKSPACE
setenv =
ANSIBLE_CONFIG = {toxinidir}/playbooks/ansible.cfg
PYTHONUNBUFFERED = 1
@ -46,6 +45,22 @@ setenv =
ANSIBLE_CONFIG = {toxinidir}/playbooks/ansible.cfg
PYTHONUNBUFFERED = 1
[testenv:publish-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:docs]
commands = python setup.py build_sphinx