Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor version upgrade of already installed SQL Server instance #2053

Open
DorBreger opened this issue Nov 26, 2024 · 10 comments · May be fixed by #2054
Open

Minor version upgrade of already installed SQL Server instance #2053

DorBreger opened this issue Nov 26, 2024 · 10 comments · May be fixed by #2054
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. resource proposal The issue is proposing a new resource in the resource module.

Comments

@DorBreger
Copy link

Is it possible to install a CU with sqlsetup?
I have been unable to do that

@johlju
Copy link
Member

johlju commented Nov 26, 2024

Look into UpdateEnabled and UpdateSource for the SqlSetup (see the same parameters from SQL Server setup executable) during install. If you mean update a already installed SQL Server instance then there are currently no resource handling that.

@DorBreger
Copy link
Author

Look into UpdateEnabled and UpdateSource for the SqlSetup (see the same parameters from SQL Server setup executable) during install. If you mean update a already installed SQL Server instance then there are currently no resource handling that.

It's exactly what I meant. Is there an open issue for that?

@johlju johlju changed the title Minor version upgrade Minor version upgrade of already installed SQL Server instance Nov 26, 2024
@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. resource proposal The issue is proposing a new resource in the resource module. labels Nov 26, 2024
@johlju
Copy link
Member

johlju commented Nov 26, 2024

It is now. 🙂 Happy to review a PR for this if someone sends one in.

@johlju
Copy link
Member

johlju commented Nov 26, 2024

What happens when passing Upgrade as the action and setting UpdateEnabled and UpdateSource to SqlSetup?

Is it possible to use Install-SqlDscServer with -Upgrade and setting UpdateEnabled and UpdateSource? I think this is probably the correct way to build a resource around, a resource that checks the actual build numbers and only updates if a update is needed. 🤔

@DorBreger
Copy link
Author

DorBreger commented Nov 26, 2024

What happens when passing Upgrade as the action and setting UpdateEnabled and UpdateSource to SqlSetup?

Nothing.

Is it possible to use Install-SqlDscServer with -Upgrade and setting UpdateEnabled and UpdateSource? I think this is probably the correct way to build a resource around, a resource that checks the actual build numbers and only updates if a update is needed. 🤔

Sounds good! That's how I expected it to work

@johlju
Copy link
Member

johlju commented Nov 26, 2024

Hopefully someone wants to PR that, otherwise it won't happen. 🙂

@DorBreger
Copy link
Author

Hopefully someone wants to PR that, otherwise it won't happen. 🙂

I wouldn't mind taking a jab at it, but I have some questions.

  • What would need to be done exactly? I am very familiar with PS but never wrote a DSC module before.
  • What is the development process for this? Just edit the files in PSMODULEPATH?
  • How would you implement This? I took a look at dbatools's implementation, they seem to maintain a json that contains all SQL server versions and all their CUs. That's quite a lot of maintenance to do.

@johlju
Copy link
Member

johlju commented Nov 27, 2024

I hope this helps. Great if you want to run with this.

What would need to be done exactly? I am very familiar with PS but never wrote a DSC module before.

Suggest adding public commands that

  • evaluate the correct SQL Server instance build version
  • evaluate the build version of an update package.

Those public commands together with Install-SqlDscServer -Upgrade is used together in a class-based resource (suggest looking at other class-based resource how they are built, for example SqlAudit).

All of this should be tested using

  • unit tests
  • and if possible an integration test if it possible to install a lower version of SQL Server and then update it using a CU (probably not).

What is the development process for this? Just edit the files in PSMODULEPATH?

Please look at https://dsccommunity.org/guidelines/getting-started/ and then https://dsccommunity.org/guidelines/contributing/#create-or-update-a-pull-request-pr

To test it you would probably move the built module from the dev machine to a lab machine in machine-wide path of PSMoudulePath where you test it easiest using Invoke-DscResource

How would you implement This? I took a look at dbatools's implementation, they seem to maintain a json that contains all SQL server versions and all their CUs. That's quite a lot of maintenance to do.

We should not have any versioninformation that needs to be maintained in this module. That is input parameters to the DSC resource and subsequently to the public commands. But I don't see the need to use versions as input parameters. Input parameters should probably specify the path to where the updated package is. Version is determined by the package and installed SQL Server instance. Unless you find another clever way. 🙂

@DorBreger
Copy link
Author

Thanks! This helped me a lot. I will hopefully attempt doing that on Sunday. I have contributed once to dbatools in the past so I'm fairly confident in my abilities.

@DorBreger
Copy link
Author

DorBreger commented Dec 13, 2024

Hi, I started working on this and I didn't quite get what you meant by

Those public commands together with Install-SqlDscServer -Upgrade is used together in a class-based resource (suggest looking at other class-based resource how they are built, for example SqlAudit).

SqlSetup isn't a class based resource. Also, I noticed that Install-SqlDscServer invokes actions using the setup executable, but the setup executable doesn't seem to have the ability to perform minor version upgrades. Rather, it seems the only way to install them is to simply invoke the KB executable.

@DorBreger DorBreger linked a pull request Dec 20, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. resource proposal The issue is proposing a new resource in the resource module.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants