-
Notifications
You must be signed in to change notification settings - Fork 9
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
OSOE-481: Action pulls latest SQL Server (=2022-latest) but 2019-latest is used in Lombiq.GitHub.Actions #293
Conversation
) | ||
|
||
docker pull mcr.microsoft.com/mssql/server && | ||
docker pull mcr.microsoft.com/mssql/server:2022-latest && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is specified so if sql server will get a new release there won't be a missmatch between the pulled image and the detached one in docker.
As far as the documentation says Edit: Unless they will give a new command for 2022 when the new version will be out and that will just sql-server-express. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thats what I asked for in my previous comment whether it is acceptable that we use SQL SERVER DEVELOPER instead of EXPRESS becasue I didn't find any particular command in the documentation that specifies for Express 2022.
So basically sql-server-express
is dedicated for 2022 express and I didn't find any other command for it. sql-server-2022
will install Developer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Developer would actually be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed sql-server-express
to sql-server-2022
which eventually will install the Developer version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it makes sure that it's version 2022 and its fixed.
@@ -5,14 +5,14 @@ if ($Env:RUNNER_OS -eq 'Windows') | |||
else | |||
{ | |||
$dockerRunSwitches = @( | |||
'--name', 'sql2019' | |||
'--name', 'sql2022' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DRY, please use a variable or script parameter to store the SQLServer version. Do it here and below.
docker run @dockerRunSwitches && | ||
docker exec --user 0 sql2019 bash -c 'mkdir /data; chmod 777 /data --recursive; chown mssql:root /data' | ||
docker exec --user 0 sql2022 bash -c 'mkdir /data; chmod 777 /data --recursive; chown mssql:root /data' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Piedone do we need to use the SQLServer version as the container name? Can we use for example uitt-sqlserver
here and Invoke-SolutionTests.ps1
:L25. I think not using version makes everything a bit better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, though I don't think it matters much in practice, since the runners are ephemeral anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The container name is used as an ENV variable that SqlServerManager
will use so if we change that here we need to change the ENV var aswell. So do we want to change it or not?
@@ -1,18 +1,20 @@ | |||
if ($Env:RUNNER_OS -eq 'Windows') | |||
{ | |||
choco install sql-server-express --no-progress | |||
choco install sql-server-2022 --no-progress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DRY
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not addressed.
} | ||
else | ||
{ | ||
$sqlServerName = 'sql2022' | ||
$sqlServerVersion = '2022-latest' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use only the version eg $sqlServerVersion = '2022'
and with string interpolation, you can use it everywhere "mcr.microsoft.com/mssql/server:${sqlServerVersion}-latest"
.
Why don't you want to create a script parameter for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we are making a load of changes to a script that was working fine and nobody wanted to touch it, until we realised that 2019 should be swapped to 2022. So according to clean code yes your recommendations are valid but the use case here is so minor and easy I think we are overcomplicating this at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are making changes because there is a bug in our script and we found a maintainability problem while fixing it.
Script parameter:
param (
[string]$SqlServerVersion = '2022'
)
...
Variable:
...
$sqlServerVersion = '2022'
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did change to param now.
@@ -22,7 +22,7 @@ else | |||
{ | |||
$connectionStringStem = 'Server=.;Database=LombiqUITestingToolbox_{{id}};User Id=sa;Password=Password1!' | |||
|
|||
$Env:Lombiq_Tests_UI__DockerConfiguration__ContainerName = 'sql2019' | |||
$Env:Lombiq_Tests_UI__DockerConfiguration__ContainerName = 'sql2022' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can set the container name here. This is the answer to your question (#293 (comment)), value uitt-sqlserver
.
$dockerRunSwitches = @( | ||
'--name', 'sql2019' | ||
'--name', $sqlServerName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set the container name here, value 'uitt-sqlserver'. Also see my comment below (Invoke-SolutionTests.ps1:L25
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment: Lombiq/Open-Source-Orchard-Core-Extensions#637 (review)
@@ -1,18 +1,20 @@ | |||
if ($Env:RUNNER_OS -eq 'Windows') | |||
{ | |||
choco install sql-server-express --no-progress | |||
choco install sql-server-2022 --no-progress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was not addressed.
@coderabbitai review I'm testing the AI code review tool CodeRabbit here. Please bear with me. And if it comments some useful feedback, please address it. |
Important Auto Review SkippedAuto reviews are limited to the following labels: coderabbit-review. Please add one of these labels to enable auto reviews. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the WalkthroughThe changes involve updating GitHub Actions scripts and workflows to handle SQL Server versions more flexibly. The setup script now accepts a parameter to specify the SQL Server version, enabling the use of different versions for different scenarios. The changes also include updates to the way SQL Server is accessed and the naming of Docker containers. Workflow files have been modified to reference specific branches or versions of actions, indicating a move to align testing environments with specific requirements. Changes
Assessment against linked issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChat with CodeRabbit Bot (
|
@Piedone, I'm ready to review the pull request as requested. Please provide the specific files or code snippets you would like me to focus on, or let me know if you want a general review of the entire pull request. Action performedReview triggered. |
@coderabbitai review Sorry about that. |
@Piedone, no problem at all! I'm here to assist you. Could you please specify which parts of the pull request you would like me to review? If you want a general review of the entire pull request, just let me know and I'll proceed with that. Action performedReview triggered. |
@coderabbitai review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (6)
- .github/actions/setup-sql-server/Initialize-SqlServer.ps1 (1 hunks)
- .github/actions/setup-sql-server/Wait-SqlServer.ps1 (1 hunks)
- .github/actions/test-dotnet/Invoke-SolutionTests.ps1 (1 hunks)
- .github/workflows/build-and-test-dotnet.yml (1 hunks)
- .github/workflows/build-and-test-orchard-core.yml (2 hunks)
- .github/workflows/msbuild-and-test.yml (1 hunks)
Additional comments: 10
.github/actions/setup-sql-server/Wait-SqlServer.ps1 (1)
- 9-9: The removal of the
.\SQLEXPRESS
instance name from thesqlcmd
command will make the script connect to the default SQL Server instance. Confirm that this change aligns with the intended SQL Server configuration and that all necessary instances are configured as default on their respective environments..github/actions/setup-sql-server/Initialize-SqlServer.ps1 (3)
1-3: The introduction of the
$sqlServerVersion
parameter with a default value of '2022' is a good practice for making the script version-agnostic. Ensure that all scripts and workflows that call this script are updated to pass this parameter if a version other than the default is required.7-7: The update to the Chocolatey install command to use the
$sqlServerVersion
parameter is correct and allows for dynamic installation of different SQL Server versions. Confirm that the Chocolatey feed used has the expected versions available for installation.11-24: The Docker commands have been updated to use the
$sqlServerVersion
parameter for pulling the correct SQL Server image. Ensure that the Docker image tags corresponding to the SQL Server versions are correctly formatted and exist in the container registry..github/actions/test-dotnet/Invoke-SolutionTests.ps1 (2)
19-19: The change in the database connection string from '.\SQLEXPRESS' to '.' for Windows environments is consistent with the removal of the instance name in the
Wait-SqlServer.ps1
script. Verify that this change is intended and that the default SQL Server instance is configured correctly on Windows runners.25-25: The Docker container name has been updated to 'uitt-sqlserver'. Confirm that this new name is reflected in all places where the container is referenced or managed, to maintain consistency across the workflows.
.github/workflows/msbuild-and-test.yml (1)
- 123-123: The
uses
field in theTests
job has been updated to reference theissue/OSOE-481
branch. Ensure that this branch contains the updated actions and that it is intended to be used for testing purposes before merging into the main branch..github/workflows/build-and-test-dotnet.yml (1)
- 208-208: The
uses
field in theTests
job has been updated to reference theissue/OSOE-481
branch, similar to the change in themsbuild-and-test.yml
workflow. Confirm that this branch is intended for use and contains the correct action versions for the testing workflow..github/workflows/build-and-test-orchard-core.yml (2)
- 238-238: The
uses
field for setting up SQL Server has been updated to reference theissue/OSOE-481
branch. This change should be verified to ensure that the branch contains the correct and updated SQL Server setup action.Verification successful
The output from the shell script confirms that the
issue/OSOE-481
branch includes updates to thesetup-sql-server
action, specifically to theInitialize-SqlServer.ps1
andWait-SqlServer.ps1
scripts. This aligns with the PR's objective to standardize the SQL Server version used in the GitHub Actions.* 248-248: The `uses` field for running tests has been updated to reference the `issue/OSOE-481` branch. This change should be verified to ensure that the branch contains the correct and updated test action.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the issue/OSOE-481 branch contains the updated setup-sql-server action. gh pr view 293 --repo Lombiq/GitHub-Actions --json files --jq '.files[].path' | grep 'setup-sql-server'Length of output: 213
Verification successful
The output from the shell script confirms that the
issue/OSOE-481
branch includes changes to thetest-dotnet
action, specifically to theInvoke-SolutionTests.ps1
script and thebuild-and-test-dotnet.yml
workflow file. This suggests that theuses
field in the.github/workflows/build-and-test-orchard-core.yml
file is correctly pointing to a branch that contains the updated test action as intended by the PR.
Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify that the issue/OSOE-481 branch contains the updated test-dotnet action. gh pr view 293 --repo Lombiq/GitHub-Actions --json files --jq '.files[].path' | grep 'test-dotnet'Length of output: 195
Using better variable name
OSOE-481
Fixes #116
Summary by CodeRabbit
Refactor
Tests
Chores