Skip to content

Commit 24d8390

Browse files
authored
feat: custom version for Zookeeper (#1169)
* feat: custom version for Zookeeper * chore: changelog
1 parent fd6d61f commit 24d8390

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ All notable changes to this project will be documented in this file.
8585
- zookeeper: backport ZOOKEEPER-4846, ZOOKEEPER-4921, ZOOKEEPER-4925 into Zookeeper 3.9.3 ([#1150]).
8686
- testing-tools: Update base image ([#1165]).
8787
- trino: Enable custom versions ([#1168]).
88+
- zookeeper: Enable custom versions ([#1169]).
8889
- opa: Enable custom versions ([#1170]).
8990
- use custom product versions for Hadoop, HBase, Phoenix, hbase-operator-tools, Druid, Hive and Spark ([#1173]).
9091

@@ -194,6 +195,7 @@ All notable changes to this project will be documented in this file.
194195
[#1163]: https://github.com/stackabletech/docker-images/pull/1163
195196
[#1165]: https://github.com/stackabletech/docker-images/pull/1165
196197
[#1168]: https://github.com/stackabletech/docker-images/pull/1168
198+
[#1169]: https://github.com/stackabletech/docker-images/pull/1169
197199
[#1170]: https://github.com/stackabletech/docker-images/pull/1170
198200
[#1171]: https://github.com/stackabletech/docker-images/pull/1171
199201
[#1173]: https://github.com/stackabletech/docker-images/pull/1173

zookeeper/Dockerfile

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ FROM stackable/image/java-devel AS builder
99
ARG PRODUCT
1010
ARG JMX_EXPORTER
1111
ARG STACKABLE_USER_UID
12+
ARG RELEASE
1213

1314
# Copy patches into the builder
1415
COPY --chown=${STACKABLE_USER_UID}:0 zookeeper/stackable/patches/patchable.toml /stackable/src/zookeeper/stackable/patches/patchable.toml
@@ -23,20 +24,26 @@ WORKDIR /stackable
2324
RUN <<EOF
2425
cd "$(/stackable/patchable --images-repo-root=src checkout zookeeper ${PRODUCT})"
2526

27+
ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
28+
NEW_VERSION="${PRODUCT}-stackable${RELEASE}"
29+
30+
mvn versions:set -DnewVersion=$NEW_VERSION
31+
2632
# Create snapshot of the source code including custom patches
27-
tar -czf /stackable/zookeeper-${PRODUCT}-src.tar.gz .
33+
tar -czf /stackable/zookeeper-${NEW_VERSION}-src.tar.gz .
2834

2935
# Exclude the `zookeeper-client` submodule, this is not needed and has c parts
3036
# that created all kinds of issues for the build container
3137
mvn --batch-mode --no-transfer-progress -pl "!zookeeper-client/zookeeper-client-c" clean install checkstyle:check spotbugs:check -DskipTests -Pfull-build
3238

3339
# Unpack the archive which contains the build artifacts from above. Remove some
3440
# unused files to shrink the final image size.
35-
mv zookeeper-assembly/target/apache-zookeeper-${PRODUCT}-bin.tar.gz /stackable
36-
tar -C /stackable -xvzf /stackable/apache-zookeeper-${PRODUCT}-bin.tar.gz
37-
mv zookeeper-assembly/target/bom.json /stackable/apache-zookeeper-${PRODUCT}-bin/apache-zookeeper-${PRODUCT}.cdx.json
38-
rm -rf /stackable/apache-zookeeper-${PRODUCT}-bin/docs
39-
rm /stackable/apache-zookeeper-${PRODUCT}-bin/README_packaging.md
41+
mv zookeeper-assembly/target/apache-zookeeper-${NEW_VERSION}-bin.tar.gz /stackable
42+
tar -C /stackable -xvzf /stackable/apache-zookeeper-${NEW_VERSION}-bin.tar.gz
43+
sed -i "s/${NEW_VERSION}/${ORIGINAL_VERSION}/g" zookeeper-assembly/target/bom.json
44+
mv zookeeper-assembly/target/bom.json /stackable/apache-zookeeper-${NEW_VERSION}-bin/apache-zookeeper-${NEW_VERSION}.cdx.json
45+
rm -rf /stackable/apache-zookeeper-${NEW_VERSION}-bin/docs
46+
rm /stackable/apache-zookeeper-${NEW_VERSION}-bin/README_packaging.md
4047

4148
# Download the JMX exporter jar from our own repo
4249
curl "https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar" \
@@ -70,8 +77,8 @@ LABEL \
7077
description="This image is deployed by the Stackable Operator for Apache ZooKeeper."
7178

7279
# Copy over the ZooKeeper binary folder
73-
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/apache-zookeeper-${PRODUCT}-bin /stackable/apache-zookeeper-${PRODUCT}-bin/
74-
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/zookeeper-${PRODUCT}-src.tar.gz /stackable
80+
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin/
81+
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/zookeeper-${PRODUCT}-stackable${RELEASE}-src.tar.gz /stackable
7582
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/jmx /stackable/jmx/
7683
COPY zookeeper/licenses /licenses
7784

@@ -83,14 +90,14 @@ chown ${STACKABLE_USER_UID}:0 /stackable/package_manifest.txt
8390
chmod g=u /stackable/package_manifest.txt
8491
rm -rf /var/cache/yum
8592

86-
# Add link pointing from /stackable/zookeeper to /stackable/apache-zookeeper-${PRODUCT}-bin/
93+
# Add link pointing from /stackable/zookeeper to /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin/
8794
# to preserve the folder name with the version.
88-
ln -s /stackable/apache-zookeeper-${PRODUCT}-bin/ /stackable/zookeeper
95+
ln -s /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin/ /stackable/zookeeper
8996
chown -h ${STACKABLE_USER_UID}:0 /stackable/zookeeper
9097

9198
# fix missing permissions
9299
chmod g=u /stackable/jmx
93-
chmod g=u /stackable/apache-zookeeper-${PRODUCT}-bin/
100+
chmod g=u /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin/
94101
EOF
95102

96103
# ----------------------------------------

0 commit comments

Comments
 (0)