Skip to content

feat: custom version for Zookeeper #1169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ All notable changes to this project will be documented in this file.
- zookeeper: backport ZOOKEEPER-4846, ZOOKEEPER-4921, ZOOKEEPER-4925 into Zookeeper 3.9.3 ([#1150]).
- testing-tools: Update base image ([#1165]).
- trino: Enable custom versions ([#1168]).
- zookeeper: Enable custom versions ([#1169]).
- opa: Enable custom versions ([#1170]).
- use custom product versions for Hadoop, HBase, Phoenix, hbase-operator-tools, Druid, Hive and Spark ([#1173]).

Expand Down Expand Up @@ -194,6 +195,7 @@ All notable changes to this project will be documented in this file.
[#1163]: https://github.com/stackabletech/docker-images/pull/1163
[#1165]: https://github.com/stackabletech/docker-images/pull/1165
[#1168]: https://github.com/stackabletech/docker-images/pull/1168
[#1169]: https://github.com/stackabletech/docker-images/pull/1169
[#1170]: https://github.com/stackabletech/docker-images/pull/1170
[#1171]: https://github.com/stackabletech/docker-images/pull/1171
[#1173]: https://github.com/stackabletech/docker-images/pull/1173
Expand Down
29 changes: 18 additions & 11 deletions zookeeper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ FROM stackable/image/java-devel AS builder
ARG PRODUCT
ARG JMX_EXPORTER
ARG STACKABLE_USER_UID
ARG RELEASE

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

ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
NEW_VERSION="${PRODUCT}-stackable${RELEASE}"

mvn versions:set -DnewVersion=$NEW_VERSION

# Create snapshot of the source code including custom patches
tar -czf /stackable/zookeeper-${PRODUCT}-src.tar.gz .
tar -czf /stackable/zookeeper-${NEW_VERSION}-src.tar.gz .

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

# Unpack the archive which contains the build artifacts from above. Remove some
# unused files to shrink the final image size.
mv zookeeper-assembly/target/apache-zookeeper-${PRODUCT}-bin.tar.gz /stackable
tar -C /stackable -xvzf /stackable/apache-zookeeper-${PRODUCT}-bin.tar.gz
mv zookeeper-assembly/target/bom.json /stackable/apache-zookeeper-${PRODUCT}-bin/apache-zookeeper-${PRODUCT}.cdx.json
rm -rf /stackable/apache-zookeeper-${PRODUCT}-bin/docs
rm /stackable/apache-zookeeper-${PRODUCT}-bin/README_packaging.md
mv zookeeper-assembly/target/apache-zookeeper-${NEW_VERSION}-bin.tar.gz /stackable
tar -C /stackable -xvzf /stackable/apache-zookeeper-${NEW_VERSION}-bin.tar.gz
sed -i "s/${NEW_VERSION}/${ORIGINAL_VERSION}/g" zookeeper-assembly/target/bom.json
mv zookeeper-assembly/target/bom.json /stackable/apache-zookeeper-${NEW_VERSION}-bin/apache-zookeeper-${NEW_VERSION}.cdx.json
rm -rf /stackable/apache-zookeeper-${NEW_VERSION}-bin/docs
rm /stackable/apache-zookeeper-${NEW_VERSION}-bin/README_packaging.md

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

# Copy over the ZooKeeper binary folder
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/apache-zookeeper-${PRODUCT}-bin /stackable/apache-zookeeper-${PRODUCT}-bin/
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/zookeeper-${PRODUCT}-src.tar.gz /stackable
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin/
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/zookeeper-${PRODUCT}-stackable${RELEASE}-src.tar.gz /stackable
COPY --chown=${STACKABLE_USER_UID}:0 --from=builder /stackable/jmx /stackable/jmx/
COPY zookeeper/licenses /licenses

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

# Add link pointing from /stackable/zookeeper to /stackable/apache-zookeeper-${PRODUCT}-bin/
# Add link pointing from /stackable/zookeeper to /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin/
# to preserve the folder name with the version.
ln -s /stackable/apache-zookeeper-${PRODUCT}-bin/ /stackable/zookeeper
ln -s /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin/ /stackable/zookeeper
chown -h ${STACKABLE_USER_UID}:0 /stackable/zookeeper

# fix missing permissions
chmod g=u /stackable/jmx
chmod g=u /stackable/apache-zookeeper-${PRODUCT}-bin/
chmod g=u /stackable/apache-zookeeper-${PRODUCT}-stackable${RELEASE}-bin/
EOF

# ----------------------------------------
Expand Down