Commit Graph

21 Commits

Author SHA1 Message Date
Tobias Henkel cd9827e664
Manage ansible installations within zuul
As a first step towards supporting multiple ansible versions we need
tooling to manage ansible installations. This moves the installation
of ansible from the requirements.txt into zuul. This is called as a
setup hook to install the ansible versions into
<prefix>/lib/zuul/ansible. Further this tooling abstracts knowledge
that the executor must know in order to actually run the correct
version of ansible.

The actual usage of multiple ansible versions will be done in
follow-ups.

For better maintainability the ansible plugins live in
zuul/ansible/base where plugins can be kept in different versions if
necessary. For each supported ansible version there is a specific
folder that symlinks the according plugins.

Change-Id: I5ce1385245c76818777aa34230786a9dbaf723e5
Depends-On: https://review.openstack.org/623927
2019-03-15 09:09:16 +01:00
Zuul 1b83044ed4 Merge "python3: Can't have unbuffered non-binary I/O" 2018-11-26 23:09:23 +00:00
Andreas Jaeger d9059524e0 Fix flake 3.6.0 warnings
flake 3.6.0 introduces a couple of new tests, handle them in the zuul
base:

* Disable "W504 line break after binary operator", this is a new warning
  with different coding style.
* Fix "F841 local variable 'e' is assigned to but never used"
* Fix "W605 invalid escape sequence" - use raw strings for regexes.
* Fix "F901 'raise NotImplemented' should be 'raise
  NotImplementedError'"
* Ignore "E252 missing whitespace around parameter equals" since it
  reports on parameters like:
  def makeNewJobs(self, old_job, parent: Job=None):

Change "flake8: noqa" to "noqa" since "flake8: noqa" is a file level
noqa and gets ignored with flake 3.6.0 if it's not at beginning of line
- this results in many warnings for files ./zuul/driver/bubblewrap/__init__.py and
./zuul/cmd/migrate.py. Fix any issues there.

Change-Id: Ia79bbc8ac0cd8e4819f61bda0091f4398464c5dc
2018-10-28 16:39:30 +01:00
Clint Byrum 675f10d271 python3: Can't have unbuffered non-binary I/O
The console daemon has, thus far, primarily been tested on python2 for
various reasons.

However, when forcing it to python3 by setting
ansible_python_interpreter=/usr/bin/python3, we find that the console
daemon explodes because Python 3 does not allow unbuffered I/O on
non-binary files.

It should be fine to have /dev/null be binary mode, as it is just being
used to do low-level fileno() operations, the file ojbect is discarded
shortly thereafter.

Change-Id: Ib030863c2de17825e29874733fc5a9b023f7a601
2018-09-08 21:42:07 -07:00
Tobias Henkel 61abe44424
Fix broken fail_json in zuul_console
There was an occurrence to fail_json where the message was put in via
a positional argument instead of the msg keyword.

Change-Id: Ie4b9935869fab01e598fd7f34a5245515152c09b
2018-02-12 09:02:46 +01:00
David Shrewsbury 70798ea74b Fix for pep8 E722 and ignore E741
New flake8 release causes these to suddenly show up.

Change-Id: If7fa5a549a2e1651d0353defcc910374bdd226c2
2017-10-23 10:50:32 -07:00
Tobias Henkel 09fabaf722 Try to early terminate streaming on ansible errors
Currently when ansible has an error when trying to run a command or
shell task the command module has no chance to send any console
log. Thus zuul_stream doesn't terminate by itself and gets killed
after a timeout of 30s. As a try to fix this zuul_console sends
periodically a notice about the not found logfile. When requesting the
streamer to exit it can check then if there is still no console file
and exit by itself without needing to timeout.

Change-Id: I42bc05b0d2c530fbfc00c6295da24d18a6ec6435
2017-08-09 07:16:16 +02:00
Monty Taylor 8dce6aacaa
Read the log file as binary in zuul_console
It gets decoded as utf-8 on the other side of the socket, and it's being
written to the file as utf-8 - so there's not reason to read it in to a
string before sending it over the wire.

Change-Id: Iad3d33108835fad3ceae0eec38985659449a6452
2017-06-30 15:32:26 -05:00
Monty Taylor ef65e0ec65
Add shutdown option for zuul_console
This should look for the process holding open the port, and then delete
all of the remaining files.

Co-Authored-By: Clark Boylan <clark.boylan@gmail.com>
Change-Id: Iba3eda63e84c4357a121a1782b97a12232e1b8ce
2017-06-10 10:06:58 -05:00
Monty Taylor b115358259
Make log streaming to executor per-task
Spawning a single reader at the top isn't actually working. In cases
where there are multiple playbooks per host (literally every zuul v3 job
given pre playbooks for git repos), the stamp file was preventing following
playbook from spawning a daemon, but the daemon was only persistent in
the context of a single playbook.

We can't just spawn a new one per playbook without some modifications,
as otherwise the existing already-streamed content would get streamed
again.

Grab the finger streaming code, which accepts an argument as to what to
stream, and re-use it in zuul_console. Combine this with adding a unique
id to each task. That way each task on a host will log to a distinct
logfile, and each callback will stream only that task's log output.

This allows us to join the reader as well, so that we won't get
streaming overlap across tasks.

Change-Id: Ic5eb6c38af698f4ba8b4504aa69170834ec4036a
2017-06-07 11:12:53 -05:00
David Shrewsbury e095846934 Re-enable F405 pep8 errors
Change-Id: I731686a144394b79e1e263cd73ee12a7a2d12914
2017-05-19 09:36:01 -04:00
Monty Taylor f56801995f
It's _still_ FILE not PATH
Change-Id: I50cd14ecd58a96b1b1b0becac4d86a1a46dfcfdc
2017-02-23 15:11:58 -05:00
Monty Taylor 96e3c45e29
It's FILE not PATH
Change-Id: I5fc656d0739ff5b0b0d127d97bfc89528107b674
2017-02-23 15:03:02 -05:00
Monty Taylor d969430747
Minor cleanups in on-node logging
We don't need zuul_log anymore. People can write ansible themselves,
which means they can write debug statements, which will go into the
collected log.

Also, put the port and the filename into constants so that they don't
seem like magic numbers as much.

Change-Id: I8020cc3e841617366831e80fe92fc477452d6da2
2017-02-23 10:25:37 -05:00
Paul Belanger 1bfb002d70
Simplify zuul_console port binding logic
Now that osic-cloud1 is providing IPv6 only, we need to update
zuul_console to also include ipv6 support.  Previously, our logic
would only bind to 1 address, even if the host supported both
ipv4/ipv6.

With help from fungi, we can simplify our logic binding to both ipv4
and ipv6 at the same time.

Change-Id: Ia0286e017f14eab77c5d60333ee092c87bb1a84b
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2016-08-15 13:39:28 -04:00
James E. Blair ff6dd45cbc Ansible launcher: Use port 19885 for console streaming
Thanks Jay!

Change-Id: Ie67bbba02dbf61a481f66001de3e0dede9448316
Closes-Bug: 1590139
2016-07-21 11:43:02 -07:00
James E. Blair 42465ee3ff Ansible launcher: use console.html
Some of our tooling expects console.html; the easiest thing to do
at this point is just to call it that everywhere.

Change-Id: I2ac3d03bf7e263e4f30d6f0d94974f1699ec8f24
2016-05-26 07:19:14 -07:00
Jenkins 6298156d84 Merge "Ansible launcher: several fixes" 2016-05-25 21:30:31 +00:00
James E. Blair b5aa68ffee Ansible launcher: several fixes
These were developed together in situ:

* Fix tailing the console log
* Change console log name from console.log to console.txt
  (for better auto content typing)
* Expand JJB macros for builders and publishers
* Use a two-stage SCP copy (worker -> controller; controller -> site);
  a one-stage copy is possible but will require installing a key
  on the remote site
* Substitute parameters (eg $LOG_SERVER) into scp/ftp site paths
* Better worker logging (use the worker name in the logger name)

Change-Id: I98e5603f7a3210c1322640a66ecdeadb24ce74fe
2016-05-20 08:20:23 -07:00
David Shrewsbury de2ca126fb Ansible launcher: Fix module main calls
Soon-to-be-released Ansible 2.1 can sometimes hate you for not
surrounding your call to main() with the proper conditional check.
Let's fix that.

Change-Id: If9eca7866d8d2057d200110186e03772cd77a8fb
2016-05-13 12:49:27 -04:00
James E. Blair c4b1937ed6 Ansible launcher: add streaming console support
Note the GPL license as it is an ansible module.

Change-Id: I5878c626beebe9cc131a431fa46bf67f3eb9c426
2016-05-12 11:37:21 -07:00