OctopusDeploy / Library

| Public | A repository of step templates and other community-contributed extensions to Octopus Deploy
Other
171 stars 503 forks source link

Update RedGate worker friendly templates with new functionality #1555

Closed markgould closed 2 months ago

markgould commented 2 months ago

Background

Results

Existing behavior still works

After

image

Pre-requisites

markgould commented 2 months ago

Not sure why the formatting is so off - json files edited in VSCode. Any suggestions?

markgould commented 2 months ago

@twerthi @BobJWalker since you've both contributed here before open to your feedback.

The new connection string parameter bypasses the New-DatabaseConnection command and instead instantiates RedGate.Versioning.Automation.Compare.SchemaSources.DatabaseConnection to pass a custom connection string. New-DatabaseConnection supports a very limited subset of Authentication values, this seemed the best way to handle this.

hnrkndrssn commented 2 months ago

Hey @markgould it looks like it might be a spaces vs tabs issue causing the amount of changes. Hiding white space in the file view makes only the actual changes to show up.

twerthi commented 2 months ago

That sounds reasonable to me. As you're probably aware, Redgate is opting to invest in the Flyway database migrations product vs. the SQL Automation product so these templates may receive reduced usage.

markgould commented 2 months ago

That sounds reasonable to me. As you're probably aware, Redgate is opting to invest in the Flyway database migrations product vs. the SQL Automation product so these templates may receive reduced usage.

Yeah - we have it on our roadmap to transition at some point but have lots of projects using it today so it will take some time for us to migrate. Hopefully this can help others that may still be using the Change Automation tools.

markgould commented 2 months ago

Hey @markgould it looks like it might be a spaces vs tabs issue causing the amount of changes. Hiding white space in the file view makes only the actual changes to show up.

Could be, looks like some of the formatting may have been off previously too. Any changes you'd like me to make here?

twerthi commented 2 months ago

@markgould There is an error in the template Redgate - Deploy from Package (Worker Friendly) when not using the Connection String (Optional) parameter. The template is using the PowerShell variable $DLMAutomationDatabaseServer where I believe it is meaning to use the $DLMAutomationTargetDatabaseServer parameter?

I didn't check the others, would you mind checking the other two for a similar situation?

twerthi commented 2 months ago

Looks to be a similar issue with the database name, the code is using $DLMAutomationDatabaseName whereas the Parameter is $DLMAutomationTargetDatabaseName. After updating that one in my testing, I have encountered other issues. Did you update some Parameter names in the steps?

markgould commented 2 months ago

I see what's going on here - there are discrepancies with the parameter names in the deploy-from-package vs the other two, so when I updated that one there was an issue with it using the wrong variable names. Correcting now.

markgould commented 2 months ago

Should be good now. I also noticed an issue in how I was checking the Trust Server Certificate value across the 3 scripts, changed to use Convert.ToBoolean to handle empty values. Thanks for the feedback!