3

One of our web apps is deployed to a number of different servers for access by users at that site. We use Trac to manage the bugs/work items, but we're looking for a way to automate the release notes so that users whose server is upgraded will see a little notification about when they received their upgrade and a way to browse some kind of document - HTML or XML - which was extracted from Trac at the time of the build with all the items.

Ideally, we would have a post-build step which would extract from Trac the RSS XML based on the version x.y.z from the main assembly, save it as releasenotes.xml which after deployment with the binaries, templates etc will reside in production.

The web server then can display it within its installation.

My problem is that our Trac is not public (not even to all these users who don't have accounts in Trac, otherwise, we could point them at reports in Trac and they could log in as themselves to read them) and we can't automate this extraction because it requires a forms authentication process - I can't find a readonly RSS feed which doesn't require authentication.

Anyone solve that problem? Or is there another approach I should consider?

I currently having it working with curl and grep in a command script. I get the token from the login page, then login to get authentication cookies and then pull the RSS for the desired report. Obviously this is sensitive to the user/password/__FORM_TOKEN structure of the login form.

10
  • can you clarify what you mean with trac not being public? Does that mean your buildserver cannot connect you your trac? Commented Aug 13, 2012 at 21:11
  • @wimmel It requires password authentication with Trac's forms system. Commented Aug 13, 2012 at 21:18
  • Can you create an account within Trac that you can use for the release notes? Commented Aug 14, 2012 at 1:50
  • @JoshLaase Yes. I am creating a read-only account in Trac. Then I will write a script to logon to the web interface using curl and request the RSS. I have not yet found an easier way. Commented Aug 14, 2012 at 3:00
  • What programming languages do you have the ability to use as part of the extraction of release notes? Are you able to use C#, python or Ruby? I have done a similar process of automating the extraction of tickets using C#. If you want, I can put down all of my steps and links on how I did this. Commented Aug 14, 2012 at 13:08

1 Answer 1

1
+150

Most likely, the XMLRPC plugin will be your friend here.

Trac-hacks is down at the moment so the full documentation isn't currently available, but here is a short Python script that might get you started (handling errors and invalid input is left as an exercise to the reader).

#!/usr/bin/python
# Fetch a Trac page via RPC
# Usage: fetchpage.py <wiki page name> <output file>

import sys
from xmlrpclib import ServerProxy

# Extract info from CLI args
page_title = sys.argv[1]
output_filename = sys.argv[2]

# Authenticate with Trac and fetch the specified wiki page
p = ServerProxy('http://UserName:[email protected]/login/rpc')
page = p.wiki.getPageHTML(page_title)

# Write page to file
with open(output_filename,'w') as outfile:
    outfile.write(page)

After executing the script with "./fetchpage.py 'ReleaseNotes/x.y.z' changelog.html", the file changelog.html will contain the content of the specified wiki page, pre-rendered into HTML. The toolbars and page header/footer are not included.

This assumes that you have a wiki page named ReleaseNotes/x.y.z that contains the release notes for the x.y.z release. Personally, I've found it easier to use a wiki page to create a release notes document (using macros) than to parse the RSS and do it manually. You can take this output, embed a CSS stylesheet into it, and have an attractive-looking changelog in HTML format that's ready to be distributed to users.

Note that the account being used here will need the XML_RPC permission in addition to the normal set of permissions for read access.

Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.