Skip to content

Instantly share code, notes, and snippets.

@andriisoldatenko
Created September 7, 2015 15:48
Show Gist options
  • Select an option

  • Save andriisoldatenko/4e1f4c941e19e4fc81e2 to your computer and use it in GitHub Desktop.

Select an option

Save andriisoldatenko/4e1f4c941e19e4fc81e2 to your computer and use it in GitHub Desktop.
Fabric decorator for build script interaction with TeamCity
from functools import wraps
def teamcity_messages(f):
"""
Decorator for Build Script Interaction with TeamCity
https://confluence.jetbrains.com/display/
TCD9/Build+Script+Interaction+with+TeamCity
"""
@wraps(f)
def wrapper(*args, **kwds):
msg = f.__name__.replace('_', ' ')
print "##teamcity[blockOpened name='%s']" % msg
print "##teamcity[progressStart '%s']" % msg
fn = f(*args, **kwds)
print "##teamcity[progressFinish '%s']" % msg
print "##teamcity[blockClosed name='%s']" % msg
return fn
return wrapper
@task
@teamcity_messages
def actual_task():
print 'actual_task'
@task
@teamcity_messages
def actual_task2():
print 'actual_task2'
@task
def deploy():
actual_task()
actual_task2()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment