4242# 4. Open a focused PR.
4343#
4444# Environment overrides:
45- # UC_DIR directory to clone into (default: /tmp/unitycatalog)
46- # UC_REPO git remote URL (default: upstream unitycatalog)
47- # UC_REF must be `main` or UC_PIN_SHA (default: UC_PIN_SHA below)
48- # UC_FORCE set to "1" to rebuild even when the Ivy artifact exists
45+ # UC_DIR directory to clone into (default: /tmp/unitycatalog)
46+ # UC_REPO git remote URL (default: upstream unitycatalog)
47+ # UC_REF must be `main` or UC_PIN_SHA (default: UC_PIN_SHA below)
48+ # UC_FORCE set to "1" to rebuild even when the Ivy artifact exists
49+ # SPARK_VERSION Spark major.minor UC should build for (default: 4.1)
50+ # Forwarded as -DsparkVersion to UC's sbt; also determines the published artifact
51+ # name (unitycatalog-spark_${X.Y}_2.13). Delta's build.sbt sets this from
52+ # CrossSparkVersions when invoking the script; matrix CI workflows set it from
53+ # `matrix.spark_version`. Default matches UC's own default in
54+ # project/spark-versions.json - workflows that don't care which Spark variant UC
55+ # builds (kernel/flink/etc.) inherit it.
4956#
5057# UC_REF is restricted to exactly two values by design: the pinned SHA (the normal case) or
5158# `main` (for the floating-main canary flow). Any other value is rejected. CI should never set
@@ -57,14 +64,15 @@ set -euo pipefail
5764# The pin. Bump both lines together if UC's version.sbt changed at the new SHA. build.sbt's
5865# `unityCatalogVersion` is obtained by running this script with `--print-version`, so these two
5966# values are the single source of truth.
60- UC_PIN_SHA=cd6fec685e9c2ce23fd85552ffac94c7b7e9cbd6
67+ UC_PIN_SHA=af090e73979bc216a0fe8feff59a5bbce0f41f14
6168UC_BASE_VERSION=0.5.0-SNAPSHOT
6269# ---------------------------------------------------------------------------------------------
6370
6471UC_DIR=" ${UC_DIR:-/ tmp/ unitycatalog} "
6572UC_REPO=" ${UC_REPO:- https:// github.com/ unitycatalog/ unitycatalog.git} "
6673UC_REF=" ${UC_REF:- $UC_PIN_SHA } "
6774UC_FORCE=" ${UC_FORCE:- 0} "
75+ SPARK_VERSION=" ${SPARK_VERSION:- 4.1} "
6876
6977# Enforce the two-value contract. Anything else is either a typo or a misuse and would bypass the
7078# safety check below.
92100# Canonical Ivy + Maven artifact paths. Delta depends on all three UC modules; sbt resolves from
93101# ~/.ivy2/local, mvn (kernel-examples integration tests) resolves from ~/.m2/repository. If any
94102# is missing in either layout we must re-publish.
103+ # UC publishes its Spark connector under a per-Spark-version coordinate
104+ # (e.g. unitycatalog-spark_4.1_2.13). The suffix tracks SPARK_VERSION so the
105+ # canary check matches whatever variant we tell UC to build below.
106+ UC_SPARK_ARTIFACT=" unitycatalog-spark_${SPARK_VERSION} _2.13"
95107IVY_LOCAL=" $HOME /.ivy2/local/io.unitycatalog"
96108IVY_CANARY_CLIENT=" $IVY_LOCAL /unitycatalog-client/$UC_VERSION /ivys/ivy.xml"
97109IVY_CANARY_SERVER=" $IVY_LOCAL /unitycatalog-server/$UC_VERSION /ivys/ivy.xml"
98- IVY_CANARY_SPARK=" $IVY_LOCAL /unitycatalog-spark_2.13 /$UC_VERSION /ivys/ivy.xml"
110+ IVY_CANARY_SPARK=" $IVY_LOCAL /$UC_SPARK_ARTIFACT /$UC_VERSION /ivys/ivy.xml"
99111IVY_CANARY_HADOOP=" $IVY_LOCAL /unitycatalog-hadoop/$UC_VERSION /ivys/ivy.xml"
100112M2_LOCAL=" $HOME /.m2/repository/io/unitycatalog"
101113M2_CANARY_CLIENT=" $M2_LOCAL /unitycatalog-client/$UC_VERSION /unitycatalog-client-$UC_VERSION .pom"
102114M2_CANARY_SERVER=" $M2_LOCAL /unitycatalog-server/$UC_VERSION /unitycatalog-server-$UC_VERSION .pom"
103- M2_CANARY_SPARK=" $M2_LOCAL /unitycatalog-spark_2.13 /$UC_VERSION /unitycatalog-spark_2.13 -$UC_VERSION .pom"
115+ M2_CANARY_SPARK=" $M2_LOCAL /$UC_SPARK_ARTIFACT /$UC_VERSION /$UC_SPARK_ARTIFACT -$UC_VERSION .pom"
104116M2_CANARY_HADOOP=" $M2_LOCAL /unitycatalog-hadoop/$UC_VERSION /unitycatalog-hadoop-$UC_VERSION .pom"
105117ALL_CANARIES=(" $IVY_CANARY_CLIENT " " $IVY_CANARY_SERVER " " $IVY_CANARY_SPARK " " $IVY_CANARY_HADOOP "
106118 " $M2_CANARY_CLIENT " " $M2_CANARY_SERVER " " $M2_CANARY_SPARK " " $M2_CANARY_HADOOP " )
161173# coordinate. Applied as a persistent setting so it sticks across the two sbt invocations below.
162174SET_VERSION_CMD=" set ThisBuild / version := \" $UC_VERSION \" "
163175
176+ # Force publishLocal / publishM2 to overwrite existing artifacts. UC artifacts at the same
177+ # coordinate can be left behind from a prior run (e.g. cross-Spark publish re-invokes this
178+ # script for a different sparkVersion while client/server/hadoop are already in ~/.ivy2/local
179+ # and ~/.m2 from the first invocation). publishLocalConfiguration / publishM2Configuration are
180+ # task settings scoped per-project (ThisBuild / Global don't propagate), so we set them on each
181+ # project we publish. Both configs need overriding: publishLocal uses the former, publishM2
182+ # uses the latter.
183+ SET_OVERWRITE_CMDS=()
184+ for p in client server hadoop spark; do
185+ SET_OVERWRITE_CMDS+=(
186+ " set $p / publishLocalConfiguration := ($p / publishLocalConfiguration).value.withOverwrite(true)"
187+ " set $p / publishM2Configuration := ($p / publishM2Configuration).value.withOverwrite(true)"
188+ )
189+ done
190+
164191echo " >>> Building and publishing UC client + server to local Maven repo"
165192./build/sbt \
166193 " $SET_VERSION_CMD " \
194+ " ${SET_OVERWRITE_CMDS[@]} " \
167195 " set client / Compile / packageDoc / publishArtifact := false" \
168196 clean \
169197 client/generate \
@@ -175,10 +203,18 @@ echo ">>> Building and publishing UC client + server to local Maven repo"
175203 hadoop/publishM2
176204
177205# spark/publishM2 can hit a transient coursier lock race - retry up to 3 times.
178- echo " >>> Building and publishing UC spark module to local Maven repo"
206+ # -DsparkVersion picks the Spark variant UC builds against; the resulting artifact is
207+ # unitycatalog-spark_${SPARK_VERSION}_2.13, matching UC_SPARK_ARTIFACT above.
208+ # -DskipDeltaSpark=true drops UC's test-only delta-spark_X.Y dep, which would otherwise
209+ # fail resolution: we publish UC before Delta itself is built, and on snapshot Spark
210+ # versions (e.g. 4.2) no matching delta-spark release exists at all.
211+ echo " >>> Building and publishing UC spark module (Spark $SPARK_VERSION ) to local Maven repo"
179212for attempt in 1 2 3; do
180213 if ./build/sbt \
214+ -DsparkVersion=" $SPARK_VERSION " \
215+ -DskipDeltaSpark=true \
181216 " $SET_VERSION_CMD " \
217+ " ${SET_OVERWRITE_CMDS[@]} " \
182218 " set client / Compile / packageDoc / publishArtifact := false" \
183219 spark/publishLocal \
184220 spark/publishM2; then
0 commit comments