Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    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?

    Scheduled Pinned Locked Moved Support
    powershellbuildmasterapi
    7 Posts 1 Posters 15 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ? This user is from outside of this forum
      Guest
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        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&...

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • ? This user is from outside of this forum
              Guest
              last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • ? This user is from outside of this forum
                Guest
                last edited by

                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, ...)

                1 Reply Last reply Reply Quote 0
                • ? This user is from outside of this forum
                  Guest
                  last edited by

                  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!

                  1 Reply Last reply Reply Quote 0

                  Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                  Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                  With your input, this post could be even better 💗

                  Register Login
                  • 1 / 1
                  • First post
                    Last post
                  Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation