Search code examples
buildbot

New file in template is not accessed


I am trying to display results in a web page. I want to link this from the waterfall page of buildbot. But when I use<a href="link to the page">click</a> , the required web page does not open. I have placed this new web page in the templates directory. Is there something more that needs to be done?


Solution

  • Since the results you want to display are produced by one of your builds, the waterfall web templates are not relevant, since they are templates for the whole waterfall, including all builds, whether or not they are builds that produce these particular results.

    If you wish to provide links to some files generated by a build, you select a buildstep in the build, or create one for the purpose, that will provide those links within its status box in the waterfall display (e.g. in the way that a ShellCommand buildstep provides a link to its stdio log). For example, you might just add a final step to the build with the description Report or Publish.

    You must write a customized BuildStep class to execute the step that you select or create. Your customized BuildStep class must be derived from LoggingBuildStep, or from a class, such as ShellCommand, that is already derived from LoggingBuildStep.

    The necessary customization is to override the createSummary method with your own implementation, and in that implementation call the addURL method to adds URL(s) to the file(s) you want to publish to the buildstep's status box. You can add as many URLs as you like. Here is an outline example:

    class ReportingStep(ShellCommand):
        ...
        command = ['upload','report',to','some','server']
        ...
        def createSummary(self,log):
            ...
            url = "url/to/the/report/on/the/server"
            self.addURL("Report", url)
    

    Now, when ReportingStep completes, its status box will contain a link labelled Report to the report that the step has uploaded to the server.

    Google "buildbot buildstep createSummary" for more leads.

    What if my files are saved locally and for now I just want the user to have a link to download the zipped files? From what I understand, the above customization will help provide an external url.

    The user clicks a link that is served from your buildmaster. If your build just saves these files locally, then they're saved on the buildslave. So unless your buildslave is on the same machine as the buildmaster then the link has to be URL to an "external" file.

    On the other hand, if your buildstep uploads the file to the buildmaster, then the link can be a link to local file - local on the buildmaster, which is serving the link.

    If your buildslave is on the same machine as your buildmaster, then obviously you don't need to do any uploading:

    addURL("Report",file:///path/to/the/zipfile.zip)
    

    But remember, if you want the content at these links to be persistent then /path/to/the/zipfile.zip had better not be somewhere that gets clobbered by every build.