Azure Devops, test deployment in build - sql-server

I have a database project with some important SQL-scripts. I want to deploy and run the scripts as part of the build pipeline, because they have a tendency to fail because of human error.
I've tried to find a way to add "deployment group job" to my build pipeline, but I'm not seeing how this can be done.
I'm using Azure Devops with Git. My servers are all on-premise.
I have a build and release pipeline which is working fine.

If you want to deploy and run the SQL scripts against all your servers. You need to create a deployment group and Register all your servers in it. Then add "deployment group job" in your release pipeline.
Select the deployment group you created in the configuration page. You can then add script tasks(eg. powershell task) to execute your SQL scripts (The SQL scripts should be included in the build artifacts).
When you run the release pipeline, and the tasks of deployment job will run the sql scripts on all your servers registered in the deployment group.
If you just want to run the sql scripts on a single database server in your build pipeline, you can simply create a self-hosted agent on the database server machine. And run your build pipeline on the self-hosted agent. The scripts in your pipeline will be able to access to your local database server, since they are on the same machine.
Hope above helps!

Deployment group job is not supported in build pipeline, you need to do it in release pipeline.

Related

In SSIS script task not getting execute when it is deployed as an single package

I have an SSIS package in which I am using script tasks. Sometimes after making changes to this package and deploying it as a single package, I find that the package runs without error but doesn't actually execute the script task. If I deploy the project as a whole - without making any changes to the package the script task perfectly.
In short, if I do a project deployment the script task work as expected but as a package deployment it doesn't work, there are occasions when deploying the project is not possible so this workaround isn't always available.
I am using Vs 2016 and my target deployment version is also SQL server 2016.
I am unable to identify the root cause for this kind of issue.
You can try setting the logging option of the SQL Server Agent Job.
It can be also related to permissions. Executing the SSIS package will use your security context but running it from the agent impersonates the credentials defined in the proxy, and then runs the job step by using that security context.
Try also adding the event handlers to know better about the logs.

how to configure Selenium c# with nightly builds(SpecFlow,Nunit,DotnetProject)

I have automated UI tests with Selenium c#. It is a dotnet project.
SpecFlow to write the test cases and Nunit to run them.
We are using Azure Devops for storing the code.
Octopus is used for build and deployments.
I want to automate my tests with nightly builds. Which is a better options for the pipeline? Is it Azure DevOps or Octopus.
Please suggest which is the best way?, more steps and the process to start with it.
I want to automate my tests with nightly builds. Which is a better
options for the pipeline? Is it Azure DevOps or Octopus.
For this issue, you can configure scheduled trigger in azure devops pipeline.
Select the days and times when you want to run the build.
If your repository is Azure Repos Git, GitHub, or Other Git, then you can also specify branches to include and exclude.

SQL Database Project build and publish thru jenkins

Database - SQL Server
Version control - GIT/Bit bucket
Automation - Jenkins pipeline.
Question/task - I need to build SQL database project & deploy thru jenkins pipeline.
Currently we manually build & publish the database but I have scripts which I can use to build(dacpac) & publish to the database but problem scripts only work in VS(visual studio) command prompt.
Build SQL database project thru Jenkins - Is it possible, if so how?
Publish SQL database project thru Jenkins - Is it possible, if so how?
Please help me understand the process involved.
I used the DacFx API provided by Microsoft and created an API service that I integrated with jerkins. In the middle of the pipeline, I passed the SqlProject location, my target database information, and dacpac destination. The API uses Publish Method to Deploy and generate the delta and deploy it to the target database.
See the link below.
https://www.nuget.org/packages/Microsoft.SqlServer.DACFx

Deploying SSRS on SQL Server via tfs

I want to deploy a SSRS project from a TFS server to another server (ProdServer) as a job in SQL Server and run it dynamically.
How I can do it please.
You can try to write Batch script or use utility such as RS.exe to deploy the report, then in TFS Build definition call the script or utility.
Write script to deploy the report, reference this article. For
Utility reference this thread:
Reporting Services Deployment
Create a Scheduled build definition and add the step
BatchScript/Command Line/PowerShell to call the script/utility
Below threads also for your reference:
Best Practice for Deploying SSRS Reports
SQL Server Reporting Services Basics: Deploying Reports

Visual Studio Database Project + Deploy + TFS Build + Multi Tenancy

We have recently migrated to using the Visual Studio database projects. What we want to do is for the database to deploy when the TFS build server builds.
This is relatively simple and we have this working for a single database, however, what we need is for it to deploy to multiple database as we have a SaaS product with multiple databases. So for example, when we do a QA build, all the different databases with various configurations on the QA DB server should be updated.
Is there a 'proper' way to do this?
Our current plan is to take the deployment .sql script that will be generated from the database configured for deployment, then create a custom build task which runs this script against the rest of the databases.
I don't think there is a standard way of doing this, so we created a custom build task that iterates over the databases we want to deploy to executing the deployment script generated by the standard database project's deploy against each DB.

Resources