Dashboard > Pulse v2.1 > ... > Remote API Examples > Python Example - Setting the Next Build Number
  Pulse v2.1 Log In | Sign Up   View a printable version of the current page.  
  Python Example - Setting the Next Build Number
Added by Jason Sankey, last edited by Jason Sankey on Aug 23, 2009
Labels: 
(None)

Pulse Manual Index

Overview

Sets the next build number for a project. Note that build numbers must always increase, so there is no way to wind back the number.

Code

#! /usr/bin/env python

from xmlrpclib import ServerProxy, Error
import sys

# Replace with your actual details
PULSE_HOST     = "pulse:8080"
PULSE_USER     = "admin"
PULSE_PASSWORD = "secret"


def set_next_build_number(project, number):
    server = ServerProxy("http://" + PULSE_HOST + "/xmlrpc")
    try:
        token = server.RemoteApi.login(PULSE_USER, PULSE_PASSWORD)
        server.RemoteApi.setNextBuildNumber(token, project, number)
        server.RemoteApi.logout(token)
    except Error, v:
        print "Error:", v


if __name__ == "__main__":
    if len(sys.argv) < 3:
        print "Usage: %s <project> <number>" % sys.argv[0]
        sys.exit(1)

    set_next_build_number(sys.argv[1], sys.argv[2])

Zutubi wiki is Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.10 Build:#528 Nov 29, 2006) - Bug/feature request - Contact Administrators