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!

    Pre-Deployment Approval Check that compares the version of my database (a value stored in the database itself) with the $ReleaseNumber and $BuildNumber.

    Scheduled Pinned Locked Moved Support
    buildmaster
    4 Posts 1 Posters 1 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

      My goal is a Pre-Deployment Approval Check that compares the version of my database (a value stored in the database itself) with the $ReleaseNumber and $BuildNumber. The value stored in the database is like 1.2.34567. I will need to do a $ReleaseNumber >= 1.2 AND $BuildNumber > 34567 comparison.

      I have attempted to do this by implementing a variable function in a custom extension but don't have the understanding to get this working or know if this is the best approach.

      Can you please suggest a method to achieve my goal (or an alternative approach) and provide any source code examples that might be applicable.

      Product: BuildMaster
      Version: 4.8.4

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

        Hi Jake, great question.

        The best way to accomplish this is to Create a Custom Extension, and then create a class that inherits from PromotionRequirementBase.

        The GetStatus method provides a PromotionContext that has the BuildNumber and ReleaseNumber, and then return the appropriate PromotionRequirementStatus, based on your database query.

        Once this class is implemented and you get the extension in BuildMaster, it will appear on the "add new pre-approval" item list.

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

          Hi Alana,

          Is it possible to share the source code of a Promotion Requirement that BuildMaster has implemented itself?

          What is your suggestion to handle different database connection strings? I see the PromotionContext provides CurrentEnvironmentId and TargetEnvironmentId, I could hard code connection strings into the extension based on environments. Is there a way to pass a connection string or read a variable in the GetStatus method?

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

            Sure, happy to share the source, though you're welcome to use a disassembler or reflection tool as well -- easiest thing would to fill out the Source Code Request and we'll email it on over.

            If you only ever had a single, well-known database to work with, then hard-coding the connection string isn't too bad of an idea. You can always just update the code and redeploy the extension if it ever changes. But since you have multiple databases... I'm not sure if it's the best approach.

            Otherwise, consider that any property on your class that you mark with the Persistent will be displayed as a textbox and it will be available at runtime. So, two ideas come to mind:

            1. You could have a ConnectionSTring property, and just use that; that would be quite easy
            2. You could have DatabaseConnectionName property, and have that reference a database connection within your application; these are used to deploy database changes

            The DatabaseConnectionName will be a little trickier, as you'll have to retrieve it from the database, then deserialize it, then look at the object's connection string property. All of the Database ACtions do this, so you can look at their source code.

            You'd only want to do this if you're already using database connections.

            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