Skip to content

Commit 14e580e

Browse files
committed
Add date-based condition to Azure SQL jobs to run every 16 days
1 parent 83a837e commit 14e580e

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

eng/pipelines/pr-validation-pipeline.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,11 +1959,31 @@ jobs:
19591959
# Azure SQL Database Testing Jobs
19601960
# Gated on the AZURE_CONNECTION_STRING pipeline variable being set.
19611961
# No local SQL Server install needed — tests run directly against the cloud database.
1962+
# Runs every 16 days (on days divisible by 16) or when ENABLE_AZURE_SQL is set to true
19621963
# ===========================================================================================
19631964

1965+
- job: CheckAzureSQLSchedule
1966+
displayName: 'Check if Azure SQL tests should run'
1967+
pool:
1968+
vmImage: 'ubuntu-latest'
1969+
steps:
1970+
- bash: |
1971+
day=$(date +%d)
1972+
remainder=$((10#$day % 15))
1973+
if [ "$remainder" -eq 0 ] || [ "$(ENABLE_AZURE_SQL)" = "true" ]; then
1974+
echo "##vso[task.setvariable variable=shouldRunAzureSQL;isOutput=true]true"
1975+
echo "Azure SQL tests will run (day: $day, ENABLE_AZURE_SQL: $(ENABLE_AZURE_SQL))"
1976+
else
1977+
echo "##vso[task.setvariable variable=shouldRunAzureSQL;isOutput=true]false"
1978+
echo "Azure SQL tests will be skipped (day: $day, ENABLE_AZURE_SQL: $(ENABLE_AZURE_SQL))"
1979+
fi
1980+
displayName: 'Determine if Azure SQL tests should run'
1981+
name: checkSchedule
1982+
19641983
- job: PytestOnWindows_AzureSQL
19651984
displayName: 'Windows x64 AzureSQL'
1966-
condition: eq(variables['ENABLE_AZURE_SQL'], 'true')
1985+
dependsOn: CheckAzureSQLSchedule
1986+
condition: eq(dependencies.CheckAzureSQLSchedule.outputs['checkSchedule.shouldRunAzureSQL'], 'true')
19671987
pool:
19681988
vmImage: 'windows-latest'
19691989

@@ -1999,7 +2019,8 @@ jobs:
19992019

20002020
- job: PytestOnMacOS_AzureSQL
20012021
displayName: 'macOS x86_64 AzureSQL'
2002-
condition: eq(variables['ENABLE_AZURE_SQL'], 'true')
2022+
dependsOn: CheckAzureSQLSchedule
2023+
condition: eq(dependencies.CheckAzureSQLSchedule.outputs['checkSchedule.shouldRunAzureSQL'], 'true')
20032024
pool:
20042025
vmImage: 'macos-latest'
20052026

@@ -2040,7 +2061,8 @@ jobs:
20402061

20412062
- job: PytestOnLinux_AzureSQL
20422063
displayName: 'Linux x86_64 AzureSQL'
2043-
condition: eq(variables['ENABLE_AZURE_SQL'], 'true')
2064+
dependsOn: CheckAzureSQLSchedule
2065+
condition: eq(dependencies.CheckAzureSQLSchedule.outputs['checkSchedule.shouldRunAzureSQL'], 'true')
20442066
pool:
20452067
vmImage: 'ubuntu-latest'
20462068

0 commit comments

Comments
 (0)