@@ -6,12 +6,10 @@ FROM stackable/image/hadoop AS hadoop-builder
66FROM stackable/image/java-devel AS hbase-builder
77
88ARG PRODUCT
9- ARG HBASE_THIRDPARTY
109ARG HBASE_OPERATOR_TOOLS
1110ARG ASYNC_PROFILER
1211ARG PHOENIX
1312ARG HBASE_PROFILE
14- ARG JMX_EXPORTER
1513ARG HADOOP
1614ARG TARGETARCH
1715ARG TARGETOS
@@ -28,7 +26,6 @@ WORKDIR /stackable
2826
2927COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/patches/patchable.toml /stackable/src/hbase/stackable/patches/patchable.toml
3028COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/patches/${PRODUCT} /stackable/src/hbase/stackable/patches/${PRODUCT}
31- COPY --chown=${STACKABLE_USER_UID}:0 hbase/stackable/jmx/config${JMX_EXPORTER} /stackable/jmx
3229
3330# Cache mounts are owned by root by default
3431# We need to explicitly give the uid to use
@@ -49,8 +46,25 @@ cd "$(/stackable/patchable --images-repo-root=src checkout hbase ${PRODUCT})"
4946
5047# The release scripts of HBase also run the build twice (three times in fact, once again to build the site which we skip here).
5148# I chose to replicate that exact behavior for consistency so please don't merge the two mvn runs into one unless you really know what you're doing!
52- mvn --batch-mode --no-transfer-progress -Dhadoop.profile=3.0 -Dhadoop-three.version=${HADOOP} clean install -DskipTests
53- mvn --batch-mode --no-transfer-progress -Dhadoop.profile=3.0 -Dhadoop-three.version=${HADOOP} install assembly:single -DskipTests -Dcheckstyle.skip=true -Prelease
49+ # Cannot skip building tests here because the assembly plugin needs a shell script from the test directory.
50+ mvn \
51+ --batch-mode \
52+ --no-transfer-progress \
53+ -Dhadoop.profile=3.0 \
54+ -Dhadoop-three.version=${HADOOP} \
55+ -DskipTests \
56+ clean install
57+
58+ mvn \
59+ --batch-mode \
60+ --no-transfer-progress \
61+ -Dhadoop.profile=3.0 \
62+ -Dhadoop-three.version=${HADOOP} \
63+ -DskipTests \
64+ -Dcheckstyle.skip=true \
65+ -Prelease \
66+ install assembly:single
67+
5468tar -xzf hbase-assembly/target/hbase-${PRODUCT}-bin.tar.gz -C /stackable/
5569mv hbase-assembly/target/bom.json /stackable/hbase-${PRODUCT}/hbase-${PRODUCT}.cdx.json
5670
@@ -59,15 +73,6 @@ mv hbase-assembly/target/bom.json /stackable/hbase-${PRODUCT}/hbase-${PRODUCT}.c
5973
6074ln -s "/stackable/hbase-${PRODUCT}" /stackable/hbase
6175
62- # ##
63- # ## JMX Prometheus Exporter/Agent
64- # ##
65- if [[ -n "${JMX_EXPORTER}" ]] ; then
66- curl --fail "https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar" -o "/stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar"
67- chmod +x "/stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar"
68- ln -s "/stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar" /stackable/jmx/jmx_prometheus_javaagent.jar
69- fi
70-
7176# ##
7277# ## Async Profiler
7378# ##
9398
9499FROM stackable/image/java-devel AS opa-authorizer-builder
95100
101+ ARG PRODUCT
96102ARG OPA_AUTHORIZER
97103ARG DELETE_CACHES
98104ARG STACKABLE_USER_UID
99105
100106USER ${STACKABLE_USER_UID}
101107WORKDIR /stackable
102108
103- RUN --mount=type=cache,id=maven-opa,uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
109+ # Use the product version as cache id "maven-opa-${PRODUCT}" to avoid the "rm -rf" problem described above.
110+ # Using the OPA_AUTHORIZER arg is not unique if the same version is used for multiple products.
111+ RUN --mount=type=cache,id=maven-opa-${PRODUCT},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
104112# ##
105113# ## OPA Authorizer (only for 2.6 upwards)
106114# ##
@@ -109,9 +117,10 @@ if [[ -n "$OPA_AUTHORIZER" ]]; then
109117 mvn \
110118 --batch-mode \
111119 --no-transfer-progress \
112- package \
113120 -DskipTests \
114- -fhbase-opa-authorizer
121+ -Dmaven.test.skip=true \
122+ -fhbase-opa-authorizer \
123+ package
115124else
116125 # Create a dummy jar to avoid errors when copying it the final image
117126 mkdir -p hbase-opa-authorizer/target
@@ -155,16 +164,13 @@ WORKDIR /stackable
155164RUN --mount=type=cache,id=maven-hbase-operator-tools-${HBASE_OPERATOR_TOOLS},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
156165cd "$(/stackable/patchable --images-repo-root=src checkout hbase-operator-tools ${HBASE_OPERATOR_TOOLS})"
157166
158- # Remove the Git repo because `git-commit-id-maven-plugin` tries to get the latest commit if a Git repo is present,
159- # which fails due to a problem with worktrees, see https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/215
160- rm .git
161-
162167mvn \
163168 --batch-mode \
164169 --no-transfer-progress \
165170 -Dhbase.version=${PRODUCT} \
166171 -Dhbase-thirdparty.version=${HBASE_THIRDPARTY} \
167172 -DskipTests \
173+ -Dmaven.test.skip=true \
168174 package assembly:single
169175
170176# We need the "*" here as the directory won't be the same as the final tar file for SNAPSHOTs which we currently have to use for 2.6
@@ -208,6 +214,11 @@ USER ${STACKABLE_USER_UID}
208214WORKDIR /stackable
209215
210216COPY --from=hadoop-builder --chown=${STACKABLE_USER_UID}:0 \
217+ # The artifact name of the AWS bundle has changed between Haddop 3.3.6 and 3.4.1
218+ # from aws-java-sdk-bundle-*.jar to bundle-*.jar.
219+ # See: https://hadoop.apache.org/docs/stable/hadoop-aws/tools/hadoop-aws/aws_sdk_upgrade.html
220+ # So we try to copy both and if one of them doesn't exist buildx will just ignore it :)
221+ /stackable/hadoop/share/hadoop/tools/lib/bundle-*.jar \
211222 /stackable/hadoop/share/hadoop/tools/lib/aws-java-sdk-bundle-*.jar \
212223 /stackable/hadoop/share/hadoop/tools/lib/hadoop-aws-${HADOOP}.jar \
213224 /stackable/hadoop/share/hadoop/tools/lib/
@@ -248,7 +259,7 @@ COPY --chown=${STACKABLE_USER_UID}:0 hbase/phoenix/stackable/patches/${PHOENIX}
248259USER ${STACKABLE_USER_UID}
249260WORKDIR /stackable
250261
251- RUN --mount=type=cache,id=maven-phoenix-${PHOENIX},uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
262+ RUN --mount=type=cache,id=maven-phoenix-${PHOENIX}-${PRODUCT} ,uid=${STACKABLE_USER_UID},target=/stackable/.m2/repository <<EOF
252263cd "$(/stackable/patchable --images-repo-root=src checkout phoenix ${PHOENIX})"
253264
254265# The Maven command can be found inside of the scripts in the create-release folder (release-util.sh as of Phoenix 5.2.0)
@@ -260,6 +271,7 @@ mvn \
260271 -Dhbase.profile=${HBASE_PROFILE} \
261272 -Dhadoop.version=${HADOOP} \
262273 -DskipTests \
274+ -Dmaven.test.skip=true \
263275 -Dcheckstyle.skip=true \
264276 clean \
265277 package
@@ -324,7 +336,6 @@ LABEL io.k8s.display-name="${NAME}"
324336
325337COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-builder /stackable/hbase-${PRODUCT} /stackable/hbase-${PRODUCT}/
326338COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-builder /stackable/async-profiler /stackable/async-profiler/
327- COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-builder /stackable/jmx /stackable/jmx/
328339
329340COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-operator-tools-builder /stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS} /stackable/hbase-operator-tools-${HBASE_OPERATOR_TOOLS}/
330341COPY --chown=${STACKABLE_USER_UID}:0 --from=hbase-operator-tools-builder /stackable/bin/hbck2 /stackable/bin/hbck2
@@ -378,7 +389,6 @@ chmod g=u "/stackable/hbase/lib/phoenix-server-hbase-${HBASE_PROFILE}.jar"
378389# fix missing permissions
379390chmod g=u /stackable/async-profiler
380391chmod g=u /stackable/bin
381- chmod g=u /stackable/jmx
382392chmod g=u /stackable/phoenix
383393# the whole directory tree /stackable/hadoop/share/hadoop/tools/lib/ must be adapted
384394find /stackable/hadoop -type d -exec chmod g=u {} +
0 commit comments