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!

    How do I schedule a release package trigger based on Mercurial check-in?

    Scheduled Pinned Locked Moved Support
    mercurialbuildmastertriggered-buildssource-control
    4 Posts 2 Posters 9 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

      I want BuildMaster to deploy to our DEV environment automatically whenever someone pushes a new revision to our Mercurial repository. When I go to the "Release Package Triggers" section under the Settings for my application (http://buildmaster/applications/1/schedules), I click "Create New SCM Trigger". BuildMaster says there are no Source Control Providers set up in BuildMaster. This is true, but I do have the Mercurial extension installed. Do I have to configure a Source Control Provider for this? I'd like to avoid doing so because they are deprecated. In addition, it seems like the Source Control Provider dialog doesn't allow you to specify a resource credential, so I would have to inject the credentials in the Remote URL field ("http://user@pass:my.repo.com"). There are two reasons I don't want to do this:

      1. I don't want to expose the credentials like that in BuildMaster.
      2. When I tried using the http://user@pass:my.repo.com syntax, BuildMaster couldn't parse it -- probably because the password contains some unusual characters.

      Product: BuildMaster
      Version: 5.6.11

      1 Reply Last reply Reply Quote 0
      • benB Offline
        ben inedo-engineer
        last edited by

        Hello Glenn,

        For now, the “Release Package Triggers” only work with legacy source control providers. It’s certainly on our roadmap to update this module so that there’s a more natural integration point.

        But until then, the best solution is to use a changegroup hook in Mercurial, and the Release/Package API. To do this,

        1. Create a key at http://buildmaster/administration/api-keys with at least the Grant access to Release & Deployment API box checked.
        2. Create a file with the following contents somewhere in the PYTHONPATH of your Mercurial server:
          import urllib
          import httplib
          import json
          
          api_key = 'YOUR_API_KEY'
          app_id = 1
          
          def create_package(ui, repo, **kwargs):
              h = httplib.HTTPConnection('buildmaster')
              h.request('GET', '/api/releases?' + urllib.urlencode({'key': api_key, 'applicationId': app_id, 'status': 'active'}))
              releases = json.loads(h.getresponse().read())
              h.request('POST', '/api/releases/packages/create?' + urllib.urlencode({'key': api_key, 'releaseId': releases[0]['id']}))
              resp = h.getresponse()
              if resp.status != 200:
                  print resp.status, resp.reason
                  print resp.read()
              else:
                  resp.read()
              h.close()
          
        3. Add this to .hg/hgrc on the Mercurial server:
          [hook]
          changegroup.buildmaster = python:path.to.create_package
          
        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          I can't get that to work, but I'm no Python hacker.

          How long until this is implemented? I was doing this years ago with BuildMaster but somehow over time this basic functionality became impossible?

          Is there a Legacy Mercurial extension available that I can use in the meantime?

          1 Reply Last reply Reply Quote 0
          • benB Offline
            ben inedo-engineer
            last edited by

            The legacy source provider is available in the same Mercurial extension. As long as the provider has Log command line arguments disabled, the Admin_ConfigureBuildMaster permission is required to see the URL with the password in it.

            If the username or password has special characters that don't work in URLs, they can be encoded. Common characters that cannot be used in the username/password section of a URL without encoding include:

            • \ (use %5C)
            • / (use %2F)
            • @ (use %40)
            • : (use %3A, but don't encode the colon between the username and the password)
            • % (use %25, but only if the percent sign is part of the username/password and not one of the above replacements)
            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