Skip to content

Enable OS process IO logging + upload for Travis and Jenkins tests#598

Merged
nickva merged 1 commit into
masterfrom
enable-io-logging-and-log-upload-for-couchjs-failures
Jun 14, 2017
Merged

Enable OS process IO logging + upload for Travis and Jenkins tests#598
nickva merged 1 commit into
masterfrom
enable-io-logging-and-log-upload-for-couchjs-failures

Conversation

@nickva
Copy link
Copy Markdown
Contributor

@nickva nickva commented Jun 14, 2017

Enabled OS process IO logging by setting COUCHDB_IO_LOG_DIR=/tmp/couchjslogs

Both Travis and Jenkins then clear and create that directory before tests run.

Also logfile-uploader.py was the modified to upload any log files from that directory.

Issue #551

Comment thread Jenkinsfile Outdated
cwd=$(pwd)
rm -rf /tmp/couchjslogs
mkdir -p /tmp/couchjslogs
export COUCHDB_IO_LOG_DIR=/tmp/couchjslogs
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You want this envvar in the environment {} block at the top of the file so you don't have to repeat yourself 10 times.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it there at first but noticed the tests were run in a withDockerContainer clause and wasn't sure environment vars would propagate into that environment

Comment thread build-aux/logfile-uploader.py Outdated
for log in glob.glob('dev/logs/node1.log'):
tb.add(log)
# couchjs OS process IO logs
if os.path.isdir(OSPROC_IO_LOG_DIR):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for this check, if the directory doesn't exist, glob.glob will return []:

$ ls -la /tmp/abc/def
ls: cannot access /tmp/abc/def: No such file or directory
$ python
Python 2.7.9 (default, Jun 29 2016, 13:08:31)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import glob
>>> glob.glob("/tmp/abc/def/*")
[]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Agreed

Comment thread .travis.yml
# Then comment this section out
before_script:
- rm -rf /tmp/couchjslogs
- mkdir -p /tmp/couchjslogs
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally, I prefer mktemp for this, but given how annoying that will be to setup and pass as an env var in Jenkins, this approach is fine.

@wohali
Copy link
Copy Markdown
Member

wohali commented Jun 14, 2017

+1 with the changes mentioned.

@nickva nickva force-pushed the enable-io-logging-and-log-upload-for-couchjs-failures branch from 068c7b1 to f8d44b8 Compare June 14, 2017 21:28
@nickva nickva force-pushed the enable-io-logging-and-log-upload-for-couchjs-failures branch from f8d44b8 to f74c0b3 Compare June 14, 2017 21:30
@nickva nickva merged commit 73f6b18 into master Jun 14, 2017
@nickva nickva deleted the enable-io-logging-and-log-upload-for-couchjs-failures branch June 14, 2017 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants