Page MenuHomePhabricator

Zuul: Implement support for customizing status_url to include the change.id
Open, LowPublic

Description

Timo worked on a patch for the Zuul status page which let one pass the ChangeId,Patchset to the URL which would highlight it on the status page.

The URL looks like:

https://integration.wikimedia.org/zuul/#change-124992,2

When Zuul start proceeding a change in a pipeline it will report:

Starting gate-and-submit jobs.
https://integration.wikimedia.org/zuul/

That URL is crafted by the scheduler:

if self.sched.config.has_option('zuul', 'status_url'):
    msg += "\n" + self.sched.config.get('zuul', 'status_url')

Where status_url is set to https://integration.wikimedia.org/zuul/

What we would need is to use format() much like for url_pattern and pass the change and patchset numbers.

We can do it as a hack on our Zuul fork and propose it upstream.


Version: wmf-deployment
Severity: enhancement

Details

Reference
bz63744

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:11 AM
bzimport set Reference to bz63744.
hashar created this task.Apr 9 2014, 8:02 PM

Sent to upstream as https://review.openstack.org/86900 . Most of them are attending the US Python Conference so there will be most probably a bunch of delay before it is being reviewed.

Whenever they are happy with the change I will cherry-pick to our fork.

Patch review requested a test to be added to confirm status_url is properly formatted. I amended my patch.

The patch I proposed upstream breaks their test suite. I dont have bandwidth right now to complete the patch :(

Patch is https://review.openstack.org/#/c/86900/

I'm not sure how that change relates to yours?

We fetch the status of all changes and display them on https://integration.wikimedia.org/zuul/. I updated our client several months ago to take an identifier by url and highlight it on the page (24dea9aaf8). E.g.

https://integration.wikimedia.org/zuul/#change-178081,1

What we need is to customise the url reported to Gerrit via jenkins-bot (which your change proposed). Then pass the current changeset/patchset in its url to the Zuul status page. The handling of that id once on the other side (e.g. whether to display only one change or all with the one highlighted) is a separate issue (could even be worked around by fetching all and filtering client-side).

hashar added a comment.Dec 8 2014, 9:59 AM

Sorry I got confused. This task would be fixed by https://review.openstack.org/#/c/86900/ which I have rebased and fixed.

The other change (merged and deployed) let us retrieves a specific change from the status.json page. The idea is to add to the Gerrit web interface a way to dynamically shows jobs being run for the change being looked at.

hashar added a comment.Dec 8 2014, 7:47 PM

I might be able to cherry-pick that patch on our production setup. I attempted it earlier this afternoon but pushed some wrong reference which caused a few jobs failure. Have to be careful :-]

demon removed a subscriber: demon.Dec 16 2014, 6:05 PM
hashar removed hashar as the assignee of this task.Mar 17 2015, 9:35 AM
Krinkle moved this task from Backlog to Enhancements on the Zuul board.Apr 15 2015, 7:48 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 17 2015, 5:39 AM

I've done some work on the Zuul status page again recently. If we can get this field working again in Zuul, I'd be willing to bring back the UI for it as well (parent task).

That has been implemented upstream a9f771450204da042af685f34b8d5f39206efde1 https://gerrit.wikimedia.org/r/plugins/gitiles/integration/zuul/+/a9f771450204da042af685f34b8d5f39206efde1

--- a/zuul/reporter/__init__.py
+++ b/zuul/reporter/__init__.py
@@ -128,8 +128,13 @@ class BaseReporter(object, metaclass=abc.ABCMeta):
     def _formatItemReportStart(self, item, with_jobs=True):
         status_url = get_default(self.connection.sched.config,
                                  'web', 'status_url', '')
-        return item.pipeline.start_message.format(pipeline=item.pipeline,
-                                                  status_url=status_url)
+        if status_url:
+            status_url = item.formatUrlPattern(status_url)
+
+        return item.pipeline.start_message.format(
+            pipeline=item.pipeline.getSafeAttributes(),
+            change=item.change.getSafeAttributes(),
+            status_url=status_url)
 
     def _formatItemReportSuccess(self, item, with_jobs=True):
         msg = item.pipeline.success_message

When our version has:

zuul/reporter/__init__.py
def _formatItemReportStart(self, pipeline, item):
    msg = "Starting %s jobs." % pipeline.name
    if self.sched.config.has_option('zuul', 'status_url'):
        msg += "\n" + self.sched.config.get('zuul', 'status_url')
    return msg