diff --git a/eng/pipelines/pr-validation-pipeline.yml b/eng/pipelines/pr-validation-pipeline.yml index 899b1182..9ad9842a 100644 --- a/eng/pipelines/pr-validation-pipeline.yml +++ b/eng/pipelines/pr-validation-pipeline.yml @@ -2117,226 +2117,230 @@ jobs: testRunTitle: 'Publish pytest results on Alpine ARM64' # =========================================================================================== -# Azure SQL Database Testing Jobs -# Gated on the AZURE_CONNECTION_STRING pipeline variable being set. -# No local SQL Server install needed — tests run directly against the cloud database. -# Runs every 16 days (on days divisible by 16) or when ENABLE_AZURE_SQL is set to true # =========================================================================================== - -- job: CheckAzureSQLSchedule - displayName: 'Check if Azure SQL tests should run' - pool: - vmImage: 'ubuntu-latest' - steps: - - bash: | - day=$(date +%d) - remainder=$((10#$day % 15)) - if [ "$remainder" -eq 0 ] || [ "$(ENABLE_AZURE_SQL)" = "true" ]; then - echo "##vso[task.setvariable variable=shouldRunAzureSQL;isOutput=true]true" - echo "Azure SQL tests will run (day: $day, ENABLE_AZURE_SQL: $(ENABLE_AZURE_SQL))" - else - echo "##vso[task.setvariable variable=shouldRunAzureSQL;isOutput=true]false" - echo "Azure SQL tests will be skipped (day: $day, ENABLE_AZURE_SQL: $(ENABLE_AZURE_SQL))" - fi - displayName: 'Determine if Azure SQL tests should run' - name: checkSchedule - -- job: PytestOnWindows_AzureSQL - displayName: 'Windows x64 AzureSQL' - dependsOn: CheckAzureSQLSchedule - condition: eq(dependencies.CheckAzureSQLSchedule.outputs['checkSchedule.shouldRunAzureSQL'], 'true') - pool: - vmImage: 'windows-latest' - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.13' - addToPath: true - githubToken: $(GITHUB_TOKEN) - displayName: 'Use Python 3.13' - - - script: | - python -m pip install --upgrade pip - pip install -r requirements.txt - displayName: 'Install dependencies' - - - script: | - cd mssql_python\pybind - build.bat x64 - displayName: 'Build .pyd file' - - - template: steps/install-mssql-py-core.yml - parameters: - platform: windows - - - script: | - python -m pytest -v --junitxml=test-results-azuresql.xml --cov=. --cov-report=xml:coverage-azuresql.xml --capture=tee-sys --cache-clear - displayName: 'Run tests on Azure SQL Database' - env: - DB_CONNECTION_STRING: $(AZURE_CONNECTION_STRING) - - - task: PublishTestResults@2 - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/test-results-azuresql.xml' - testRunTitle: 'Publish test results for Windows AzureSQL' - -- job: PytestOnMacOS_AzureSQL - displayName: 'macOS x86_64 AzureSQL' - dependsOn: CheckAzureSQLSchedule - condition: eq(dependencies.CheckAzureSQLSchedule.outputs['checkSchedule.shouldRunAzureSQL'], 'true') - pool: - vmImage: 'macos-latest' - - steps: - - task: UsePythonVersion@0 - inputs: - versionSpec: '3.13' - addToPath: true - displayName: 'Use Python 3.13' - - - script: | - brew update - brew uninstall cmake --ignore-dependencies || echo "CMake not installed or already removed" - brew install cmake - displayName: 'Install CMake' - - - script: | - python -m pip install --upgrade pip - pip install -r requirements.txt - displayName: 'Install Python dependencies' - - - script: | - cd mssql_python/pybind - ./build.sh - displayName: 'Build pybind bindings (.so)' - - - template: steps/install-mssql-py-core.yml - parameters: - platform: unix - - - script: | - python -m pytest -v --junitxml=test-results-azuresql.xml --cov=. --cov-report=xml:coverage-azuresql.xml --capture=tee-sys --cache-clear - displayName: 'Run tests on Azure SQL Database' - env: - DB_CONNECTION_STRING: $(AZURE_CONNECTION_STRING) - - - task: PublishTestResults@2 - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/test-results-azuresql.xml' - testRunTitle: 'Publish pytest results on macOS AzureSQL' - -- job: PytestOnLinux_AzureSQL - displayName: 'Linux x86_64 AzureSQL' - dependsOn: CheckAzureSQLSchedule - condition: eq(dependencies.CheckAzureSQLSchedule.outputs['checkSchedule.shouldRunAzureSQL'], 'true') - pool: - vmImage: 'ubuntu-latest' - - steps: - - script: | - docker run -d --name test-container-ubuntu-azuresql \ - -v $(Build.SourcesDirectory):/workspace \ - -w /workspace \ - --network bridge \ - ubuntu:22.04 \ - tail -f /dev/null - displayName: 'Create Ubuntu container' - - - script: | - docker exec test-container-ubuntu-azuresql bash -c " - export DEBIAN_FRONTEND=noninteractive - export TZ=UTC - ln -snf /usr/share/zoneinfo/\$TZ /etc/localtime && echo \$TZ > /etc/timezone - apt-get update && - apt-get install -y python3 python3-pip python3-venv python3-full cmake curl wget gnupg software-properties-common build-essential python3-dev pybind11-dev - " - displayName: 'Install basic dependencies in Ubuntu container' - - - script: | - docker exec test-container-ubuntu-azuresql bash -c " - export DEBIAN_FRONTEND=noninteractive - curl -sSL -O https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb - dpkg -i packages-microsoft-prod.deb || true - rm packages-microsoft-prod.deb - apt-get update - ACCEPT_EULA=Y apt-get install -y msodbcsql18 - ACCEPT_EULA=Y apt-get install -y mssql-tools18 - apt-get install -y unixodbc-dev - " - displayName: 'Install ODBC Driver in Ubuntu container' - - - script: | - docker exec test-container-ubuntu-azuresql bash -c " - python3 -m venv /opt/venv - source /opt/venv/bin/activate - python -m pip install --upgrade pip - python -m pip install -r requirements.txt - echo 'source /opt/venv/bin/activate' >> ~/.bashrc - " - displayName: 'Install Python dependencies in Ubuntu container' - - - script: | - docker exec test-container-ubuntu-azuresql bash -c " - source /opt/venv/bin/activate - cd mssql_python/pybind - chmod +x build.sh - ./build.sh - " - displayName: 'Build pybind bindings (.so) in Ubuntu container' - - - template: steps/install-mssql-py-core.yml - parameters: - platform: container - containerName: test-container-ubuntu-azuresql - venvActivate: 'source /opt/venv/bin/activate' - - - script: | - docker exec test-container-ubuntu-azuresql bash -c " - export DEBIAN_FRONTEND=noninteractive - apt-get remove --purge -y msodbcsql18 mssql-tools18 unixodbc-dev - rm -f /usr/bin/sqlcmd - rm -f /usr/bin/bcp - rm -rf /opt/microsoft/msodbcsql - rm -f /lib/x86_64-linux-gnu/libodbcinst.so.2 - odbcinst -u -d -n 'ODBC Driver 18 for SQL Server' || true - echo 'Uninstalled ODBC Driver and cleaned up libraries' - echo 'Verifying x86_64 debian_ubuntu driver library signatures:' - ldd mssql_python/libs/linux/debian_ubuntu/x86_64/lib/libmsodbcsql-18.5.so.1.1 - " - displayName: 'Uninstall ODBC Driver before running tests in Ubuntu container' - - - script: | - docker exec \ - -e DB_CONNECTION_STRING="$(AZURE_CONNECTION_STRING)" \ - test-container-ubuntu-azuresql bash -c " - source /opt/venv/bin/activate - echo 'Running tests on Ubuntu against Azure SQL Database' - python -m pytest -v --junitxml=test-results-ubuntu-azuresql.xml --cov=. --cov-report=xml:coverage-ubuntu-azuresql.xml --capture=tee-sys --cache-clear - " - displayName: 'Run pytest on Azure SQL in Ubuntu container' - env: - AZURE_CONNECTION_STRING: $(AZURE_CONNECTION_STRING) - - - script: | - docker cp test-container-ubuntu-azuresql:/workspace/test-results-ubuntu-azuresql.xml $(Build.SourcesDirectory)/ - docker cp test-container-ubuntu-azuresql:/workspace/coverage-ubuntu-azuresql.xml $(Build.SourcesDirectory)/ - displayName: 'Copy test results from Ubuntu container' - condition: always() - - - script: | - docker stop test-container-ubuntu-azuresql || true - docker rm test-container-ubuntu-azuresql || true - displayName: 'Clean up Ubuntu container' - condition: always() - - - task: PublishTestResults@2 - condition: succeededOrFailed() - inputs: - testResultsFiles: '**/test-results-ubuntu-azuresql.xml' - testRunTitle: 'Publish pytest results on Ubuntu AzureSQL' +# TEMPORARILY DISABLED: Azure SQL Database Testing Jobs +# To re-enable: Uncomment all jobs below +# =========================================================================================== +# # Azure SQL Database Testing Jobs +# # Gated on the AZURE_CONNECTION_STRING pipeline variable being set. +# # No local SQL Server install needed — tests run directly against the cloud database. +# # Runs every 16 days (on days divisible by 16) or when ENABLE_AZURE_SQL is set to true +# # =========================================================================================== +# +# - job: CheckAzureSQLSchedule +# displayName: 'Check if Azure SQL tests should run' +# pool: +# vmImage: 'ubuntu-latest' +# steps: +# - bash: | +# day=$(date +%d) +# remainder=$((10#$day % 15)) +# if [ "$remainder" -eq 0 ] || [ "$(ENABLE_AZURE_SQL)" = "true" ]; then +# echo "##vso[task.setvariable variable=shouldRunAzureSQL;isOutput=true]true" +# echo "Azure SQL tests will run (day: $day, ENABLE_AZURE_SQL: $(ENABLE_AZURE_SQL))" +# else +# echo "##vso[task.setvariable variable=shouldRunAzureSQL;isOutput=true]false" +# echo "Azure SQL tests will be skipped (day: $day, ENABLE_AZURE_SQL: $(ENABLE_AZURE_SQL))" +# fi +# displayName: 'Determine if Azure SQL tests should run' +# name: checkSchedule +# +# - job: PytestOnWindows_AzureSQL +# displayName: 'Windows x64 AzureSQL' +# dependsOn: CheckAzureSQLSchedule +# condition: eq(dependencies.CheckAzureSQLSchedule.outputs['checkSchedule.shouldRunAzureSQL'], 'true') +# pool: +# vmImage: 'windows-latest' +# +# steps: +# - task: UsePythonVersion@0 +# inputs: +# versionSpec: '3.13' +# addToPath: true +# githubToken: $(GITHUB_TOKEN) +# displayName: 'Use Python 3.13' +# +# - script: | +# python -m pip install --upgrade pip +# pip install -r requirements.txt +# displayName: 'Install dependencies' +# +# - script: | +# cd mssql_python\pybind +# build.bat x64 +# displayName: 'Build .pyd file' +# +# - template: steps/install-mssql-py-core.yml +# parameters: +# platform: windows +# +# - script: | +# python -m pytest -v --junitxml=test-results-azuresql.xml --cov=. --cov-report=xml:coverage-azuresql.xml --capture=tee-sys --cache-clear +# displayName: 'Run tests on Azure SQL Database' +# env: +# DB_CONNECTION_STRING: $(AZURE_CONNECTION_STRING) +# +# - task: PublishTestResults@2 +# condition: succeededOrFailed() +# inputs: +# testResultsFiles: '**/test-results-azuresql.xml' +# testRunTitle: 'Publish test results for Windows AzureSQL' +# +# - job: PytestOnMacOS_AzureSQL +# displayName: 'macOS x86_64 AzureSQL' +# dependsOn: CheckAzureSQLSchedule +# condition: eq(dependencies.CheckAzureSQLSchedule.outputs['checkSchedule.shouldRunAzureSQL'], 'true') +# pool: +# vmImage: 'macos-latest' +# +# steps: +# - task: UsePythonVersion@0 +# inputs: +# versionSpec: '3.13' +# addToPath: true +# displayName: 'Use Python 3.13' +# +# - script: | +# brew update +# brew uninstall cmake --ignore-dependencies || echo "CMake not installed or already removed" +# brew install cmake +# displayName: 'Install CMake' +# +# - script: | +# python -m pip install --upgrade pip +# pip install -r requirements.txt +# displayName: 'Install Python dependencies' +# +# - script: | +# cd mssql_python/pybind +# ./build.sh +# displayName: 'Build pybind bindings (.so)' +# +# - template: steps/install-mssql-py-core.yml +# parameters: +# platform: unix +# +# - script: | +# python -m pytest -v --junitxml=test-results-azuresql.xml --cov=. --cov-report=xml:coverage-azuresql.xml --capture=tee-sys --cache-clear +# displayName: 'Run tests on Azure SQL Database' +# env: +# DB_CONNECTION_STRING: $(AZURE_CONNECTION_STRING) +# +# - task: PublishTestResults@2 +# condition: succeededOrFailed() +# inputs: +# testResultsFiles: '**/test-results-azuresql.xml' +# testRunTitle: 'Publish pytest results on macOS AzureSQL' +# +# - job: PytestOnLinux_AzureSQL +# displayName: 'Linux x86_64 AzureSQL' +# dependsOn: CheckAzureSQLSchedule +# condition: eq(dependencies.CheckAzureSQLSchedule.outputs['checkSchedule.shouldRunAzureSQL'], 'true') +# pool: +# vmImage: 'ubuntu-latest' +# +# steps: +# - script: | +# docker run -d --name test-container-ubuntu-azuresql \ +# -v $(Build.SourcesDirectory):/workspace \ +# -w /workspace \ +# --network bridge \ +# ubuntu:22.04 \ +# tail -f /dev/null +# displayName: 'Create Ubuntu container' +# +# - script: | +# docker exec test-container-ubuntu-azuresql bash -c " +# export DEBIAN_FRONTEND=noninteractive +# export TZ=UTC +# ln -snf /usr/share/zoneinfo/\$TZ /etc/localtime && echo \$TZ > /etc/timezone +# apt-get update && +# apt-get install -y python3 python3-pip python3-venv python3-full cmake curl wget gnupg software-properties-common build-essential python3-dev pybind11-dev +# " +# displayName: 'Install basic dependencies in Ubuntu container' +# +# - script: | +# docker exec test-container-ubuntu-azuresql bash -c " +# export DEBIAN_FRONTEND=noninteractive +# curl -sSL -O https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb +# dpkg -i packages-microsoft-prod.deb || true +# rm packages-microsoft-prod.deb +# apt-get update +# ACCEPT_EULA=Y apt-get install -y msodbcsql18 +# ACCEPT_EULA=Y apt-get install -y mssql-tools18 +# apt-get install -y unixodbc-dev +# " +# displayName: 'Install ODBC Driver in Ubuntu container' +# +# - script: | +# docker exec test-container-ubuntu-azuresql bash -c " +# python3 -m venv /opt/venv +# source /opt/venv/bin/activate +# python -m pip install --upgrade pip +# python -m pip install -r requirements.txt +# echo 'source /opt/venv/bin/activate' >> ~/.bashrc +# " +# displayName: 'Install Python dependencies in Ubuntu container' +# +# - script: | +# docker exec test-container-ubuntu-azuresql bash -c " +# source /opt/venv/bin/activate +# cd mssql_python/pybind +# chmod +x build.sh +# ./build.sh +# " +# displayName: 'Build pybind bindings (.so) in Ubuntu container' +# +# - template: steps/install-mssql-py-core.yml +# parameters: +# platform: container +# containerName: test-container-ubuntu-azuresql +# venvActivate: 'source /opt/venv/bin/activate' +# +# - script: | +# docker exec test-container-ubuntu-azuresql bash -c " +# export DEBIAN_FRONTEND=noninteractive +# apt-get remove --purge -y msodbcsql18 mssql-tools18 unixodbc-dev +# rm -f /usr/bin/sqlcmd +# rm -f /usr/bin/bcp +# rm -rf /opt/microsoft/msodbcsql +# rm -f /lib/x86_64-linux-gnu/libodbcinst.so.2 +# odbcinst -u -d -n 'ODBC Driver 18 for SQL Server' || true +# echo 'Uninstalled ODBC Driver and cleaned up libraries' +# echo 'Verifying x86_64 debian_ubuntu driver library signatures:' +# ldd mssql_python/libs/linux/debian_ubuntu/x86_64/lib/libmsodbcsql-18.5.so.1.1 +# " +# displayName: 'Uninstall ODBC Driver before running tests in Ubuntu container' +# +# - script: | +# docker exec \ +# -e DB_CONNECTION_STRING="$(AZURE_CONNECTION_STRING)" \ +# test-container-ubuntu-azuresql bash -c " +# source /opt/venv/bin/activate +# echo 'Running tests on Ubuntu against Azure SQL Database' +# python -m pytest -v --junitxml=test-results-ubuntu-azuresql.xml --cov=. --cov-report=xml:coverage-ubuntu-azuresql.xml --capture=tee-sys --cache-clear +# " +# displayName: 'Run pytest on Azure SQL in Ubuntu container' +# env: +# AZURE_CONNECTION_STRING: $(AZURE_CONNECTION_STRING) +# +# - script: | +# docker cp test-container-ubuntu-azuresql:/workspace/test-results-ubuntu-azuresql.xml $(Build.SourcesDirectory)/ +# docker cp test-container-ubuntu-azuresql:/workspace/coverage-ubuntu-azuresql.xml $(Build.SourcesDirectory)/ +# displayName: 'Copy test results from Ubuntu container' +# condition: always() +# +# - script: | +# docker stop test-container-ubuntu-azuresql || true +# docker rm test-container-ubuntu-azuresql || true +# displayName: 'Clean up Ubuntu container' +# condition: always() +# +# - task: PublishTestResults@2 +# condition: succeededOrFailed() +# inputs: +# testResultsFiles: '**/test-results-ubuntu-azuresql.xml' +# testRunTitle: 'Publish pytest results on Ubuntu AzureSQL' - job: CodeCoverageReport displayName: 'Full Code Coverage Report in Ubuntu x86_64'