Skip to content

Commit 264fa31

Browse files
authored
Merge branch 'main' into saumya/sql_variant
2 parents c28bcb1 + 69d4757 commit 264fa31

19 files changed

Lines changed: 961 additions & 16 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,8 @@ build/
6161
*venv*/
6262
**/*venv*/
6363

64+
# Extracted mssql_py_core (from eng/scripts/install-mssql-py-core)
65+
mssql_py_core/
66+
6467
# learning files
6568
learnings/

OneBranchPipelines/dummy-release-pipeline.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,14 @@ extends:
174174
Write-Host "Symbols: $(if ($symbols) { $symbols.Count } else { 0 }) files"
175175
Write-Host "====================================="
176176
177+
# Step 3.5: Validate mssql-py-core is a stable version (no dev/alpha/beta/rc)
178+
- task: PowerShell@2
179+
displayName: '[TEST] Validate mssql-py-core is a stable version'
180+
inputs:
181+
targetType: 'filePath'
182+
filePath: '$(Build.SourcesDirectory)\OneBranchPipelines\scripts\validate-release-versions.ps1'
183+
arguments: '-VersionFile "$(Build.SourcesDirectory)\artifacts\dist\mssql-py-core.version"'
184+
177185
# Step 4: Verify wheel integrity
178186
- task: PowerShell@2
179187
displayName: '[TEST] Verify Wheel Integrity'

OneBranchPipelines/jobs/consolidate-artifacts-job.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ jobs:
2626
value: '$(Build.ArtifactStagingDirectory)'
2727

2828
steps:
29-
- checkout: none # No source code needed for consolidation
29+
- checkout: self
30+
fetchDepth: 1
3031

3132
# Download ALL artifacts from current build
3233
# Matrix jobs publish as: Windows_<JobId>, macOS_<JobId>, Linux_<JobId>
@@ -112,6 +113,13 @@ jobs:
112113
displayName: 'Consolidate Windows symbols (optional)'
113114
continueOnError: true
114115
116+
# Include mssql-py-core version file for traceability
117+
- bash: |
118+
set -e
119+
cp $(Build.SourcesDirectory)/eng/versions/mssql-py-core.version $(ob_outputDirectory)/dist/
120+
echo "mssql-py-core version: $(cat $(ob_outputDirectory)/dist/mssql-py-core.version)"
121+
displayName: 'Include mssql-py-core version'
122+
115123
# Verify consolidation
116124
- bash: |
117125
echo "=========================================="

OneBranchPipelines/official-release-pipeline.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,14 @@ extends:
177177
Write-Host "Symbols: $(if ($symbols) { $symbols.Count } else { 0 }) files"
178178
Write-Host "====================================="
179179
180+
# Step 3.5: Validate mssql-py-core is a stable version (no dev/alpha/beta/rc)
181+
- task: PowerShell@2
182+
displayName: 'Validate mssql-py-core is a stable version'
183+
inputs:
184+
targetType: 'filePath'
185+
filePath: '$(Build.SourcesDirectory)\OneBranchPipelines\scripts\validate-release-versions.ps1'
186+
arguments: '-VersionFile "$(Build.SourcesDirectory)\artifacts\dist\mssql-py-core.version"'
187+
180188
# Step 4: Verify wheel integrity
181189
- task: PowerShell@2
182190
displayName: 'Verify Wheel Integrity'
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
4+
<#
5+
.SYNOPSIS
6+
Validates that a version file contains a stable (non-prerelease) version.
7+
8+
.DESCRIPTION
9+
Reads a single .version file and rejects any version containing
10+
dev, alpha, beta, or rc tags. Intended to gate official releases.
11+
12+
.PARAMETER VersionFile
13+
Path to a .version file. Defaults to eng/versions/mssql-py-core.version
14+
relative to the repository root.
15+
16+
.EXAMPLE
17+
# Run from repo root (uses default path):
18+
.\eng\scripts\validate-release-versions.ps1
19+
20+
# Explicit path:
21+
.\eng\scripts\validate-release-versions.ps1 -VersionFile C:\work\mssql-python\eng\versions\mssql-py-core.version
22+
#>
23+
24+
param(
25+
[string]$VersionFile
26+
)
27+
28+
$ErrorActionPreference = 'Stop'
29+
30+
if (-not $VersionFile) {
31+
$repoRoot = (Resolve-Path "$PSScriptRoot\..\..").Path
32+
$VersionFile = Join-Path $repoRoot 'eng\versions\mssql-py-core.version'
33+
}
34+
35+
if (-not (Test-Path $VersionFile)) {
36+
Write-Error "Version file not found: $VersionFile"
37+
exit 1
38+
}
39+
40+
$version = (Get-Content $VersionFile -Raw).Trim()
41+
$name = [System.IO.Path]::GetFileNameWithoutExtension($VersionFile)
42+
43+
if ($version -match '(dev|alpha|beta|rc)') {
44+
Write-Host "FAIL: $name version '$version' is a pre-release ($($Matches[1]))" -ForegroundColor Red
45+
Write-Error "$name version is pre-release. Official releases require stable versions."
46+
exit 1
47+
}
48+
49+
Write-Host "OK: $name version '$version'" -ForegroundColor Green

OneBranchPipelines/stages/build-linux-single-stage.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ stages:
104104
105105
- script: |
106106
# Determine image based on LINUX_TAG and ARCH
107+
# manylinux_2_28 = AlmaLinux 8 (glibc 2.28)
108+
# Note: mssql_py_core (built in mssql-rs) requires OpenSSL 3 / glibc 2.34,
109+
# but it is pre-built and downloaded from NuGet — not compiled here.
107110
if [[ "$(LINUX_TAG)" == "musllinux" ]]; then
108111
IMAGE="quay.io/pypa/musllinux_1_2_$(ARCH)"
109112
else
@@ -126,10 +129,10 @@ stages:
126129
set -euxo pipefail
127130
if command -v dnf >/dev/null 2>&1; then
128131
dnf -y update || true
129-
dnf -y install gcc gcc-c++ make cmake unixODBC-devel krb5-libs keyutils-libs ccache || true
132+
dnf -y install gcc gcc-c++ make cmake unixODBC-devel krb5-libs keyutils-libs ccache curl || true
130133
elif command -v yum >/dev/null 2>&1; then
131134
yum -y update || true
132-
yum -y install gcc gcc-c++ make cmake unixODBC-devel krb5-libs keyutils-libs ccache || true
135+
yum -y install gcc gcc-c++ make cmake unixODBC-devel krb5-libs keyutils-libs ccache curl || true
133136
fi
134137
gcc --version || true
135138
cmake --version || true
@@ -138,7 +141,7 @@ stages:
138141
docker exec build-$(LINUX_TAG)-$(ARCH) sh -lc '
139142
set -euxo pipefail
140143
apk update || true
141-
apk add --no-cache bash build-base cmake unixodbc-dev krb5-libs keyutils-libs ccache || true
144+
apk add --no-cache bash build-base cmake unixodbc-dev krb5-libs keyutils-libs ccache curl || true
142145
gcc --version || true
143146
cmake --version || true
144147
'
@@ -208,6 +211,9 @@ stages:
208211
cd /workspace/mssql_python/pybind;
209212
bash build.sh;
210213
214+
# Step 3.5: Extract mssql_py_core from NuGet for this Python version
215+
bash /workspace/eng/scripts/install-mssql-py-core.sh;
216+
211217
# Step 4: Build wheel
212218
echo "Building wheel package...";
213219
cd /workspace;
@@ -273,6 +279,9 @@ stages:
273279
cd /workspace/mssql_python/pybind;
274280
bash build.sh;
275281
282+
# Step 3.5: Extract mssql_py_core from NuGet for this Python version
283+
bash /workspace/eng/scripts/install-mssql-py-core.sh;
284+
276285
# Step 4: Build wheel
277286
echo "Building wheel package...";
278287
cd /workspace;

OneBranchPipelines/stages/build-macos-single-stage.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ stages:
169169
env:
170170
DB_PASSWORD: $(DB_PASSWORD)
171171
172+
# =========================
173+
# MSSQL_PY_CORE INSTALLATION
174+
# =========================
175+
# Extract mssql_py_core from NuGet into repo root BEFORE testing
176+
# Required for bulkcopy tests which use mssql_py_core native bindings
177+
- script: |
178+
bash $(Build.SourcesDirectory)/eng/scripts/install-mssql-py-core.sh
179+
displayName: 'Install mssql_py_core from NuGet'
180+
172181
# =========================
173182
# TESTING
174183
# =========================
@@ -186,6 +195,7 @@ stages:
186195
# =========================
187196
# WHEEL BUILD
188197
# =========================
198+
189199
# Build wheel package from setup.py
190200
# Wheel filename: mssql_python-X.Y.Z-cp3XX-cp3XX-macosx_XX_X_universal2.whl
191201
# bdist_wheel = build binary wheel distribution (contains pre-compiled .so)

OneBranchPipelines/stages/build-windows-single-stage.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,17 @@ stages:
238238
displayName: 'Build PYD for $(targetArch)'
239239
continueOnError: false
240240
241+
# =========================
242+
# MSSQL_PY_CORE INSTALLATION
243+
# =========================
244+
# Extract mssql_py_core from NuGet into repo root BEFORE testing
245+
# Required for bulkcopy tests which use mssql_py_core native bindings
246+
- task: PowerShell@2
247+
displayName: 'Install mssql_py_core from NuGet'
248+
inputs:
249+
targetType: 'filePath'
250+
filePath: '$(Build.SourcesDirectory)\eng\scripts\install-mssql-py-core.ps1'
251+
241252
# =========================
242253
# TESTING
243254
# =========================

eng/pipelines/pr-validation-pipeline.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ jobs:
230230
build.bat x64
231231
displayName: 'Build .pyd file'
232232
233+
- template: steps/install-mssql-py-core.yml
234+
parameters:
235+
platform: windows
236+
233237
# Run tests for LocalDB
234238
- script: |
235239
python -m pytest -v --junitxml=test-results-localdb.xml --cov=. --cov-report=xml:coverage-localdb.xml --capture=tee-sys --cache-clear
@@ -497,6 +501,10 @@ jobs:
497501
./build.sh
498502
displayName: 'Build pybind bindings (.so)'
499503
504+
- template: steps/install-mssql-py-core.yml
505+
parameters:
506+
platform: unix
507+
500508
- script: |
501509
echo "Build successful, running tests now"
502510
python -m pytest -v --junitxml=test-results.xml --cov=. --cov-report=xml --capture=tee-sys --cache-clear
@@ -669,6 +677,12 @@ jobs:
669677
"
670678
displayName: 'Build pybind bindings (.so) in $(distroName) container'
671679
680+
- template: steps/install-mssql-py-core.yml
681+
parameters:
682+
platform: container
683+
containerName: test-container-$(distroName)
684+
venvActivate: 'source /opt/venv/bin/activate'
685+
672686
- script: |
673687
# Uninstall ODBC Driver before running tests
674688
docker exec test-container-$(distroName) bash -c "
@@ -984,6 +998,12 @@ jobs:
984998
displayName: 'Build pybind bindings (.so) in $(distroName) ARM64 container'
985999
retryCountOnTaskFailure: 2
9861000
1001+
- template: steps/install-mssql-py-core.yml
1002+
parameters:
1003+
platform: container
1004+
containerName: test-container-$(distroName)-$(archName)
1005+
venvActivate: 'source /opt/venv/bin/activate'
1006+
9871007
- script: |
9881008
# Uninstall ODBC Driver before running tests
9891009
docker exec test-container-$(distroName)-$(archName) bash -c "
@@ -1192,6 +1212,12 @@ jobs:
11921212
"
11931213
displayName: 'Build pybind bindings (.so) in RHEL 9 container'
11941214
1215+
- template: steps/install-mssql-py-core.yml
1216+
parameters:
1217+
platform: container
1218+
containerName: test-container-rhel9
1219+
venvActivate: 'source myvenv/bin/activate'
1220+
11951221
- script: |
11961222
# Uninstall ODBC Driver before running tests
11971223
docker exec test-container-rhel9 bash -c "
@@ -1411,6 +1437,12 @@ jobs:
14111437
displayName: 'Build pybind bindings (.so) in RHEL 9 ARM64 container'
14121438
retryCountOnTaskFailure: 2
14131439
1440+
- template: steps/install-mssql-py-core.yml
1441+
parameters:
1442+
platform: container
1443+
containerName: test-container-rhel9-arm64
1444+
venvActivate: 'source myvenv/bin/activate'
1445+
14141446
- script: |
14151447
# Uninstall ODBC Driver before running tests
14161448
docker exec test-container-rhel9-arm64 bash -c "
@@ -1638,6 +1670,12 @@ jobs:
16381670
"
16391671
displayName: 'Build pybind bindings (.so) in Alpine x86_64 container'
16401672
1673+
- template: steps/install-mssql-py-core.yml
1674+
parameters:
1675+
platform: container
1676+
containerName: test-container-alpine
1677+
venvActivate: 'source /workspace/venv/bin/activate'
1678+
16411679
- script: |
16421680
# Uninstall ODBC Driver before running tests to use bundled libraries
16431681
docker exec test-container-alpine bash -c "
@@ -1883,6 +1921,12 @@ jobs:
18831921
displayName: 'Build pybind bindings (.so) in Alpine ARM64 container'
18841922
retryCountOnTaskFailure: 2
18851923
1924+
- template: steps/install-mssql-py-core.yml
1925+
parameters:
1926+
platform: container
1927+
containerName: test-container-alpine-arm64
1928+
venvActivate: 'source /workspace/venv/bin/activate'
1929+
18861930
- script: |
18871931
# Uninstall ODBC Driver before running tests to use bundled libraries
18881932
docker exec test-container-alpine-arm64 bash -c "
@@ -2005,6 +2049,10 @@ jobs:
20052049
build.bat x64
20062050
displayName: 'Build .pyd file'
20072051
2052+
- template: steps/install-mssql-py-core.yml
2053+
parameters:
2054+
platform: windows
2055+
20082056
- script: |
20092057
python -m pytest -v --junitxml=test-results-azuresql.xml --cov=. --cov-report=xml:coverage-azuresql.xml --capture=tee-sys --cache-clear
20102058
displayName: 'Run tests on Azure SQL Database'
@@ -2047,6 +2095,10 @@ jobs:
20472095
./build.sh
20482096
displayName: 'Build pybind bindings (.so)'
20492097
2098+
- template: steps/install-mssql-py-core.yml
2099+
parameters:
2100+
platform: unix
2101+
20502102
- script: |
20512103
python -m pytest -v --junitxml=test-results-azuresql.xml --cov=. --cov-report=xml:coverage-azuresql.xml --capture=tee-sys --cache-clear
20522104
displayName: 'Run tests on Azure SQL Database'
@@ -2118,6 +2170,12 @@ jobs:
21182170
"
21192171
displayName: 'Build pybind bindings (.so) in Ubuntu container'
21202172
2173+
- template: steps/install-mssql-py-core.yml
2174+
parameters:
2175+
platform: container
2176+
containerName: test-container-ubuntu-azuresql
2177+
venvActivate: 'source /opt/venv/bin/activate'
2178+
21212179
- script: |
21222180
docker exec test-container-ubuntu-azuresql bash -c "
21232181
export DEBIAN_FRONTEND=noninteractive
@@ -2212,6 +2270,10 @@ jobs:
22122270
./build.sh codecov
22132271
displayName: 'Build pybind bindings with coverage'
22142272
2273+
- template: steps/install-mssql-py-core.yml
2274+
parameters:
2275+
platform: unix
2276+
22152277
- script: |
22162278
# Generate unified coverage (Python + C++)
22172279
chmod +x ./generate_codecov.sh

0 commit comments

Comments
 (0)