Skip to content

Commit 996a747

Browse files
Fix and streamline release branch compatibility checks
## Summary Run release compatibility checks for both GitHub target-branch formats and replace redundant compile, setup, credential, and per-package SBT tasks with one cached, project-scoped validation process. ## Prompting Intent The engineer asked to fix the silently skipped ReleaseBranchCompat job and simplify it before enabling it so the check is both reliable and efficient. ## Linked Sources - Base CI hardening PR: #2581 - Evidence build with skipped phase: ADO build 229176406 - Parent stack layer: ci/databricks-impact-gating ## Rationale The target condition accepts both values observed across Azure Repos and GitHub PR providers. A single SBT process retains full test compilation and the intended core, VW, and OpenCV compatibility suites while removing repeated build loading, root-wide IntelliJ setup, unnecessary Key Vault access, and Azure CLI authentication. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6a23382 commit 996a747

2 files changed

Lines changed: 67 additions & 50 deletions

File tree

pipeline.yaml

Lines changed: 36 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -912,7 +912,15 @@ jobs:
912912
cancelTimeoutInMinutes: 0
913913
timeoutInMinutes: 60
914914
continueOnError: true
915-
condition: and(succeeded(), eq(variables.isPR, true), eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/master'))
915+
condition: >-
916+
and(
917+
succeeded(),
918+
eq(variables.isPR, true),
919+
or(
920+
eq(variables['System.PullRequest.TargetBranch'], 'master'),
921+
eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/master')
922+
)
923+
)
916924
pool:
917925
vmImage: $(UBUNTU_VERSION)
918926
strategy:
@@ -968,56 +976,34 @@ jobs:
968976
displayName: 'Rebase $(RELEASE_BRANCH) onto PR HEAD'
969977
970978
- template: templates/sbt_cache.yml
971-
- task: AzureCLI@2
972-
displayName: 'Compile $(RELEASE_BRANCH) after rebase'
973-
timeoutInMinutes: 20
974-
inputs:
975-
azureSubscription: 'SynapseML Build'
976-
scriptLocation: inlineScript
977-
scriptType: bash
978-
inlineScript: |
979-
set -e
980-
export SBT_OPTS="-Xmx4G -Xss2M -Duser.timezone=GMT"
981-
echo "=== Compiling $(RELEASE_BRANCH) rebased onto PR HEAD ==="
982-
sbt $(SBT_JAVA_OPTS) compile test:compile
983-
echo "$(RELEASE_BRANCH) compiles successfully after rebase"
984-
985-
- task: AzureCLI@2
986-
displayName: 'Setup repo for tests'
987-
inputs:
988-
azureSubscription: 'SynapseML Build'
989-
scriptLocation: inlineScript
990-
scriptType: bash
991-
inlineScript: |
992-
(timeout 30s pip install requests) || (echo "retrying" && timeout 30s pip install requests)
993-
bash tools/ci/sbt_retry.sh $(SBT_JAVA_OPTS) setup
994-
995-
- template: templates/kv.yml
979+
- bash: |
980+
set -e
981+
export SBT_OPTS="-Xmx4G -Xss2M -Duser.timezone=GMT"
982+
CORE_TESTS="com.microsoft.azure.synapse.ml.core.** \
983+
com.microsoft.azure.synapse.ml.automl.** \
984+
com.microsoft.azure.synapse.ml.causal.** \
985+
com.microsoft.azure.synapse.ml.featurize.** \
986+
com.microsoft.azure.synapse.ml.image.** \
987+
com.microsoft.azure.synapse.ml.isolationforest.** \
988+
com.microsoft.azure.synapse.ml.stages.** \
989+
com.microsoft.azure.synapse.ml.recommendation.** \
990+
com.microsoft.azure.synapse.ml.nn.** \
991+
com.microsoft.azure.synapse.ml.train.** \
992+
com.microsoft.azure.synapse.ml.exploratory.**"
996993
997-
- task: AzureCLI@2
998-
displayName: 'Unit tests on $(RELEASE_BRANCH) after rebase'
999-
timeoutInMinutes: 60
1000-
inputs:
1001-
azureSubscription: 'SynapseML Build'
1002-
scriptLocation: inlineScript
1003-
scriptType: bash
1004-
inlineScript: |
1005-
set -e
1006-
export SBT_OPTS="-Xmx4G -Xss2M -Duser.timezone=GMT"
1007-
echo "=== Running unit tests on $(RELEASE_BRANCH) rebased onto PR HEAD ==="
1008-
FAILURES=0
1009-
for pkg in core automl causal featurize image isolationforest stages recommendation nn train vw opencv exploratory; do
1010-
echo "=== Testing $pkg ==="
1011-
if ! timeout 10m sbt $(SBT_JAVA_OPTS) "testOnly com.microsoft.azure.synapse.ml.$pkg.**"; then
1012-
echo "##vso[task.logissue type=warning]$pkg tests failed on $(RELEASE_BRANCH)"
1013-
FAILURES=$((FAILURES + 1))
1014-
fi
1015-
done
1016-
if [ $FAILURES -gt 0 ]; then
1017-
echo "##vso[task.logissue type=warning]$FAILURES package(s) failed on $(RELEASE_BRANCH)"
1018-
exit 1
1019-
fi
1020-
echo "All unit tests passed on $(RELEASE_BRANCH)"
994+
echo "=== Compiling and testing $(RELEASE_BRANCH) rebased onto PR HEAD ==="
995+
timeout 50m sbt $(SBT_JAVA_OPTS) \
996+
test:compile \
997+
getDatasets \
998+
"project core" \
999+
"testOnly $CORE_TESTS" \
1000+
"project vw" \
1001+
"testOnly com.microsoft.azure.synapse.ml.vw.**" \
1002+
"project opencv" \
1003+
"testOnly com.microsoft.azure.synapse.ml.opencv.**"
1004+
echo "$(RELEASE_BRANCH) compiles and passes compatibility tests"
1005+
displayName: 'Validate $(RELEASE_BRANCH) after rebase'
1006+
timeoutInMinutes: 55
10211007
10221008
- task: PublishTestResults@2
10231009
displayName: 'Publish $(RELEASE_BRANCH) Test Results'

tools/ci/tests/test_pipeline_yaml.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,37 @@ def test_databricks_e2e_uses_fail_open_pr_impact_detection():
157157
assert any(step.get("displayName") == "Publish Test Results" for step in steps)
158158

159159

160+
def test_release_compat_accepts_github_target_and_uses_one_sbt_process():
161+
data = yaml.safe_load(_pipeline_text())
162+
jobs = {j.get("job"): j for j in _jobs(data["jobs"])}
163+
release_compat = jobs["ReleaseBranchCompat"]
164+
165+
condition = release_compat["condition"]
166+
assert "System.PullRequest.TargetBranch" in condition
167+
assert "'master'" in condition
168+
assert "'refs/heads/master'" in condition
169+
170+
steps = release_compat["steps"]
171+
assert not any(step.get("task") == "AzureCLI@2" for step in steps)
172+
assert not any(step.get("template") == "templates/kv.yml" for step in steps)
173+
174+
validation_steps = [
175+
step
176+
for step in steps
177+
if isinstance(step, dict)
178+
and step.get("displayName") == "Validate $(RELEASE_BRANCH) after rebase"
179+
]
180+
assert len(validation_steps) == 1
181+
script = validation_steps[0]["bash"]
182+
assert script.count("sbt $(SBT_JAVA_OPTS)") == 1
183+
assert "test:compile" in script
184+
assert "getDatasets" in script
185+
for project in ("core", "vw", "opencv"):
186+
assert f'"project {project}"' in script
187+
assert "sbt_retry.sh" not in script
188+
assert "for pkg in" not in script
189+
190+
160191
def test_every_sbt_running_job_waits_for_the_prewarm_cache():
161192
"""Each sbt job must restore the cache after the required prewarm job."""
162193
data = yaml.safe_load(_pipeline_text())

0 commit comments

Comments
 (0)