JJB runner POC
The initial work to support running job instructions pulled in from
jenkins-job-builder config.
Because the XML is tightly coupled with JJB it's easier to use
xmltodict at this point. Ideally a new interpreter for JJB formatted
files to turbo-hipster instructions could be made.
At the moment we're ignoring JJB instructions from items we aren't
interested in (for example, publishers and build wrappers). Some
level of support should be added later for these or the job
instructions should be updated to not use them.
Change-Id: I0560d8e0a7e33548bacee3aa98bd45a5907bec21
diff --git a/turbo_hipster/lib/utils.py b/turbo_hipster/lib/utils.py
index f0603af..5487765 100644
--- a/turbo_hipster/lib/utils.py
+++ b/turbo_hipster/lib/utils.py
@@ -91,14 +91,8 @@
self.repo = git.Repo(self.local_path)
-def execute_to_log(cmd, logfile, timeout=-1,
- watch_logs=[
- ('[syslog]', '/var/log/syslog'),
- ('[sqlslo]', '/var/log/mysql/slow-queries.log'),
- ('[sqlerr]', '/var/log/mysql/error.log')
- ],
- heartbeat=True, env=None, cwd=None
- ):
+def execute_to_log(cmd, logfile, timeout=-1, watch_logs=[], heartbeat=30,
+ env=None, cwd=None):
""" Executes a command and logs the STDOUT/STDERR and output of any
supplied watch_logs from logs into a new logfile
@@ -132,6 +126,7 @@
% (watch_file[1], e))
cmd += ' 2>&1'
+ logger.info("[running %s]" % cmd)
start_time = time.time()
p = subprocess.Popen(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
@@ -174,7 +169,7 @@
for fd, flag in poll_obj.poll(0):
process(fd)
- if time.time() - last_heartbeat > 30:
+ if heartbeat and (time.time() - last_heartbeat > heartbeat):
# Append to logfile
logger.info("[heartbeat]")
last_heartbeat = time.time()