Skip to content

Commit

Permalink
Show logs after popper check failure
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
ivotron committed Dec 20, 2017
1 parent 3428a97 commit c633132
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 10 additions & 2 deletions popper/_check/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def execute(stage, timeout):
return p.poll()


def check_pipeline(skip, timeout):
def check_pipeline(skip, timeout, exit_on_fail=True, show_logs_on_fail=True):
check_output('rm -rf popper_logs/ popper_status', shell=True)
check_output('mkdir -p popper_logs/', shell=True)

Expand All @@ -57,8 +57,13 @@ def check_pipeline(skip, timeout):
ecode = execute(stage, timeout)

if ecode != 0:
print("Stage {} failed. Check logs for details.".format(stage))
print("Stage {} failed.".format(stage))
STATUS = "FAIL"
if show_logs_on_fail:
print("Logs for {}:.".format(stage))
for t in ['.err', '.out']:
with open('popper_logs/{}{}'.format(stage, t), 'r') as f:
print(f.read())
break

if stage == 'validate.sh':
Expand All @@ -76,6 +81,9 @@ def check_pipeline(skip, timeout):

print('status: ' + STATUS)

if STATUS == 'FAIL' and exit_on_fail:
sys.exit(1)


class Unbuffered(object):
def __init__(self, stream):
Expand Down
14 changes: 3 additions & 11 deletions popper/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,9 @@ import (

var travisYaml = `---
language: python
python:
- '2.7'
services:
- docker
install:
- curl -O https://raw.githubusercontent.com/systemslab/popper/master/popper/_check/check.py
- chmod 755 check.py
python: 2.7
services: docker
install: curl -O https://raw.githubusercontent.com/systemslab/popper/master/popper/_check/check.py && chmod 755 check.py
script: ./check.py
`

Expand Down

0 comments on commit c633132

Please sign in to comment.