Merge lp:~javier.collado/ubuntu-test-runlists/jenkins-smoketest-setup-logpath into lp:~canonical-ci-engineering/ubuntu-test-runlists/jenkins-smoketest-setup

Proposed by Javier Collado
Status: Merged
Approved by: Max Brustkern
Approved revision: 58
Merged at revision: 48
Proposed branch: lp:~javier.collado/ubuntu-test-runlists/jenkins-smoketest-setup-logpath
Merge into: lp:~canonical-ci-engineering/ubuntu-test-runlists/jenkins-smoketest-setup
Diff against target: 68 lines (+15/-19)
2 files modified
setup-jobs.py (+0/-5)
templates/smoke.xml.jinja (+15/-14)
To merge this branch: bzr merge lp:~javier.collado/ubuntu-test-runlists/jenkins-smoketest-setup-logpath
Reviewer Review Type Date Requested Status
Max Brustkern (community) Approve
Review via email: mp+156526@code.launchpad.net

Description of the change

This branch updates the script that generates the smoke testing jobs to include
`logpath` in the configuration file that is created on the fly. This way,
syslog files are written to the workspace and there isn't any reuse of files
from `/var/log/utah` to avoid problems such as the one in bug1160696.

To verify the changes work fine, I've created a few temporary jobs in the
private jenkins instance whose name is the same as the smoke testing ones with
the `jcollado-` prefix. They have been working correctly for the last three
daily images, so I think the changes are ready to be merged.

To post a comment you must log in.
Revision history for this message
Max Brustkern (nuclearbob) wrote :

It looks like this won't grab other log files mentioned by the output of run_utah_tests, such as a preseed file, or any files fetched with the --files argument. I guess we could use --outdir to make sure all the fetched files end up in the right place. I'm not sure if the preseed file will automatically use outdir or not, but maybe it should.

Revision history for this message
Javier Collado (javier.collado) wrote :

@Max

Thanks for pointing that out. I'll review where those files will be stored if requested.

Revision history for this message
Javier Collado (javier.collado) wrote :

I've run a test with `--outputpreseed --files /etc/lsb_release` and both of
them were stored in the log directory after the test execution.

Looking at the code, I see that for the preseed `config.logpath` is always used
to figure out were to write the file. Regarding the `--files` option, I see
that config.logpath is used by default unless `--outdir` is specified.

In my opinion the `outdir` should be used also for the preseed if defined to
store that file in some other location because that preseed isn't really a log
file.

Anyway, for the main concern about this merge request, I think we're safe. For
the future, defining an `outdir` in the configuration file generated on the fly
and updating UTAH code to use it for the preseed would be nice to separate log
files and data files.

Revision history for this message
Max Brustkern (nuclearbob) wrote :

I think your suggestions for future improvements are good, and your test results indicate we should be ready to merge.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'setup-jobs.py'
2--- setup-jobs.py 2013-03-27 11:28:47 +0000
3+++ setup-jobs.py 2013-04-02 11:40:20 +0000
4@@ -284,11 +284,6 @@
5
6 command = command.format(arch=arch)
7 jobtype = 'script' if scripts_url else 'runlist'
8- jobname = '-'.join((args.series, installtype, arch,
9- 'smoke', name))
10- if args.prefix:
11- jobname = '{}-{}'.format(args.prefix, jobname)
12- logging.info('Processing job ' + jobname)
13
14 template = environment.get_template('smoke.xml.jinja')
15 smokexml = template.render(name=name,
16
17=== modified file 'templates/smoke.xml.jinja'
18--- templates/smoke.xml.jinja 2013-03-27 11:02:34 +0000
19+++ templates/smoke.xml.jinja 2013-04-02 11:40:20 +0000
20@@ -23,14 +23,18 @@
21 UTAH_CONFIG_DIR=${WORKSPACE}/config
22 mkdir -p ${UTAH_CONFIG_DIR}
23 UTAH_CONFIG_FILE=${UTAH_CONFIG_DIR}/utah.cfg
24-UTAH_LOG_FILE=${WORKSPACE}/utah-server.log
25-UTAH_DEBUGLOG_FILE=${WORKSPACE}/utah-server-debug.log
26-UTAH_SSH_LOG_FILE=${WORKSPACE}/utah-server-ssh.log
27+LOG_DIR=${WORKSPACE}/log
28+mkdir -p ${LOG_DIR}
29+chmod a+w ${LOG_DIR}
30+UTAH_LOG_FILE=${LOG_DIR}/utah-server.log
31+UTAH_DEBUGLOG_FILE=${LOG_DIR}/utah-server-debug.log
32+UTAH_SSH_LOG_FILE=${LOG_DIR}/utah-server-ssh.log
33 cat <<EOF > ${UTAH_CONFIG_FILE}
34 {
35 "debuglog": "${UTAH_DEBUGLOG_FILE}",
36 "logfile": "${UTAH_LOG_FILE}",
37- "ssh_logfile": "${UTAH_SSH_LOG_FILE}"
38+ "ssh_logfile": "${UTAH_SSH_LOG_FILE}",
39+ "logpath": "${LOG_DIR}"
40 }
41 EOF
42 for file in $UTAH_LOG_FILE $UTAH_DEBUGLOG_FILE $UTAH_SSH_LOG_FILE; do
43@@ -38,18 +42,15 @@
44 chmod a+w ${file}
45 done
46
47-sudo -u utah -i UTAH_CONFIG_DIR=${UTAH_CONFIG_DIR} {{command}} -x /etc/utah/bridged-network-vm.xml > utah-server-stdout.log
48+sudo -u utah -i UTAH_CONFIG_DIR=${UTAH_CONFIG_DIR} {{command}} -x /etc/utah/bridged-network-vm.xml > ${LOG_DIR}/utah-server-stdout.log
49 RETCODE=$?
50
51-# Gather logs
52-# Log files from the client are in the server stdout prefixed with a tab character
53-CLIENT_LOG_FILES=$(grep -P "^\t/" utah-server-stdout.log | sed 's/^\t//' | xargs)
54-mkdir clientlogs
55-cp ${CLIENT_LOG_FILES} clientlogs
56-MACHINE_NAME=$(grep "^Running on machine:" utah-server-stdout.log | sed 's/^Running on machine: //')
57-SYSLOG_FILE=${MACHINE_NAME}.syslog.log
58-sudo cp /var/log/utah/${SYSLOG_FILE} .
59-sudo chmod a+r ${SYSLOG_FILE}
60+# Make sure syslog file is readable to add it as artifact
61+[ -n "$(find ${LOG_DIR} -name '*.syslog.log')" ] && sudo -u utah chmod a+r ${LOG_DIR}/*.syslog.log
62+
63+# Move yaml file directory to the workspace since it's not a log file, but a
64+# results files
65+[ -n "$(find ${LOG_DIR} -name '*.yaml')" ] && mv ${LOG_DIR}/*.yaml ${WORKSPACE}
66
67 exit $RETCODE
68 </command>

Subscribers

People subscribed via source and target branches

to all changes: