Running SQL Doc pipeline in Azure DevOps

Can anyone share tips with me on how I could run a pipeline for SQL Doc in Azure DevOps ?

Tagged:

Best Answers

  • Alex BAlex B Posts: 757 Diamond 1
    Accepted Answer
    Hi @valthordruzin,

    The team have let me know it appears to be straightforward to add this to the Azure Devops (VSTS) addin and so they are going to do so.  Barring any complications it should be released in around 2 weeks time or less.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • PeterGPeterG Posts: 61 Silver 3
    Accepted Answer
    Hi,

    Just wanted to let you know that we've just released an update to the SQL Change Automation Azure DevOps plugin (version 3.0.4) that adds support for SQL Doc when doing a build. You can find a checkbox in the configuration of the build step (under advanced if using sql source control project) that will automatically put the documentation in the created build artifact.


    Peter Gerrard

    Software Engineer
    Redgate Software

Answers

  • Hi @valthordruzin,

    You can document databases as a part of the SQL Change Automation Process using the New-DatabaseDocumentation cmdlet (see the documentation page her). 

    There is an option in the SQL Azure Devops plugin to document the database as well, which uses this cmdlet behind the scenes.

    If you wanted to just use SQL Doc itself, you could use the cmd line included with SQL Change Automation to just run a documentation process as SQL Doc would normally.  This is installed into C:\Program Files (x86)\Red Gate\SQL Change Automation PowerShell\SDOC by default.  As long as you have SQL Change Automation licensed on the build agent then it will be licensed properly.

    I hope that helps, do let me know if you have any other questions.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • Hi @Alex B
    Using the cmdlets are easy when running an on-prem build, but I'm struggling getting it to work in Azure DevOps (in cloud).
    I actually can't find the option to document the database in the Azure SQL Change Automation plugin. I see the operations to build, test, publish and sync, but I see no documentation operation. 

  • Hi @valthordruzin,

    Apologies, I was mistaken - it's the Teamcity add-in that has the option to include the Database Documentation included; the VSTS / Azure Devops doesn't appear to have this.

    It seems you will need to add a step to run a PowerShell script and either have it run the New-DatabaseDocumentation cmdlet or a PowerShell or cmd step to run the SDOC.exe from the location I indicated above. 

    The PowerShell cmdlet should be available because that is what the steps are using themselves; the SDOC.exe should also exist but it may be in a different location due to it being created by the extension on the machine.  I think it might fall under downloaded installations or possibly under the powershell install location.

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • I see.
    Any plans to add a Documentation operation option into the Azure Devops Plugin ? It feels a little wasteful on a hosted build agent to run an additional build step only to download the appropriate binaries to the agent before running the cmdlet for building the documentation, since the hosted agents are charged by total execution time.
  • Hi @valthordruzin,

    I'm double checking with the team to see if they have plans (or just can) add it to the VSTS addon. 

    I've discussed this process more with my colleagues and it seems it may be more involved in that you wouldn't be able to mix and match the addon steps with the Powershell steps as I initially thought as the build step creates the nuget package and the Powershell step would come after that and not be able to add to the nuget package.  So you would likely need to script the entire process in powershell rather than using the addon for this.  This would also involve ensuring the download of the powershell scripts occurred since it's on the hosted (or Microsoft hosted) agent rather than a local agent.

    I'll come back to you once I've spoken to the team and let you know!

    Kind regards,
    Alex
    Product Support Engineer | Redgate Software

    Have you visited our Help Center?
  • Fantastic news! Thanks for following through on this. Good work!
Sign In or Register to comment.