Skip to content

Commit 20d7103

Browse files
committed
Addressed Copilot comments, and fixed some runtime bugs.
1 parent 478ba6c commit 20d7103

6 files changed

Lines changed: 46 additions & 24 deletions

eng/pipelines/common/templates/jobs/run-tests-package-reference-job.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ jobs:
4646

4747
- template: /eng/pipelines/common/templates/steps/update-config-file-step.yml
4848
parameters:
49+
# We use the Library $(Password) variable as the SA password in this pipeline.
50+
saPassword: $(Password)
4951
TCPConnectionString: $(SQL_TCP_CONN_STRING)
5052
NPConnectionString: $(SQL_NP_CONN_STRING)
5153
SupportsIntegratedSecurity: false

eng/pipelines/common/templates/steps/configure-sql-server-linux-step.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ parameters:
2020

2121
steps:
2222

23+
# Emit the SA password, if desired.
24+
- ${{ if eq(parameters.debug, true) }}:
25+
- bash: |
26+
echo "SA password: ${{ parameters.saPassword }}"
27+
displayName: '[Debug] Emit SA password'
28+
2329
# Configure SQL Server.
2430
- bash: |
2531
sudo systemctl stop mssql-server

eng/pipelines/common/templates/steps/configure-sql-server-macos-step.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ parameters:
1818
type: string
1919

2020
steps:
21+
22+
# Emit the SA password, if desired.
23+
- ${{ if eq(parameters.debug, true) }}:
24+
- bash: |
25+
echo "SA password: ${{ parameters.saPassword }}"
26+
displayName: '[Debug] Emit SA password'
27+
2128
# Configure SQL Server. This includes installing Docker and the SQLCMD tools, starting a SQL
2229
# Server container, and verifying we can connect to it.
2330
- bash: |
@@ -45,10 +52,6 @@ steps:
4552
# Password for the SA user (required)
4653
MSSQL_SA_PW="${{ parameters.saPassword }}"
4754
48-
if [ "${{ parameters.debug }}" = "True" ]; then
49-
echo "SA password: $MSSQL_SA_PW"
50-
fi
51-
5255
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=$MSSQL_SA_PW" -p 1433:1433 -p 1434:1434 --name sql1 --hostname sql1 -d mcr.microsoft.com/mssql/server:2022-latest
5356
5457
sleep 5
@@ -78,7 +81,7 @@ steps:
7881
7982
echo "Waiting for SQL Server to start (attempt #$attempt of $maxAttempts)..."
8083
81-
sqlcmd -S 127.0.0.1 -No -U sa -P $MSSQL_SA_PW -Q "SELECT @@VERSION" >> $SQLCMD_ERRORS 2>&1
84+
sqlcmd -S 127.0.0.1 -No -U sa -P "$MSSQL_SA_PW" -Q "SELECT @@VERSION" >> $SQLCMD_ERRORS 2>&1
8285
8386
# If the command was successful, then the SQL Server is ready.
8487
if [ $? -eq 0 ]; then
@@ -108,18 +111,18 @@ steps:
108111
109112
echo "Use sqlcmd to show which IP addresses are being listened on..."
110113
echo 0.0.0.0
111-
sqlcmd -S 0.0.0.0 -No -U sa -P $MSSQL_SA_PW -Q "SELECT @@VERSION" -l 2
114+
sqlcmd -S 0.0.0.0 -No -U sa -P "$MSSQL_SA_PW" -Q "SELECT @@VERSION" -l 2
112115
echo 127.0.0.1
113-
sqlcmd -S 127.0.0.1 -No -U sa -P $MSSQL_SA_PW -Q "SELECT @@VERSION" -l 2
116+
sqlcmd -S 127.0.0.1 -No -U sa -P "$MSSQL_SA_PW" -Q "SELECT @@VERSION" -l 2
114117
echo ::1
115-
sqlcmd -S ::1 -No -U sa -P $MSSQL_SA_PW -Q "SELECT @@VERSION" -l 2
118+
sqlcmd -S ::1 -No -U sa -P "$MSSQL_SA_PW" -Q "SELECT @@VERSION" -l 2
116119
echo localhost
117-
sqlcmd -S localhost -No -U sa -P $MSSQL_SA_PW -Q "SELECT @@VERSION" -l 2
120+
sqlcmd -S localhost -No -U sa -P "$MSSQL_SA_PW" -Q "SELECT @@VERSION" -l 2
118121
echo "(sqlcmd default / not specified)"
119-
sqlcmd -No -U sa -P $MSSQL_SA_PW -Q "SELECT @@VERSION" -l 2
122+
sqlcmd -No -U sa -P "$MSSQL_SA_PW" -Q "SELECT @@VERSION" -l 2
120123
121124
echo "Configuring Dedicated Administer Connections to allow remote connections..."
122-
sqlcmd -S 127.0.0.1 -No -U sa -P $MSSQL_SA_PW -Q "sp_configure 'remote admin connections', 1; RECONFIGURE;"
125+
sqlcmd -S 127.0.0.1 -No -U sa -P "$MSSQL_SA_PW" -Q "sp_configure 'remote admin connections', 1; RECONFIGURE;"
123126
if [ $? = 1 ]
124127
then
125128
echo "Error configuring DAC for remote access."

eng/pipelines/common/templates/steps/configure-sql-server-win-step.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ parameters:
6868

6969
steps:
7070

71-
- powershell: |
71+
# Emit the SA password, if desired.
72+
- ${{ if eq(parameters.debug, true) }}:
73+
- pwsh: |
74+
Write-Host "SA password: ${{ parameters.saPassword }}"
75+
displayName: '[Debug] Emit SA password'
76+
77+
- pwsh: |
7278
try
7379
{
7480
# enable TCP
@@ -102,7 +108,7 @@ steps:
102108
displayName: 'Enable TCP, NP & Firewall [Win]'
103109
retryCountOnTaskFailure: 2
104110
105-
- powershell: |
111+
- pwsh: |
106112
$password = "${{ parameters.saPassword }}"
107113
108114
if ("${{ parameters.debug }}" -eq "True")
@@ -146,7 +152,7 @@ steps:
146152
SQL_PASSWD: ${{ parameters.saPassword }}
147153
148154
- ${{ if ne(parameters.SQLRootPath, '') }}:
149-
- powershell: |
155+
- pwsh: |
150156
#Enable FileStream
151157
$instance = "${{parameters.instanceName }}"
152158
$wmi = Get-WmiObject -Namespace "${{parameters.SQLRootPath }}" -Class FilestreamSettings | where {$_.InstanceName -eq $instance}
@@ -171,13 +177,13 @@ steps:
171177
SQL_PASSWD: ${{ parameters.saPassword }}
172178
173179
- ${{ if ne(parameters.FileStreamDirectory, '') }}:
174-
- powershell: |
180+
- pwsh: |
175181
New-Item -Path ${{ parameters.fileStreamDirectory }} -ItemType Directory
176182
displayName: 'Create FileStreamFolder'
177183
retryCountOnTaskFailure: 1
178184
continueOnError: true
179185
180-
- powershell: |
186+
- pwsh: |
181187
$SQLServerName = ("{0}" -f [System.Net.Dns]::GetHostByName($env:computerName).HostName)
182188
Write-Host FQDN is: $SQLServerName
183189
@@ -195,7 +201,7 @@ steps:
195201
New-ItemProperty -Path ${{parameters.x64AliasRegistryPath }} -Name ${{parameters.SQLAliasName }} -PropertyType string -Value $TCPAliasName
196202
displayName: 'Setup SQL Alias [Win]'
197203
198-
- powershell: |
204+
- pwsh: |
199205
# Create Certificate
200206
$computerDnsName = [System.Net.Dns]::Resolve($null).HostName
201207
$certificate = New-SelfSignedCertificate -DnsName $computerDnsName,localhost -CertStoreLocation cert:\LocalMachine\My -FriendlyName test99 -KeySpec KeyExchange
@@ -232,7 +238,7 @@ steps:
232238
}
233239
displayName: 'Add SQL Certificate [Win]'
234240
235-
- powershell: |
241+
- pwsh: |
236242
# You need to restart SQL Server for the change to persist
237243
# -Force takes care of any dependent services, like SQL Agent.
238244
# Note: if the instance is named, replace MSSQLSERVER with MSSQL$ followed by
@@ -251,7 +257,7 @@ steps:
251257
252258
displayName: 'Restart SQL Server [Win]'
253259
254-
- powershell: |
260+
- pwsh: |
255261
$arrService = Get-Service -Name "SQLBrowser"
256262
$arrService
257263
@@ -271,7 +277,7 @@ steps:
271277
displayName: 'Start Sql Server Browser [Win]'
272278
273279
- ${{ if parameters.enableLocalDB }}:
274-
- powershell: |
280+
- pwsh: |
275281
#script to enable local db
276282
277283
SqlLocalDB info

eng/pipelines/jobs/test-azure-package-ci-job.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ jobs:
274274

275275
# List the DLLs in the output directory for debugging purposes.
276276
- ${{ if eq(parameters.debug, true) }}:
277-
- pwsh: >
277+
- pwsh: >-
278278
Get-ChildItem
279279
-Path "src/Microsoft.Data.SqlClient.Extensions/Azure/test/bin/${{ parameters.buildConfiguration }}"
280280
-Recurse

eng/pipelines/stages/generate-secrets-ci-stage.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
# Any stages that use these secrets must depend on this stage:
1919
#
2020
# secrets_stage
21-
21+
#
22+
# None of the values produced here are actual secrets - they are just random values that are
23+
# suitable for testing purposes, and do not need to be protected. For simplicity, they are emitted
24+
# as regular output variables of script steps, are not formally marked as secrets, and not stored in
25+
# the Azure DevOps Library or Key Vault.
26+
#
2227
parameters:
2328

2429
# True to emit debugging steps and messages.
@@ -40,7 +45,7 @@ stages:
4045
displayName: Generate Secrets
4146
pool:
4247
# We don't need anything special, so use the standard Microsoft-hosted Ubuntu image, which
43-
# is typcally very fast to spin up.
48+
# is typically very fast to spin up.
4449
vmImage: ubuntu-latest
4550

4651
steps:
@@ -62,4 +67,4 @@ stages:
6267
- ${{ if eq(parameters.debug, true) }}:
6368
- bash: |
6469
echo "SA password: $(SaPassword.Value)"
65-
displayName: Emit SA password
70+
displayName: '[Debug] Emit SA password'

0 commit comments

Comments
 (0)