Browse Source

Merge "Fix test-logs.sh utility for multi-ansible"

tags/3.9.0
Zuul 3 months ago
parent
commit
ba50b99343
2 changed files with 25 additions and 15 deletions
  1. 25
    14
      tools/test-logs.sh
  2. 0
    1
      tox.ini

+ 25
- 14
tools/test-logs.sh View File

@@ -22,19 +22,23 @@ if [[ ! -d "${ZUUL_DIR}/.tox/venv" ]]; then
22 22
         tox -e venv --notest
23 23
     popd
24 24
 fi
25
+
26
+ANSIBLE_VERSION="2.7"
27
+ANSIBLE_ROOT="${ZUUL_DIR}/.tox/venv/lib/zuul/ansible/${ANSIBLE_VERSION}"
28
+ARA_DIR=$(dirname $("${ANSIBLE_ROOT}/bin/python3" -c 'import ara; print(ara.__file__)'))
29
+
25 30
 # Source tox environment
26 31
 source ${ZUUL_DIR}/.tox/venv/bin/activate
27 32
 
28
-# Install ARA if it's not installed (not in requirements.txt by default)
29
-python -c "import ara" &> /dev/null
30
-if [ $? -eq 1 ]; then
31
-    echo "ARA isn't installed... Installing it."
32
-    pip install ara
33
-fi
34
-ARA_DIR=$(dirname $(python3 -c 'import ara; print(ara.__file__)'))
35
-
36 33
 WORK_DIR=$(mktemp -d /tmp/zuul_logs_XXXX)
37 34
 
35
+# Copy zuul ansible modules into workdir
36
+ZUUL_ANSIBLE="${WORK_DIR}/zuul-ansible"
37
+mkdir -p "${ZUUL_ANSIBLE}/zuul"
38
+cp -Lr "${ZUUL_DIR}/zuul/ansible/${ANSIBLE_VERSION}" "${ZUUL_ANSIBLE}/zuul/ansible"
39
+touch "${ZUUL_ANSIBLE}/zuul/ansible/__init__.py"
40
+touch "${ZUUL_ANSIBLE}/zuul/__init__.py"
41
+
38 42
 if [ -z $1 ] ; then
39 43
     INVENTORY=$WORK_DIR/hosts.yaml
40 44
     cat >$INVENTORY <<EOF
@@ -62,11 +66,12 @@ gathering = smart
62 66
 gather_subset = !all
63 67
 fact_caching = jsonfile
64 68
 fact_caching_connection = ~/.cache/facts
65
-lookup_plugins = $ZUUL_DIR/zuul/ansible/lookup
66
-callback_plugins = $ZUUL_DIR/zuul/ansible/callback:$ARA_DIR/plugins/callbacks
67
-module_utils = $ZUUL_DIR/zuul/ansible/module_utils
69
+lookup_plugins = ${ZUUL_ANSIBLE}/zuul/ansible/lookup
70
+callback_plugins = ${ZUUL_ANSIBLE}/zuul/ansible/callback:$ARA_DIR/plugins/callbacks
71
+action_plugins = ${ZUUL_ANSIBLE}/zuul/ansible/actiongeneral
72
+module_utils = ${ZUUL_ANSIBLE}/zuul/ansible/module_utils
68 73
 stdout_callback = zuul_stream
69
-library = $ZUUL_DIR/zuul/ansible/library
74
+library = ${ZUUL_ANSIBLE}/zuul/ansible/library
70 75
 retry_files_enabled = False
71 76
 EOF
72 77
 
@@ -75,8 +80,14 @@ python3 $ZUUL_DIR/zuul/ansible/logconfig.py
75 80
 export ZUUL_JOB_LOG_CONFIG=$WORK_DIR/logging.json
76 81
 export ARA_DIR=$WORK_DIR/.ara
77 82
 export ARA_LOG_CONFIG=$ZUUL_JOB_LOG_CONFIG
83
+export PYTHONPATH="${ZUUL_ANSIBLE}:${PYTHONPATH}"
84
+export ZUUL_JOBDIR=$WORK_DIR
78 85
 rm -rf $ARA_DIR
79
-ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/fixtures/test-stream.yaml
80
-ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/fixtures/test-stream-failure.yaml
86
+
87
+"${ANSIBLE_ROOT}/bin/ansible" all -m zuul_console
88
+
89
+ANSIBLE="${ANSIBLE_ROOT}/bin/ansible-playbook"
90
+"${ANSIBLE}" "${ZUUL_DIR}/playbooks/zuul-stream/fixtures/test-stream.yaml"
91
+"${ANSIBLE}" "${ZUUL_DIR}/playbooks/zuul-stream/fixtures/test-stream-failure.yaml"
81 92
 # ansible-playbook $ZUUL_DIR/playbooks/zuul-stream/functional.yaml
82 93
 echo "Logs are in $WORK_DIR"

+ 0
- 1
tox.ini View File

@@ -74,7 +74,6 @@ commands =
74 74
   sphinx-build -E -W -d doc/build/doctrees -b html doc/source/ doc/build/html
75 75
 
76 76
 [testenv:venv]
77
-install_command = pip install {opts} {packages}
78 77
 commands = {posargs}
79 78
 
80 79
 [testenv:nodepool]

Loading…
Cancel
Save