Skip to content

Commit ccdd41c

Browse files
mssql-rs Build Service (SqlClientDrivers)saurabh500
authored andcommitted
Merged PR 7400: Sync development to main
Sync of development to main branch. Before merging this PR, ensure that the CI has had a good run on the development branch.
2 parents 203160e + a66638f commit ccdd41c

56 files changed

Lines changed: 5095 additions & 418 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.pipeline/sync-container-images.yml

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ stages:
118118
steps:
119119
- checkout: none
120120
- task: AzureCLI@2
121-
displayName: 'Import manylinux x64'
121+
displayName: 'Import manylinux_2_34 x64'
122122
inputs:
123123
azureSubscription: 'Magnitude Test'
124124
scriptType: 'bash'
@@ -131,7 +131,7 @@ stages:
131131
--force
132132
retryCountOnTaskFailure: 3
133133
- task: AzureCLI@2
134-
displayName: 'Import manylinux arm64'
134+
displayName: 'Import manylinux_2_34 arm64'
135135
inputs:
136136
azureSubscription: 'Magnitude Test'
137137
scriptType: 'bash'
@@ -143,6 +143,32 @@ stages:
143143
--image import/python-build/manylinux_2_34_aarch64:latest \
144144
--force
145145
retryCountOnTaskFailure: 3
146+
- task: AzureCLI@2
147+
displayName: 'Import manylinux_2_28 x64'
148+
inputs:
149+
azureSubscription: 'Magnitude Test'
150+
scriptType: 'bash'
151+
scriptLocation: 'inlineScript'
152+
inlineScript: |
153+
az acr import \
154+
--name $(ACR_NAME) \
155+
--source quay.io/pypa/manylinux_2_28_x86_64:latest \
156+
--image import/python-build/manylinux_2_28_x86_64:latest \
157+
--force
158+
retryCountOnTaskFailure: 3
159+
- task: AzureCLI@2
160+
displayName: 'Import manylinux_2_28 arm64'
161+
inputs:
162+
azureSubscription: 'Magnitude Test'
163+
scriptType: 'bash'
164+
scriptLocation: 'inlineScript'
165+
inlineScript: |
166+
az acr import \
167+
--name $(ACR_NAME) \
168+
--source quay.io/pypa/manylinux_2_28_aarch64:latest \
169+
--image import/python-build/manylinux_2_28_aarch64:latest \
170+
--force
171+
retryCountOnTaskFailure: 3
146172

147173
# -----------------------------------------------------------------------------
148174
# Sync Stage 2: PyPA musllinux images (quay.io - no Docker Hub rate limit)
@@ -821,7 +847,7 @@ stages:
821847
echo "======================================================"
822848
echo "Vanilla PyPA Base Images:"
823849
echo "======================================================"
824-
for image in import/python-build/manylinux_2_34_x86_64 import/python-build/manylinux_2_34_aarch64 import/python-build/musllinux_1_2_x86_64 import/python-build/musllinux_1_2_aarch64; do
850+
for image in import/python-build/manylinux_2_34_x86_64 import/python-build/manylinux_2_34_aarch64 import/python-build/manylinux_2_28_x86_64 import/python-build/manylinux_2_28_aarch64 import/python-build/musllinux_1_2_x86_64 import/python-build/musllinux_1_2_aarch64; do
825851
echo ""
826852
echo "==> $image"
827853
az acr repository show-tags --name $(ACR_NAME) --repository $image --output table --orderby time_desc --top 3 || echo " (not found)"
@@ -871,10 +897,12 @@ stages:
871897
echo ""
872898
echo "Available images in ACR:"
873899
echo " Vanilla PyPA base images:"
874-
echo " - $(ACR_REGISTRY)/python-build/manylinux_2_34_x86_64:latest"
875-
echo " - $(ACR_REGISTRY)/python-build/manylinux_2_34_aarch64:latest"
876-
echo " - $(ACR_REGISTRY)/python-build/musllinux_1_2_x86_64:latest"
877-
echo " - $(ACR_REGISTRY)/python-build/musllinux_1_2_aarch64:latest"
900+
echo " - $(ACR_REGISTRY)/import/python-build/manylinux_2_34_x86_64:latest"
901+
echo " - $(ACR_REGISTRY)/import/python-build/manylinux_2_34_aarch64:latest"
902+
echo " - $(ACR_REGISTRY)/import/python-build/manylinux_2_28_x86_64:latest"
903+
echo " - $(ACR_REGISTRY)/import/python-build/manylinux_2_28_aarch64:latest"
904+
echo " - $(ACR_REGISTRY)/import/python-build/musllinux_1_2_x86_64:latest"
905+
echo " - $(ACR_REGISTRY)/import/python-build/musllinux_1_2_aarch64:latest"
878906
echo ""
879907
echo " Custom images with Rust (RECOMMENDED FOR CI/CD):"
880908
echo " - $(ACR_REGISTRY)/python-build/manylinux_2_34_x86_64_rust:latest"

.pipeline/templates/build-template.yml

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ parameters:
3636
type: boolean
3737
default: true
3838

39+
- name: enableRustBuild
40+
displayName: Enable standalone Rust Debug/Release build steps
41+
type: boolean
42+
default: true
43+
44+
- name: enableClippy
45+
displayName: Enable Rust Clippy lint step
46+
type: boolean
47+
default: true
48+
3949
steps:
4050
- template: generate-sql-password-template.yml
4151
parameters:
@@ -44,22 +54,23 @@ steps:
4454
- script: cargo fetch
4555
displayName: Fetch Crates
4656

47-
- script: |
48-
cargo build --frozen 2>&1
49-
displayName: Rust Debug Build
50-
condition: and(succeeded(), or(eq('${{parameters.buildType}}', 'Debug'), eq('${{parameters.buildType}}', 'Both')), eq(variables['Build.Reason'], 'PullRequest'))
57+
- ${{ if eq(parameters.enableRustBuild, true) }}:
58+
- script: |
59+
cargo build --frozen 2>&1
60+
displayName: Rust Debug Build
61+
condition: and(succeeded(), or(eq('${{parameters.buildType}}', 'Debug'), eq('${{parameters.buildType}}', 'Both')), eq(variables['Build.Reason'], 'PullRequest'))
5162
52-
- script: |
53-
cargo build --frozen --release 2>&1
54-
displayName: Rust Release Build
55-
condition: and(succeeded(), or(eq('${{parameters.buildType}}', 'Release'), eq('${{parameters.buildType}}', 'Both')), eq(variables['Build.Reason'], 'PullRequest'))
63+
- script: |
64+
cargo build --frozen --release 2>&1
65+
displayName: Rust Release Build
66+
condition: and(succeeded(), or(eq('${{parameters.buildType}}', 'Release'), eq('${{parameters.buildType}}', 'Both')), eq(variables['Build.Reason'], 'PullRequest'))
5667
57-
- ${{ if eq(parameters.osType, 'Windows') }}:
68+
- ${{ if and(eq(parameters.enableClippy, true), eq(parameters.osType, 'Windows')) }}:
5869
- pwsh: ./scripts/bclippy.ps1
5970
displayName: Rust Clippy Lint (workspace + mssql-py-core)
6071
condition: and(succeeded(), or(eq('${{parameters.buildType}}', 'Release'), eq('${{parameters.buildType}}', 'Both')), eq(variables['Build.Reason'], 'PullRequest'))
6172

62-
- ${{ if ne(parameters.osType, 'Windows') }}:
73+
- ${{ if and(eq(parameters.enableClippy, true), ne(parameters.osType, 'Windows')) }}:
6374
- script: ./scripts/bclippy.sh
6475
displayName: Rust Clippy Lint (workspace + mssql-py-core)
6576
condition: and(succeeded(), or(eq('${{parameters.buildType}}', 'Release'), eq('${{parameters.buildType}}', 'Both')), eq(variables['Build.Reason'], 'PullRequest'))
@@ -164,25 +175,26 @@ steps:
164175
summaryFileLocation: "$(Build.SourcesDirectory)/target/lcov.info"
165176
pathToSources: "$(Build.SourcesDirectory)"
166177

167-
- task: CopyFiles@2
168-
displayName: Copy Rust Debug Build
169-
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), or(eq('${{parameters.buildType}}', 'Debug'), eq('${{parameters.buildType}}', 'Both')))
170-
inputs:
171-
SourceFolder: '$(CARGO_TARGET_DIR)/debug'
172-
Contents: |
173-
*
174-
!.cargo-lock
175-
TargetFolder: '$(Build.ArtifactStagingDirectory)/debug'
176-
177-
- task: CopyFiles@2
178-
displayName: Copy Rust Release Build
179-
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), or( eq('${{parameters.buildType}}', 'Release'), eq('${{parameters.buildType}}', 'Both')))
180-
inputs:
181-
SourceFolder: '$(CARGO_TARGET_DIR)/release'
182-
Contents: |
183-
*
184-
!.cargo-lock
185-
TargetFolder: '$(Build.ArtifactStagingDirectory)/release'
178+
- ${{ if eq(parameters.enableRustBuild, true) }}:
179+
- task: CopyFiles@2
180+
displayName: Copy Rust Debug Build
181+
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), or(eq('${{parameters.buildType}}', 'Debug'), eq('${{parameters.buildType}}', 'Both')))
182+
inputs:
183+
SourceFolder: '$(CARGO_TARGET_DIR)/debug'
184+
Contents: |
185+
*
186+
!.cargo-lock
187+
TargetFolder: '$(Build.ArtifactStagingDirectory)/debug'
188+
189+
- task: CopyFiles@2
190+
displayName: Copy Rust Release Build
191+
condition: and(succeeded(), eq(variables['Build.Reason'], 'PullRequest'), or( eq('${{parameters.buildType}}', 'Release'), eq('${{parameters.buildType}}', 'Both')))
192+
inputs:
193+
SourceFolder: '$(CARGO_TARGET_DIR)/release'
194+
Contents: |
195+
*
196+
!.cargo-lock
197+
TargetFolder: '$(Build.ArtifactStagingDirectory)/release'
186198

187199
- ${{ if eq(parameters.enableJsBuild, true) }}:
188200
- bash: |

.pipeline/templates/test-mssql-python-template.yml

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,14 @@ steps:
133133
set -e
134134
update-ca-certificates
135135
source ~/.cargo/env
136-
137-
# Install Python 3.12 via deadsnakes PPA
138-
apt-get update
139-
apt-get install -y software-properties-common
140-
add-apt-repository -y ppa:deadsnakes/ppa
141-
apt-get update
142-
apt-get install -y python3.12 python3.12-venv python3.12-dev
143-
144-
# Create Python 3.12 venv and install deps
145-
python3.12 -m venv /tmp/py312-venv
146-
source /tmp/py312-venv/bin/activate
136+
137+
# Use the build image'"'"'s pre-installed Python 3.10 (mssql-python requires >=3.10).
138+
# No PPA install — avoids dependency on Launchpad availability.
139+
python3 -m venv /tmp/py-venv
140+
source /tmp/py-venv/bin/activate
147141
pip install --upgrade pip -q
148142
pip install maturin pytest pytest-asyncio python-dotenv patchelf pybind11 wheel setuptools -q
149-
150-
# Run the test script
143+
151144
./dev/test-python.sh --mssql-python
152145
'
153146
displayName: Build bindings and run mssql-python tests
@@ -168,45 +161,39 @@ steps:
168161
$BUILD_IMAGE \
169162
bash -c '
170163
set -e
171-
172-
# Install Python 3.12
173-
apt-get update
174-
apt-get install -y software-properties-common
175-
add-apt-repository -y ppa:deadsnakes/ppa
176-
apt-get update
177-
apt-get install -y python3.12 python3.12-venv
178-
179-
# Setup Python 3.12 venv
180-
python3.12 -m venv /tmp/wheel-venv
164+
165+
# Use the build image'"'"'s pre-installed Python 3.10 (mssql-python requires >=3.10).
166+
# No PPA install — avoids dependency on Launchpad availability.
167+
python3 -m venv /tmp/wheel-venv
181168
source /tmp/wheel-venv/bin/activate
182169
pip install --upgrade pip -q
183170
pip install wheel setuptools -q
184-
171+
185172
# Verify both .so files exist (from test-python.sh)
186173
echo "Verifying bindings from test step..."
187174
ls -la mssql_python/*.so
188-
175+
189176
# Create combined artifact folder
190177
mkdir -p /workspace/mssql-python-artifacts
191-
178+
192179
# Copy mssql_py_core.so standalone for plug-n-play
193180
cp mssql_python/mssql_py_core*.so /workspace/mssql-python-artifacts/
194-
181+
195182
# Extract mssql_py_core from NuGet (sets up mssql_py_core/ directory
196183
# with __init__.py and native extension required by setup.py validation)
197184
bash eng/scripts/install-mssql-py-core.sh
198-
185+
199186
# Overwrite with freshly built .so from test step
200187
cp mssql_python/mssql_py_core*.so mssql_py_core/
201-
188+
202189
# Build mssql-python wheel
203190
echo "Building mssql-python wheel..."
204191
rm -rf dist/ build/ *.egg-info
205192
python setup.py bdist_wheel
206-
193+
207194
# Copy wheel to artifact folder
208195
cp dist/*.whl /workspace/mssql-python-artifacts/
209-
196+
210197
echo "Artifacts:"
211198
ls -la /workspace/mssql-python-artifacts/
212199
'

.pipeline/validation-pipeline.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ stages:
218218
osType: MacOS
219219
buildType: ${{ parameters.buildType }}
220220
testFilter: -E 'not (test(connectivity))'
221+
enableRustBuild: false
222+
enableClippy: false
221223

222224
# Kerberos tests for PRs (fast - 2 distros: ubuntu22 + alpine318)
223225
- stage: Kerberos_Test_PR

Cargo.toml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,61 @@ resolver = "2"
33
members = ["mssql-tds", "mssql-js", "mssql-tds-cli", "mssql-mock-tds"]
44
exclude = ["mssql-py-core", "mssql-mock-tds-py"]
55

6+
[workspace.lints.rust]
7+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)', 'cfg(feature, values("sspi", "gssapi", "integrated-auth"))'] }
8+
9+
[workspace.lints.clippy]
10+
# Don't Panic - prevent panics from unwraps and unsafe slicing or indexing
11+
# string_slice = "warn"
12+
# indexing_slicing = "warn"
13+
# unwrap_used = "warn"
14+
# panic = "warn"
15+
# todo = "warn"
16+
# unimplemented = "warn"
17+
# unreachable = "warn"
18+
# get_unwrap = "warn"
19+
# unwrap_in_result = "warn"
20+
# unchecked_time_subtraction = "warn"
21+
# panic_in_result_fn = "warn"
22+
23+
# Don't Fail Silently - prevent dropped futures and swallowed errors
24+
# let_underscore_future = "warn"
25+
# let_underscore_must_use = "warn"
26+
# unused_result_ok = "warn"
27+
# map_err_ignore = "warn"
28+
# assertions_on_result_states = "warn"
29+
30+
# Don't Do Bad Async Stuff - prevent deadlocks and concurrency bugs
31+
await_holding_lock = "warn"
32+
await_holding_refcell_ref = "warn"
33+
large_futures = "warn"
34+
35+
# Don't Do Unsafe Things with Memory
36+
# mem_forget = "warn"
37+
# undocumented_unsafe_blocks = "warn"
38+
# multiple_unsafe_ops_per_block = "warn"
39+
# unnecessary_safety_doc = "warn"
40+
# unnecessary_safety_comment = "warn"
41+
42+
# Don't Do Potentially Incorrect Things with Numbers
43+
# float_cmp = "warn"
44+
# float_cmp_const = "warn"
45+
# lossy_float_literal = "warn"
46+
# cast_sign_loss = "warn"
47+
# invalid_upcast_comparisons = "warn"
48+
49+
# Don't Do Bad Things That are Easy to Avoid
50+
# rc_mutex = "warn"
51+
# debug_assert_with_mut_call = "warn"
52+
# iter_not_returning_iterator = "warn"
53+
# expl_impl_clone_on_copy = "warn"
54+
# infallible_try_from = "warn"
55+
# dbg_macro = "warn"
56+
57+
# Don't `allow` Your Way Around These Lints
58+
# allow_attributes = "warn"
59+
# allow_attributes_without_reason = "warn"
60+
661
[profile.release]
762
lto = true
863
strip = "symbols"

0 commit comments

Comments
 (0)