Created
September 7, 2015 15:48
-
-
Save andriisoldatenko/4e1f4c941e19e4fc81e2 to your computer and use it in GitHub Desktop.
Fabric decorator for build script interaction with TeamCity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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