Skip to content

Commit 0e2b1bb

Browse files
smamindlCopilot
andcommitted
ci: add release branch compatibility check to PR validation
Add a ReleaseBranchCompat job that runs on every PR to master. It rebases each release branch (starting with spark4.0) onto the PR HEAD and runs sbt compile test:compile to catch breakage before it lands in master. - Non-blocking (continueOnError: true) - Matrix-based for easy expansion to more release branches - Reports merge conflicts and compile failures as warnings Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a833941 commit 0e2b1bb

1 file changed

Lines changed: 112 additions & 0 deletions

File tree

pipeline.yaml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,3 +803,115 @@ jobs:
803803
- template: templates/kv.yml
804804
- ${{ if or(eq(variables['Build.Reason'], 'PullRequest'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/')) }}:
805805
- template: templates/codecov.yml
806+
807+
- job: ReleaseBranchCompat
808+
displayName: 'Release Branch Compatibility Check'
809+
cancelTimeoutInMinutes: 0
810+
timeoutInMinutes: 60
811+
continueOnError: true
812+
condition: and(eq(variables.isPR, true), eq(variables['System.PullRequest.TargetBranch'], 'refs/heads/master'))
813+
pool:
814+
vmImage: $(UBUNTU_VERSION)
815+
strategy:
816+
matrix:
817+
spark4.0:
818+
RELEASE_BRANCH: spark4.0
819+
JAVA_VERSION: 17
820+
SBT_JAVA_OPTS: "-J--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED"
821+
steps:
822+
- checkout: self
823+
fetchDepth: 0
824+
825+
- task: JavaToolInstaller@0
826+
displayName: 'Set up JDK $(JAVA_VERSION)'
827+
inputs:
828+
versionSpec: $(JAVA_VERSION)
829+
jdkArchitectureOption: x64
830+
jdkSourceOption: PreInstalled
831+
832+
- bash: |
833+
set -e
834+
echo "=== Current HEAD (PR merge commit) ==="
835+
git log --oneline -1
836+
837+
echo "=== Fetching release branch $(RELEASE_BRANCH) ==="
838+
git fetch origin $(RELEASE_BRANCH)
839+
RELEASE_TIP=$(git rev-parse FETCH_HEAD)
840+
echo "Release branch tip: $RELEASE_TIP"
841+
842+
# Find commits unique to the release branch (not in master)
843+
# These are the release-specific patches we need to replay
844+
MASTER_BASE=$(git merge-base FETCH_HEAD HEAD)
845+
UNIQUE_COMMITS=$(git rev-list --count $MASTER_BASE..$RELEASE_TIP)
846+
echo "Release branch has $UNIQUE_COMMITS unique commit(s) to replay"
847+
848+
echo "=== Attempting rebase of $(RELEASE_BRANCH) onto PR HEAD ==="
849+
git checkout FETCH_HEAD
850+
git rebase --onto HEAD $MASTER_BASE 2>&1 || {
851+
echo "##vso[task.logissue type=warning]Rebase of $(RELEASE_BRANCH) onto this PR has merge conflicts"
852+
echo ""
853+
echo "=== Conflicting files ==="
854+
git diff --name-only --diff-filter=U 2>/dev/null || true
855+
git rebase --abort 2>/dev/null || true
856+
exit 1
857+
}
858+
echo "Rebase succeeded — $(RELEASE_BRANCH) patches apply cleanly onto this PR"
859+
displayName: 'Rebase $(RELEASE_BRANCH) onto PR HEAD'
860+
861+
- task: AzureCLI@2
862+
displayName: 'Compile $(RELEASE_BRANCH) after rebase'
863+
timeoutInMinutes: 20
864+
inputs:
865+
azureSubscription: 'SynapseML Build'
866+
scriptLocation: inlineScript
867+
scriptType: bash
868+
inlineScript: |
869+
set -e
870+
export SBT_OPTS="-Xmx4G -Xss2M -Duser.timezone=GMT"
871+
echo "=== Compiling $(RELEASE_BRANCH) rebased onto PR HEAD ==="
872+
sbt $(SBT_JAVA_OPTS) compile test:compile
873+
echo "$(RELEASE_BRANCH) compiles successfully after rebase"
874+
875+
- task: AzureCLI@2
876+
displayName: 'Setup repo for tests'
877+
inputs:
878+
azureSubscription: 'SynapseML Build'
879+
scriptLocation: inlineScript
880+
scriptType: bash
881+
inlineScript: |
882+
(timeout 30s pip install requests) || (echo "retrying" && timeout 30s pip install requests)
883+
(timeout 5m sbt $(SBT_JAVA_OPTS) setup) || (echo "retrying" && timeout 5m sbt $(SBT_JAVA_OPTS) setup) || (echo "retrying" && timeout 5m sbt $(SBT_JAVA_OPTS) setup)
884+
885+
- template: templates/kv.yml
886+
887+
- task: AzureCLI@2
888+
displayName: 'Unit tests on $(RELEASE_BRANCH) after rebase'
889+
timeoutInMinutes: 30
890+
inputs:
891+
azureSubscription: 'SynapseML Build'
892+
scriptLocation: inlineScript
893+
scriptType: bash
894+
inlineScript: |
895+
set -e
896+
export SBT_OPTS="-Xmx4G -Xss2M -Duser.timezone=GMT"
897+
echo "=== Running unit tests on $(RELEASE_BRANCH) rebased onto PR HEAD ==="
898+
FAILURES=0
899+
for pkg in core automl causal featurize image isolationforest stages recommendation nn train vw opencv exploratory; do
900+
echo "=== Testing $pkg ==="
901+
if ! timeout 10m sbt $(SBT_JAVA_OPTS) "testOnly com.microsoft.azure.synapse.ml.$pkg.**"; then
902+
echo "##vso[task.logissue type=warning]$pkg tests failed on $(RELEASE_BRANCH)"
903+
FAILURES=$((FAILURES + 1))
904+
fi
905+
done
906+
if [ $FAILURES -gt 0 ]; then
907+
echo "##vso[task.logissue type=warning]$FAILURES package(s) failed on $(RELEASE_BRANCH)"
908+
exit 1
909+
fi
910+
echo "All unit tests passed on $(RELEASE_BRANCH)"
911+
912+
- task: PublishTestResults@2
913+
displayName: 'Publish $(RELEASE_BRANCH) Test Results'
914+
inputs:
915+
testResultsFiles: '**/test-reports/TEST-*.xml'
916+
failTaskOnFailedTests: false
917+
condition: succeededOrFailed()

0 commit comments

Comments
 (0)