Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 7 additions & 3 deletions OneBranchPipelines/build-release-package-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ schedules:
# PIPELINE PARAMETERS
# =========================
parameters:
# ADO manual runs require a non-empty string; this sentinel maps to no override below.
- name: rsVersionOverride
displayName: 'Exact mssql-python-rs test version (NonOfficial only)'
displayName: 'mssql-python-rs test version (NonOfficial only; keep committed for Official)'
type: string
default: ''
default: 'committed'

# OneBranch build type determines compliance level
# - Official: Production builds with full SDL compliance, all security scanning enabled
Expand Down Expand Up @@ -188,7 +189,10 @@ parameters:
# =========================
variables:
- name: MSSQL_PYTHON_RS_VERSION
value: ${{ parameters.rsVersionOverride }}
${{ if eq(parameters.rsVersionOverride, 'committed') }}:
value: ''
${{ else }}:
value: ${{ parameters.rsVersionOverride }}
# Determine effective build type: scheduled builds are Official, manual/PR builds use parameter
# Build.Reason values: Schedule, Manual, IndividualCI, PullRequest, BatchedCI
- name: effectiveOneBranchType
Expand Down
15 changes: 8 additions & 7 deletions OneBranchPipelines/stages/build-linux-single-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ stages:
name: Python-1ES-pool
demands:
- imageOverride -equals PYTHON-1ES-UB2404
# Six serial build/test cycles exceed two hours under QEMU-based ARM64 emulation.
timeoutInMinutes: 180
# Allow four hours for six serial build/test cycles under QEMU-based ARM64 emulation.
timeoutInMinutes: 240

variables:
# Disable BinSkim for Linux - requires ICU libraries not available in manylinux/musllinux containers
Expand Down Expand Up @@ -123,14 +123,14 @@ stages:

- script: |
# Determine image based on LINUX_TAG and ARCH
# Images are published by github.com/microsoft/mssql-rs to GHCR and are
# public, so no registry login is required to pull them.
# Pull the public PyPA images directly because GHCR is not reliably
# reachable from the hosted 1ES agents.
# manylinux_2_28 = AlmaLinux 8 / RHEL 8 compatible (glibc 2.28)
# musllinux_1_2 = Alpine-based (musl libc)
if [[ "$(LINUX_TAG)" == "manylinux_2_28" ]]; then
IMAGE="ghcr.io/microsoft/mssql-rs/import/python-build/manylinux_2_28_$(ARCH):latest"
IMAGE="quay.io/pypa/manylinux_2_28_$(ARCH):latest"
elif [[ "$(LINUX_TAG)" == "musllinux" ]]; then
IMAGE="ghcr.io/microsoft/mssql-rs/import/python-build/musllinux_1_2_$(ARCH):latest"
IMAGE="quay.io/pypa/musllinux_1_2_$(ARCH):latest"
else
echo "ERROR: Unsupported LINUX_TAG '$(LINUX_TAG)'. Expected: manylinux_2_28 or musllinux" >&2
exit 1
Expand All @@ -143,7 +143,8 @@ stages:
$IMAGE \
tail -f /dev/null
displayName: 'Start $(LINUX_TAG) $(ARCH) container'

retryCountOnTaskFailure: 5

- script: |
set -euo pipefail
export PATH=$PATH:`pwd`/docker
Expand Down
17 changes: 14 additions & 3 deletions tests/test_039_rs_runtime_pipelines.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@
"OneBranchPipelines/build-release-package-pipeline.yml",
"OneBranchPipelines/stress-test-pipeline.yml",
)
EMPTY_OVERRIDE_ENTRY_POINTS = (
"eng/pipelines/pr-validation-pipeline.yml",
"eng/pipelines/mssql-odbc-daily-validation-pipeline.yml",
"OneBranchPipelines/stress-test-pipeline.yml",
)


@pytest.mark.parametrize("filename", ENTRY_POINTS)
def test_pipeline_override_is_explicit_and_defaults_to_empty(filename):
@pytest.mark.parametrize("filename", EMPTY_OVERRIDE_ENTRY_POINTS)
def test_nonofficial_pipeline_override_is_explicit_and_defaults_to_empty(filename):
source = (ROOT / filename).read_text(encoding="utf-8")
assert re.search(r"name: rsVersionOverride[\s\S]*?default: ''", source)
assert VERSION_ENV in source
Expand Down Expand Up @@ -102,7 +107,13 @@ def test_official_entry_points_keep_stable_defaults_without_nightly_resolution()
(PIPELINES / "build-release-package-pipeline.yml").read_text(encoding="utf-8")
)
override = next(p for p in pipeline["parameters"] if p["name"] == "rsVersionOverride")
assert override["default"] == ""
assert override["default"] == "committed"
runtime = next(v for v in pipeline["variables"] if v["name"] == VERSION_ENV)
assert runtime == {
"name": VERSION_ENV,
"${{ if eq(parameters.rsVersionOverride, 'committed') }}": {"value": ""},
"${{ else }}": {"value": "${{ parameters.rsVersionOverride }}"},
}


def test_modified_pipeline_yaml_parses():
Expand Down
30 changes: 0 additions & 30 deletions tests/test_native_fetch_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,36 +438,6 @@ def fail_map(cursor):
assert observed == [(4, 3, 4), (4, 3, 4)]


@pytest.mark.skipif(
sys.version_info < (3, 13),
reason="Custom MRO prevents type version assignment on CPython 3.13+",
)
def test_native_plan_requires_rearmed_type_dependencies(connection):
runtime = _redesign_runtime()

class CustomMro(type):
def mro(cls):
return [cls, object]

class Unversioned(metaclass=CustomMro):
pass

with _native_fetch_counters() as profiling, connection.cursor() as cursor:
warm(cursor, "fetchone")
policy = runtime[2]
with patch.object(policy, "classes", (*policy.classes, Unversioned)):
ddbc_bindings._invalidate_native_fetch(cursor)
with _fetchone_window(profiling) as declined:
assert cursor.fetchone()[0] == 3
_assert_fetchone_counts(declined, prepare=1, native=0, fallback=1, sql=1)
ddbc_bindings._invalidate_native_fetch(cursor)
with _fetchone_window(profiling) as restored:
assert cursor.fetchone()[0] == 4
_assert_fetchone_counts(restored, prepare=1, native=1, fallback=0, sql=1)
assert cursor.rowcount == 4
assert cursor.rownumber == 3


@pytest.mark.parametrize("method", ("fetchval", "iterator"))
def test_warm_fetchone_override_is_not_bypassed(connection, method):
with connection.cursor() as cursor:
Expand Down
Loading