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

OSOE-481: Action pulls latest SQL Server (=2022-latest) but 2019-latest is used in Lombiq.GitHub.Actions #293

Merged
merged 30 commits into from
Dec 31, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0a1f2bd
Updating script to use sqlserver 2022.
Psichorex Dec 5, 2023
56381dc
Updating branch reference.
Psichorex Dec 5, 2023
9518cc6
Using sql2022
Psichorex Dec 5, 2023
ec6e6fd
Updating branch references.
Psichorex Dec 5, 2023
7cecb90
Merge remote-tracking branch 'origin/dev' into issue/OSOE-481
Psichorex Dec 7, 2023
76f1c96
Drying script.
Psichorex Dec 7, 2023
0e895ef
Using sqlserver2022 directly.
Psichorex Dec 7, 2023
75a2b21
Dry and renaming.
Psichorex Dec 7, 2023
0ecf4cd
Dry and renaming.
Psichorex Dec 7, 2023
ea2c39b
Using single quotes.
Psichorex Dec 7, 2023
a5e354a
Using param.
Psichorex Dec 8, 2023
9c5553e
Merge branch 'dev' of https://github.com/Lombiq/GitHub-Actions into i…
dministro Dec 10, 2023
b313016
Testing.
Psichorex Dec 11, 2023
d481e0e
Merge branch 'issue/OSOE-481' of https://github.com/Lombiq/GitHub-Act…
Psichorex Dec 11, 2023
04cb286
Merge remote-tracking branch 'origin/dev' into issue/OSOE-481
Psichorex Dec 15, 2023
31a9026
Using var and version.
Psichorex Dec 16, 2023
7ba9378
Using exact version number as it is mandatory.
Psichorex Dec 16, 2023
2e8bddf
Using param.
Psichorex Dec 16, 2023
1085d06
Fix typo.
Psichorex Dec 16, 2023
c3138ff
Trying SQL2022DEVELOPER again.
Psichorex Dec 19, 2023
941f172
Removing temp var.
Psichorex Dec 19, 2023
a06d50c
Using local instead of MSSQLSERVER.
Psichorex Dec 19, 2023
0bc635f
Using MSSQLServer.
Psichorex Dec 19, 2023
ba19eaa
Testing.
Psichorex Dec 19, 2023
d03e6d4
Reverting to SQL express.
Psichorex Dec 19, 2023
53a6d0e
Trying . as server name.
Psichorex Dec 19, 2023
1ab8ff7
Using var.
Psichorex Dec 20, 2023
6eaae21
Referencing dev branch
dministro Dec 30, 2023
4c3861f
Revert changing branch references
dministro Dec 31, 2023
44f0be8
Referencing dev in workflows
dministro Dec 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/actions/setup-sql-server/Initialize-SqlServer.ps1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line 3, please do what @Piedone asked here.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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.

Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
if ($Env:RUNNER_OS -eq 'Windows')
{
choco install sql-server-express --no-progress
choco install sql-server-2022 --no-progress
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY

Copy link
Member

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'
Copy link
Member

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?

Copy link
Contributor Author

@Psichorex Psichorex Dec 7, 2023

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.

Copy link
Member

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'

...

Copy link
Contributor Author

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.

$dockerRunSwitches = @(
'--name', 'sql2019'
'--name', $sqlServerName
Copy link
Member

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).

'--env', 'ACCEPT_EULA=Y'
'--env', 'SA_PASSWORD=Password1!'
'--publish', '1433:1433'
'--detach', 'mcr.microsoft.com/mssql/server:2019-latest'
'--detach', "mcr.microsoft.com/mssql/server:$sqlServerVersion"
)

docker pull mcr.microsoft.com/mssql/server &&
docker pull "mcr.microsoft.com/mssql/server:$sqlServerVersion" &&
docker run @dockerRunSwitches &&
docker exec --user 0 sql2019 bash -c 'mkdir /data; chmod 777 /data --recursive; chown mssql:root /data'
docker exec --user 0 $sqlServerName bash -c 'mkdir /data; chmod 777 /data --recursive; chown mssql:root /data'
}
2 changes: 1 addition & 1 deletion .github/actions/test-dotnet/Invoke-SolutionTests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Copy link
Member

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.

}

$Env:Lombiq_Tests_UI__SqlServerDatabaseConfiguration__ConnectionStringTemplate = $connectionStringStem + $connectionStringSuffix
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ jobs:

- name: Tests
if: inputs.test-disable == 'false'
uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@dev
uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@issue/OSOE-481
with:
blame-hang-timeout: ${{ inputs.blame-hang-timeout }}
build-directory: ${{ inputs.build-directory }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-and-test-orchard-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ jobs:

- name: Set up SQL Server
if: inputs.set-up-sql-server == 'true'
uses: Lombiq/GitHub-Actions/.github/actions/setup-sql-server@dev
uses: Lombiq/GitHub-Actions/.github/actions/setup-sql-server@issue/OSOE-481

- name: Set up Azurite
if: inputs.set-up-azurite == 'true'
Expand All @@ -213,7 +213,7 @@ jobs:

- name: Tests
if: inputs.test-disable == 'false'
uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@dev
uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@issue/OSOE-481
with:
blame-hang-timeout: ${{ inputs.blame-hang-timeout }}
build-directory: ${{ inputs.build-directory }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/msbuild-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:

- name: Tests
if: inputs.test-disable == 'false'
uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@dev
uses: Lombiq/GitHub-Actions/.github/actions/test-dotnet@issue/OSOE-481
with:
build-directory: ${{ inputs.build-directory }}
test-verbosity: ${{ inputs.build-verbosity }}
Expand Down