filter
dskog
Posts: 5
DLM automation does not use the Filter.scpf file from sql compare.
Background. We don't include users or roles in our source control. (If there was a way to always exclude these objects from the deploy, we would use that, but it doesn't look like there is.)
This works as intended, using the redgate plugin with MS SQL Server Management Studio. The users and roles are not added to TFS, and there is a "Filter.scpf" file in the root of the database folder. Also, the Filter.scpf is included in the Nuget package (from the Build step).
However, when the Sync step runs, the filter is not applied (all users and roles are dropped). If we set the "Filter path" to this same filter file, it works as intended (users and roles are not dropped). Note that we did try the "-IncludeDependencies" in the SQL Compare options, but that didn't make a difference (and we'd rather not do it that way anyway).
Why is the Filter.scpf file in the Nuget package ignored?
Seeing this on the info for the "Filter path",
"The path to a .scpf filter file. Overrides any existing Filter.scpf file present in the package/source control repository, and is used when creating the update SQL. Filter files can be generated by SQL Source Control and SQL Compare."
leads us to believe that the "existing Filter.scpf" would be used if this "Filter path" wasn't set in the build definition, but it doesn't seem to work that way.
We have a large amount of build definitions, and if we forget to explicitly set the "Filter path" in any one of those, the users get dropped from the database (and everyone has a bad day).
Please advise on what needs to be done to get this to work without having to set the "Filter path" in every build definition.
Background. We don't include users or roles in our source control. (If there was a way to always exclude these objects from the deploy, we would use that, but it doesn't look like there is.)
This works as intended, using the redgate plugin with MS SQL Server Management Studio. The users and roles are not added to TFS, and there is a "Filter.scpf" file in the root of the database folder. Also, the Filter.scpf is included in the Nuget package (from the Build step).
However, when the Sync step runs, the filter is not applied (all users and roles are dropped). If we set the "Filter path" to this same filter file, it works as intended (users and roles are not dropped). Note that we did try the "-IncludeDependencies" in the SQL Compare options, but that didn't make a difference (and we'd rather not do it that way anyway).
Why is the Filter.scpf file in the Nuget package ignored?
Seeing this on the info for the "Filter path",
"The path to a .scpf filter file. Overrides any existing Filter.scpf file present in the package/source control repository, and is used when creating the update SQL. Filter files can be generated by SQL Source Control and SQL Compare."
leads us to believe that the "existing Filter.scpf" would be used if this "Filter path" wasn't set in the build definition, but it doesn't seem to work that way.
We have a large amount of build definitions, and if we forget to explicitly set the "Filter path" in any one of those, the users get dropped from the database (and everyone has a bad day).
Please advise on what needs to be done to get this to work without having to set the "Filter path" in every build definition.
Tagged:
Comments
This way your configuration for your deployments is in just one place and it is under source control.
DevOps Mentor and Coach
Director of DLM Consultants
Creator of Speaking Mentors
Microsoft Data Platform MVP
Friend of Redgate
Twitter / LinkedIn
I really just want to know why it's not using the Filter.scpf file in the Nuget package.
If we set the "Filter path" we see this when we build:
"filter file
'C:\vNextBuildAgent\_work\36\s\[application name]\Dev\Database\Filter.scpf'
specified by the FilterPath parameter is overriding the filter in scripts folder
'C:\vNextBuildAgent\_work\36\s\[application name]\Dev\Database'
in the source."
As you can see, the file it says it's overriding is the same as the one that it's using to override (from the "Filter path"). This works correctly. However if we omit the "Filter path" it doesn't work correctly (drops the users and roles)
DevOps Mentor and Coach
Director of DLM Consultants
Creator of Speaking Mentors
Microsoft Data Platform MVP
Friend of Redgate
Twitter / LinkedIn
I'd really appreciate it if you could answer some questions so that I can get an idea of your current setup.
Thanks!
Redgate Software
• What current version of DLM Automation itself are you using?
2.0.12.371
• Which version of TFS are you using?
14.102.25423.0 (we're planning on upgrading to TFS 2017 update 1 – 15.112.26307.0 soon)
• Which TFS plugin are you using? The new VSTS-style plugin or the older TFS Build plugin with the XAML builds?
New VSTS
• If you are using VSTS, are you using a hosted build server on an on-premise build server?
On premise
Was the filter created using SQL Source Control? Also, if you look at the generated NuGet package, do you find the Filter.spcf file in the db\state folder?
Redgate Software
Yes, the filter was created using SQL source control.
Yes, the Filter.spcf is in the db\state folder in the NuGet package, and it looks as it should for the User and Role entries
<User version="1">
<Include>True</Include>
<Expression />
</User>
<Role version="1">
<Include>True</Include>
<Expression />
</Role>
Redgate Software
WARNING: Cmdlet parameter FilterPath is not supported for SQL Change Automation projects. This option will be ignored.
Yet when I use the absolute path using the Octopus Deploy parameter you mentioned above, it does seem to respect it and deploy successfully.