TT#11544 wni: use workfront-jenkins-update to send notes

* add branch info to messages
* WORKFRONT_NOTE = True for prod

Change-Id: Idb78932c262b3eb384d0f15c003e8c5c88761e57
changes/81/11681/2
Victor Seva 9 years ago
parent cf809ffd89
commit 49937d2328

@ -91,9 +91,9 @@ def workfront_note_manage(sender, **kwargs):
if instance.jobname.endswith("-get-code") and \
instance.result == "SUCCESS":
if instance.gerrit_eventtype == 'change-merged':
msg = "review merged"
msg = "[%s] review merged"
elif instance.gerrit_eventtype == 'patchset-created':
msg = "review created"
msg = "[%s] review created"
else:
msg = "commit created"
workfront_note_add(instance, msg)
msg = "[%s] commit created"
workfront_note_add(instance, msg % (instance.param_branch))

@ -65,7 +65,7 @@ GERRIT_REST_HTTP_PASSWD = gerrit_config.get('gerrit', 'HTTP_PASSWD')
GITWEB_URL = "https://git.mgm.sipwise.com/gitweb/?p={}.git;a=commit;h={}"
WORKFRONT_CREDENTIALS = os.path.join(BASE_DIR,
'/etc/jenkins_jobs/workfront.ini')
WORKFRONT_NOTE = False
WORKFRONT_NOTE = True
# celery
BROKER_URL = server_config.get('server', 'BROKER_URL')
JBI_BASEDIR = os.path.join(VAR_DIR, 'jbi_files')

@ -83,7 +83,9 @@ class WorkfrontNoteTestCase(BaseTest):
workfront_id="0001",
gerrit_change="2054")
self.assertEquals(gri.count(), 1)
msg = "review created %s" % settings.GERRIT_URL.format("2054")
msg = "[%s] review created %s" % (
param['param_branch'],
settings.GERRIT_URL.format("2054"))
utils.assert_called_once_with("0001", msg)
@patch('repoapi.utils.workfront_note_send')
@ -109,7 +111,9 @@ class WorkfrontNoteTestCase(BaseTest):
workfront_id="0001",
gerrit_change="7fg4567")
self.assertEquals(gri.count(), 0)
msg = "review created %s" % settings.GERRIT_URL.format("2054")
msg = "[%s] review created %s" % (
param['param_branch'],
settings.GERRIT_URL.format("2054"))
utils.assert_called_once_with("0001", msg)
param['jobname'] = "kamailio-get-code"
@ -126,7 +130,9 @@ class WorkfrontNoteTestCase(BaseTest):
workfront_id="0001",
gerrit_change="2054")
self.assertEquals(gri.count(), 2)
msg = "review merged %s" % settings.GERRIT_URL.format("2054")
msg = "[%s] review merged %s" % (
param['param_branch'],
settings.GERRIT_URL.format("2054"))
utils.assert_called_with("0001", msg)
@patch('repoapi.utils.workfront_note_send')
@ -148,6 +154,7 @@ class WorkfrontNoteTestCase(BaseTest):
workfront_id="0001",
gerrit_change="7fg4567")
self.assertEquals(gri.count(), 1)
msg = "commit created %s" % settings.GITWEB_URL.format(
"kamailio", "7fg4567")
msg = "[%s] commit created %s" % (
param['param_branch'],
settings.GITWEB_URL.format("kamailio", "7fg4567"))
utils.assert_called_once_with("0001", msg)

@ -126,13 +126,12 @@ def jenkins_get_artifact(jobname, buildnumber, artifact_info):
def workfront_note_send(_id, message):
command = [
"/usr/bin/workfront-post-note",
"/usr/bin/workfront-jenkins-update",
"--credfile=%s" % settings.WORKFRONT_CREDENTIALS,
"--private",
"--taskid=%s" % _id,
'--message="%s"' % message
]
logger.debug("workfront-port-note command: %s", command)
logger.debug("workfront-jenkins-update command: %s", command)
res = executeAndReturnOutput(command)
if res[0] != 0:
logger.error("can't post workfront note. %s. %s", res[1], res[2])

Loading…
Cancel
Save