blob: a514dd831dafbc7ea6246879ed7e354039df7623 [file] [log] [blame]
Monty Taylore5b614e2017-09-01 12:56:57 -05001#!/bin/bash
2# Copyright 2017 Red Hat, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17ZUUL_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
18ARA_DIR=$(dirname $(python3 -c 'import ara ; print(ara.__file__)'))
19WORK_DIR=$PWD/test-logs-output
20
21mkdir -p $WORK_DIR
22
23if [ -z $1 ] ; then
24 INVENTORY=$WORK_DIR/hosts.yaml
25 cat >$INVENTORY <<EOF
26all:
27 hosts:
28 controller:
29 ansible_host: localhost
30 node1:
31 ansible_host: localhost
32 node2:
33 ansible_host: localhost
34node:
35 hosts:
36 node1: null
37 node2: null
38EOF
39else
40 INVENTORY=$(realpath $1)
41fi
42
43cat >$WORK_DIR/ansible.cfg <<EOF
44[defaults]
David Shrewsbury501bd052017-09-19 14:15:08 -040045inventory = $INVENTORY
Monty Taylore5b614e2017-09-01 12:56:57 -050046gathering = smart
47gather_subset = !all
48fact_caching = jsonfile
49fact_caching_connection = ~/.cache/facts
50lookup_plugins = $ZUUL_DIR/zuul/ansible/lookup
51callback_plugins = $ZUUL_DIR/zuul/ansible/callback:$ARA_DIR/plugins/callbacks
52module_utils = $ZUUL_DIR/zuul/ansible/module_utils
53stdout_callback = zuul_stream
54library = $ZUUL_DIR/zuul/ansible/library
55retry_files_enabled = False
56EOF
57
58cd $WORK_DIR
59python3 $ZUUL_DIR/zuul/ansible/logconfig.py
60export ZUUL_JOB_LOG_CONFIG=$WORK_DIR/logging.json
61export ARA_DIR=$WORK_DIR/.ara
62export ARA_LOG_CONFIG=$ZUUL_JOB_LOG_CONFIG
63rm -rf $ARA_DIR
64ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/fixtures/test-stream.yaml
65ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/fixtures/test-stream-failure.yaml
66echo "Logs are in $WORK_DIR"