Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

Promoting builds outside of the UI. Perhaps using the API?



  • We're looking for a way to signal a build promotion via some means external to buildmaster's deploy plans. Anything that can be run with command line or powershell will do.
    Last we left off, we looked into loading the buildmaster API into powershell to see if it had any such functions, but we weren't familiar enough with that, and we couldn't quite figure it out. We're also looking into using the database's stored procedure, Builds_PromoteBuild, to accomplish this.
    If there's a standard way of handling this situation, please let me know. If there's anything I should specify, please let me know, as well.



  • This can be done with the API (which basically just wraps the stored procedures anyway). It may be easiest to call the Builds_PromoteBuild method in the new JSON API at http://buildmaster/api/json

    You can call it using HTTP GET with the parameters listed on http://buildmaster/api/json:

    http://buildmaster/api/json/Builds_PromoteBuild?API_Key=yourkey&Application_Id=1&Release_Number=1.0.0&...



  • Thank you!
    I think, for the time being, we're looking into calling that Builds_PromoteBuild Stored Proc. It was good to have you verify it, for us.
    our current issue:
    using the stored proc Builds_PromoteBuild as is, we've been encountering errors running it through SQL Server Management Studio, and it's related to not having a populated User Name. The DB function Session_GetUserName is supposed to do this for us, but we're not sure where that function's "CONTEXT_INFO()" is coming from, and we're not sure if we'll have that in the application we'll be using to launch the stored proc.
    I'm not entirely sure how to address this, but we do know setting the '[PromotedBy_Name]' as something with an edited version of the proc works fine. We just didn't think it would be kosher to make that our solution.



  • The CONTEXT_INFO is simply set to the user name of the user performing an action (or SYSTEM if none present e.g. via the API) by our data model before any proc is called. If you really wanted to call the proc, you could set that value beforehand:

    http://msdn.microsoft.com/en-us/library/ms187768.aspx

    I would recommend the API though since these are internal implementation details and could change at any time.



  • Duly noted.
    I looked for the JSON Api at the url you've listed, and haven't found anything. If it's contained in the newest version of buildmaster, we've been holding off on upgrading in case there are any major changes which would disrupt our deploys in process. We're on 2.6.3.7, and I wasn't able to find it in our directories, either.

    After we figure out where to get the API from, are there any examples we could use which include and use it in powershell? If not, I've happened upon some examples to use for build a .NET web around it, but we would feel a little more comfortable making a script of some sort. a full web might be overkill.



  • Sorry about that, I should have noted that the JSON API was new in v3.1. To load it into PowerShell, should be relatively painless:

    $cred = Get-Credential "$env:USERDOMAIN`$env:USERNAME"
    $m = New-WebServiceProxy -uri "http://buildmaster/api.asmx?WSDL" -credential $cred
    $m.Builds_PromoteBuild($appId, ...)



  • Awesome!
    It looks like the API is working without a hitch in powershell. At this point, we probably have enough to to start with and a few angles to test. If we have any issues with the API or procs, we'll come back here.

    Thank you!



Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation