Bug 1145593 - Upload mozharness logs to S3; r=jlund
--- a/mozharness/base/log.py
+++ b/mozharness/base/log.py
@@ -314,16 +314,17 @@ class BaseLogger(object):
self.logger.addHandler(console_handler)
self.all_handlers.append(console_handler)
def add_file_handler(self, log_path, log_level=None, log_format=None,
date_format=None):
if not self.append_to_log and os.path.exists(log_path):
os.remove(log_path)
file_handler = logging.FileHandler(log_path)
+ file_handler.setLevel(self.get_logger_level(log_level))
file_handler.setFormatter(self.get_log_formatter(log_format=log_format,
date_format=date_format))
self.logger.addHandler(file_handler)
self.all_handlers.append(file_handler)
def log_message(self, message, level=INFO, exit_code=-1, post_fatal_callback=None):
"""Generic log method.
There should be more options here -- do or don't split by line,
--- a/mozharness/mozilla/building/buildbase.py
+++ b/mozharness/mozilla/building/buildbase.py
@@ -1323,17 +1323,21 @@ or run without that action (ie: --no-{ac
'.zip',
)
# Some trees may not be setting uploadFiles, so default to []. Normally
# we'd only expect to get here if the build completes successfully,
# which means we should have uploadFiles.
files = self.query_buildbot_property('uploadFiles') or []
if not files:
- self.warning('No files to upload to S3: uploadFiles property is missing or empty.')
+ self.warning('No files from the build system to upload to S3: uploadFiles property is missing or empty.')
+
+ # Also upload our mozharness log files
+ files.extend([os.path.join(self.log_obj.abs_log_dir, x) for x in self.log_obj.log_files.values()])
+
for upload_file in files:
# Create an S3 artifact for each file that gets uploaded. We also
# check the uploaded file against the property conditions so that we
# can set the buildbot config with the correct URLs for package
# locations.
tc.create_artifact(task, upload_file)
if upload_file.endswith(valid_extensions):
for prop, condition in property_conditions:
--- a/mozharness/mozilla/taskcluster_helper.py
+++ b/mozharness/mozilla/taskcluster_helper.py
@@ -70,16 +70,17 @@ class Taskcluster(LogMixin):
"workerId": self.buildbot,
})
def create_artifact(self, task, filename):
mime_types = {
".asc": "text/plain",
".checksums": "text/plain",
".json": "application/json",
+ ".log": "text/plain",
".tar.bz2": "application/x-gtar",
".txt": "text/plain",
".xpi": "application/x-xpinstall",
".zip": "application/zip",
}
mime_type = mime_types.get(os.path.splitext(filename)[1], 'application/octet-stream')
content_length = os.path.getsize(filename)