Skip to content

Instantly share code, notes, and snippets.

@legoktm
Created February 22, 2015 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save legoktm/490e03e74dbeab0645fc to your computer and use it in GitHub Desktop.
Save legoktm/490e03e74dbeab0645fc to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import os
import subprocess
def shell_exec(args):
print(' '.join(args))
return subprocess.check_output(args).decode()
jj = '/home/km/python/bin/jenkins-jobs'
jjb = '/home/km/projects/jenkins-job-builder'
conf = '/home/km/projects/integration-config'
os.chdir(conf)
out = shell_exec(['git', 'log', '--oneline', '-n', '1'])
testing_sha1 = out.split(' ', 1)[0]
os.chdir(jjb)
shell_exec([jj, 'test', 'config', '-o', 'output-proposed'])
os.chdir(conf)
shell_exec(['git', 'checkout', 'HEAD~1'])
os.chdir(jjb)
shell_exec([jj, 'test', 'config', '-o', 'output-parent'])
subprocess.call(['colordiff', '--new-file', '-u', 'output-parent',
'output-proposed'])
os.chdir(conf)
shell_exec(['git', 'checkout', testing_sha1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment