Skip to content

Commit ec5ce01

Browse files
authored
feat: custom version for Trino (#1168)
* feat: custom version for Trino * chore: changelog * fix: directory names / storage plugin location
1 parent 3431707 commit ec5ce01

15 files changed

+140
-86
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ All notable changes to this project will be documented in this file.
8282
- vector: Bump to `0.47.0` ([#1152]).
8383
- zookeeper: backport ZOOKEEPER-4846, ZOOKEEPER-4921, ZOOKEEPER-4925 into Zookeeper 3.9.3 ([#1150]).
8484
- testing-tools: Update base image ([#1165]).
85+
- trino: Enable custom versions ([#1168]).
8586
- opa: Enable custom versions ([#1170]).
8687

8788
### Fixed
@@ -187,6 +188,7 @@ All notable changes to this project will be documented in this file.
187188
[#1156]: https://github.com/stackabletech/docker-images/pull/1156
188189
[#1163]: https://github.com/stackabletech/docker-images/pull/1163
189190
[#1165]: https://github.com/stackabletech/docker-images/pull/1165
191+
[#1168]: https://github.com/stackabletech/docker-images/pull/1168
190192
[#1170]: https://github.com/stackabletech/docker-images/pull/1170
191193

192194
## [25.3.0] - 2025-03-21

conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
superset = importlib.import_module("superset.versions")
3434
trino_cli = importlib.import_module("trino-cli.versions")
3535
trino = importlib.import_module("trino.versions")
36+
trino_jars = importlib.import_module("trino.trino.versions")
3637
trino_storage_connector = importlib.import_module("trino.storage-connector.versions")
3738
kafka_testing_tools = importlib.import_module("kafka-testing-tools.versions")
3839
kcat = importlib.import_module("kafka.kcat.versions")
@@ -66,6 +67,7 @@
6667
{"name": "superset", "versions": superset.versions},
6768
{"name": "trino-cli", "versions": trino_cli.versions},
6869
{"name": "trino", "versions": trino.versions},
70+
{"name": "trino/trino", "versions": trino_jars.versions},
6971
{"name": "trino/storage-connector", "versions": trino_storage_connector.versions},
7072
{"name": "kafka-testing-tools", "versions": kafka_testing_tools.versions},
7173
{"name": "kafka/kcat", "versions": kcat.versions},

trino/Dockerfile

Lines changed: 21 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -3,89 +3,14 @@
33

44
FROM stackable/image/trino/storage-connector AS trino-storage-connector-image
55

6-
FROM stackable/image/java-devel AS trino-builder
7-
8-
ARG PRODUCT
9-
ARG STACKABLE_USER_UID
10-
ARG JMX_EXPORTER
11-
12-
WORKDIR /stackable
13-
14-
COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/patches/patchable.toml /stackable/src/trino/stackable/patches/patchable.toml
15-
COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/patches/${PRODUCT} /stackable/src/trino/stackable/patches/${PRODUCT}
16-
17-
COPY --from=trino-storage-connector-image /stackable/src/trino-storage-connector/patchable-work/worktree/${PRODUCT}/target/trino-storage-${PRODUCT} /stackable/trino-server-${PRODUCT}/plugin/trino-storage-${PRODUCT}
18-
COPY --from=trino-storage-connector-image /stackable/src/trino-storage-connector/patchable-work/worktree/${PRODUCT}/target/bom.json /stackable/trino-server-${PRODUCT}/plugin/trino-storage-${PRODUCT}/trino-storage-${PRODUCT}.cdx.json
19-
COPY --from=trino-storage-connector-image /stackable/trino-storage-connector-${PRODUCT}-src.tar.gz /stackable
20-
COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/jmx /stackable/jmx
21-
22-
# adding a hadolint ignore for SC2215, due to https://github.com/hadolint/hadolint/issues/980
23-
# hadolint ignore=SC2215
24-
RUN --mount=type=cache,id=maven-${PRODUCT},target=/root/.m2/repository <<EOF
25-
cd "$(/stackable/patchable --images-repo-root=src checkout trino ${PRODUCT})"
26-
27-
# Create snapshot of the source code including custom patches
28-
tar -czf /stackable/trino-${PRODUCT}-src.tar.gz .
29-
30-
# Trino is using something (git-commit-id-plugin in the past, maybe something else now) that is
31-
# reading the Git history and searches for a tag to pull the version from. It sounds weird to me
32-
# why someone would do that over just picking the version from the pom.xml, but they propably
33-
# have their reasons. See e.g. https://github.com/trinodb/trino/discussions/18963.
34-
# So we fake it till we make it and create a Git repo and the correct tag. The trino-operator
35-
# smoke test checks that "select version()" is working.
36-
# Also, we need to initialize a new Git repo because `git-commit-id-maven-plugin` has a problem with worktrees, see https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/215
37-
rm .git
38-
git init
39-
git config user.email "[email protected]"
40-
git config user.name "Fake commiter"
41-
git commit --allow-empty --message "Fake commit, so that we can create a tag"
42-
git tag ${PRODUCT}
43-
44-
SKIP_PROJECTS="!docs"
45-
if [ "$PRODUCT" = "470" ] || [ "$PRODUCT" = "451" ]; then
46-
SKIP_PROJECTS="$SKIP_PROJECTS,!core/trino-server-rpm"
47-
fi
48-
49-
# We need to use ./mvnw instead of mvn to get a recent maven version (which is required to build Trino)
50-
./mvnw \
51-
--batch-mode \
52-
--no-transfer-progress \
53-
package \
54-
`# -Dmaven.test.skip # Unable to skip test compilation without an unused dependency error for software.amazon.awssdk:identity-spi` \
55-
-DskipTests `# Skip test execution` \
56-
-Dcheckstyle.skip `# Skip checkstyle checks. We dont care if the code is properly formatted, it just wastes time` \
57-
-Dmaven.javadoc.skip=true `# Dont generate javadoc` \
58-
--projects="$SKIP_PROJECTS"
59-
60-
# Delete intermediate build products to free some space and keep runners happy
61-
rm -r plugin/*/target core/trino-server/target/trino-server-${PRODUCT}
62-
63-
# Extract from tarball to save space; the tarball deduplicates jars (replacing them with symlinks),
64-
# while the raw output folder does not
65-
tar -xzf core/trino-server/target/trino-server-${PRODUCT}.tar.gz -C /stackable
66-
mv core/trino-server/target/bom.json /stackable/trino-server-${PRODUCT}/trino-server-${PRODUCT}.cdx.json
67-
68-
# Delete intermediate build products to free some space and keep runners happy
69-
(cd .. && rm -r ${PRODUCT})
70-
rm -r /stackable/.m2
71-
72-
# JMX Exporter
73-
curl https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar -o /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
74-
chmod +x /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
75-
76-
# Softlinks
77-
ln -s /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar /stackable/jmx/jmx_prometheus_javaagent.jar
78-
ln -s /stackable/trino-server-${PRODUCT} /stackable/trino-server
79-
80-
# Set correct permissions
81-
chmod --recursive g=u /stackable
82-
EOF
6+
FROM stackable/image/trino/trino AS trino-builder
837

848
FROM stackable/image/java-base
859

8610
ARG PRODUCT
8711
ARG RELEASE
8812
ARG STACKABLE_USER_UID
13+
ARG JMX_EXPORTER
8914

9015
LABEL \
9116
name="Trino" \
@@ -110,9 +35,27 @@ microdnf clean all
11035
rm -rf /var/cache/yum
11136
EOF
11237

113-
COPY --from=trino-builder --chown=${STACKABLE_USER_UID}:0 /stackable /stackable
38+
COPY --from=trino-builder --chown=${STACKABLE_USER_UID}:0 /stackable/trino-server /stackable/trino-server-${PRODUCT}-stackable${RELEASE}
11439
COPY --chown=${STACKABLE_USER_UID}:0 trino/licenses /licenses
11540

41+
COPY --from=trino-storage-connector-image --chown=${STACKABLE_USER_UID}:0 /stackable/src/trino-storage-connector/patchable-work/worktree/${PRODUCT}/target/trino-storage-${PRODUCT}-stackable${RELEASE} /stackable/trino-server-${PRODUCT}-stackable${RELEASE}/plugin/trino-storage-${PRODUCT}-stackable${RELEASE}
42+
COPY --from=trino-storage-connector-image --chown=${STACKABLE_USER_UID}:0 /stackable/src/trino-storage-connector/patchable-work/worktree/${PRODUCT}/target/bom.json /stackable/trino-server-${PRODUCT}-stackable${RELEASE}/plugin/trino-storage-${PRODUCT}-stackable${RELEASE}/trino-storage-${PRODUCT}-stackable${RELEASE}.cdx.json
43+
COPY --from=trino-storage-connector-image --chown=${STACKABLE_USER_UID}:0 /stackable/trino-storage-connector-${PRODUCT}-stackable${RELEASE}-src.tar.gz /stackable
44+
45+
COPY --chown=${STACKABLE_USER_UID}:0 trino/stackable/jmx /stackable/jmx
46+
47+
RUN <<EOF
48+
# JMX Exporter
49+
curl https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar -o /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
50+
chmod +x /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
51+
ln -s /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar /stackable/jmx/jmx_prometheus_javaagent.jar
52+
ln -s /stackable/trino-server-${PRODUCT}-stackable${RELEASE} /stackable/trino-server
53+
54+
# Set correct permissions
55+
chown -R ${STACKABLE_USER_UID}:0 /stackable/jmx /stackable/trino-server
56+
chmod --recursive g=u /stackable
57+
EOF
58+
11659
# ----------------------------------------
11760
# Checks
11861
# This section is to run final checks to ensure the created final images

trino/storage-connector/Dockerfile

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,49 @@
11
# syntax=docker/dockerfile:1.16.0@sha256:e2dd261f92e4b763d789984f6eab84be66ab4f5f08052316d8eb8f173593acf7
22
# check=error=true
33

4+
FROM stackable/image/trino/trino AS trino-builder
5+
46
FROM stackable/image/java-devel AS storage-connector-builder
57

68
ARG PRODUCT
9+
ARG RELEASE
710
ARG STACKABLE_USER_UID
811

912
WORKDIR /stackable
1013

1114
COPY --chown=${STACKABLE_USER_UID}:0 trino/storage-connector/stackable/patches/patchable.toml /stackable/src/trino-storage-connector/stackable/patches/patchable.toml
1215
COPY --chown=${STACKABLE_USER_UID}:0 trino/storage-connector/stackable/patches/${PRODUCT} /stackable/src/trino-storage-connector/stackable/patches/${PRODUCT}
16+
COPY --chown=${STACKABLE_USER_UID}:0 --from=trino-builder /stackable/patched-libs /stackable/patched-libs
17+
USER ${STACKABLE_USER_UID}
1318

1419
# adding a hadolint ignore for SC2215, due to https://github.com/hadolint/hadolint/issues/980
1520
# hadolint ignore=SC2215
16-
RUN --mount=type=cache,id=maven-${PRODUCT},target=/root/.m2/repository <<EOF
21+
RUN --mount=type=cache,id=maven-${PRODUCT},target=/stackable/.m2/repository,uid=${STACKABLE_USER_UID} <<EOF
1722
cd "$(/stackable/patchable --images-repo-root=src checkout trino-storage-connector ${PRODUCT})"
1823

24+
# Make Maven aware of custom Stackable libraries
25+
cp -r /stackable/patched-libs/maven/* /stackable/.m2/repository
26+
27+
ORIGINAL_VERSION="${PRODUCT}"
28+
NEW_VERSION="${PRODUCT}-stackable${RELEASE}"
29+
1930
# Create snapshot of the source code including custom patches
20-
tar -czf /stackable/trino-storage-connector-${PRODUCT}-src.tar.gz .
31+
tar -czf /stackable/trino-storage-connector-${NEW_VERSION}-src.tar.gz .
2132

22-
# Upstream builds are marked as -SNAPSHOT, even for release builds
23-
mvn versions:set -DnewVersion=${PRODUCT}
33+
mvn versions:set -DnewVersion=${NEW_VERSION}
2434

2535
# We need to use ./mvnw instead of mvn to get a recent maven version (which is required to build Trino)
2636
./mvnw \
2737
--batch-mode \
2838
--no-transfer-progress \
2939
package \
30-
-Dmaven.test.skip `# Skip test compilation` \
3140
-DskipTests `# Skip test execution` \
41+
-Ddep.trino.version=${NEW_VERSION} `# Use custom Stackable Trino version in tests` \
3242
-Dcheckstyle.skip `# Skip checkstyle checks. We dont care if the code is properly formatted, it just wastes time` \
3343
-Dmaven.javadoc.skip=true `# Dont generate javadoc` \
3444
-Dmaven.gitcommitid.skip=true `# The gitcommitid plugin cannot work with git workspaces (ie: patchable)`
45+
sed -i "s/${NEW_VERSION}/${ORIGINAL_VERSION}/g" target/bom.json
46+
47+
# Set correct permissions
48+
chmod --recursive g=u target /stackable/trino-storage-connector-${NEW_VERSION}-src.tar.gz
3549
EOF

trino/storage-connector/versions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
versions = [
22
{
33
"product": "451",
4+
"trino/trino": "451",
45
"java-devel": "22",
56
},
67
{
78
"product": "470",
9+
"trino/trino": "470",
810
"java-devel": "23",
911
},
1012
{
1113
"product": "476",
14+
"trino/trino": "476",
1215
"java-devel": "24",
1316
},
1417
]

trino/trino/Dockerfile

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# syntax=docker/dockerfile:1.16.0@sha256:e2dd261f92e4b763d789984f6eab84be66ab4f5f08052316d8eb8f173593acf7
2+
# check=error=true
3+
FROM stackable/image/java-devel AS trino-builder
4+
5+
ARG PRODUCT
6+
ARG RELEASE
7+
ARG STACKABLE_USER_UID
8+
9+
WORKDIR /stackable
10+
11+
COPY --chown=${STACKABLE_USER_UID}:0 trino/trino/stackable/patches/patchable.toml /stackable/src/trino/trino/stackable/patches/patchable.toml
12+
COPY --chown=${STACKABLE_USER_UID}:0 trino/trino/stackable/patches/${PRODUCT} /stackable/src/trino/trino/stackable/patches/${PRODUCT}
13+
14+
# adding a hadolint ignore for SC2215, due to https://github.com/hadolint/hadolint/issues/980
15+
# hadolint ignore=SC2215
16+
RUN --mount=type=cache,id=maven-${PRODUCT},target=/root/.m2/repository <<EOF
17+
cd "$(/stackable/patchable --images-repo-root=src checkout trino/trino ${PRODUCT})"
18+
19+
NEW_VERSION="${PRODUCT}-stackable${RELEASE}"
20+
21+
mvn versions:set -DnewVersion=$NEW_VERSION
22+
23+
# Create snapshot of the source code including custom patches
24+
tar -czf /stackable/trino-${NEW_VERSION}-src.tar.gz .
25+
26+
# Trino is using something (git-commit-id-plugin in the past, maybe something else now) that is
27+
# reading the Git history and searches for a tag to pull the version from. It sounds weird to me
28+
# why someone would do that over just picking the version from the pom.xml, but they propably
29+
# have their reasons. See e.g. https://github.com/trinodb/trino/discussions/18963.
30+
# So we fake it till we make it and create a Git repo and the correct tag. The trino-operator
31+
# smoke test checks that "select version()" is working.
32+
# Also, we need to initialize a new Git repo because `git-commit-id-maven-plugin` has a problem with worktrees, see https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/215
33+
rm .git
34+
git init
35+
git config user.email "[email protected]"
36+
git config user.name "Fake commiter"
37+
git commit --allow-empty --message "Fake commit, so that we can create a tag"
38+
git tag ${NEW_VERSION}
39+
40+
SKIP_PROJECTS="!docs"
41+
if [ "$PRODUCT" = "470" ] || [ "$PRODUCT" = "451" ]; then
42+
SKIP_PROJECTS="$SKIP_PROJECTS,!core/trino-server-rpm"
43+
fi
44+
45+
# We need to use ./mvnw instead of mvn to get a recent maven version (which is required to build Trino)
46+
./mvnw \
47+
--batch-mode \
48+
--no-transfer-progress \
49+
install \
50+
`# -Dmaven.test.skip # Unable to skip test compilation without an unused dependency error for software.amazon.awssdk:identity-spi` \
51+
-DskipTests `# Skip test execution` \
52+
-Dcheckstyle.skip `# Skip checkstyle checks. We dont care if the code is properly formatted, it just wastes time` \
53+
-Dmaven.javadoc.skip=true `# Dont generate javadoc` \
54+
-Ddep.presto-jdbc-under-test=${NEW_VERSION} \
55+
--projects="$SKIP_PROJECTS"
56+
57+
mkdir -p /stackable/patched-libs/maven/io
58+
cp -r /root/.m2/repository/io/trino /stackable/patched-libs/maven/io
59+
60+
# Delete intermediate build products to free some space and keep runners happy
61+
rm -r plugin/*/target core/trino-server/target/trino-server-${NEW_VERSION}
62+
63+
# Extract from tarball to save space; the tarball deduplicates jars (replacing them with symlinks),
64+
# while the raw output folder does not
65+
tar -xzf core/trino-server/target/trino-server-${NEW_VERSION}.tar.gz -C /stackable
66+
mv core/trino-server/target/bom.json /stackable/trino-server-${NEW_VERSION}/trino-server-${NEW_VERSION}.cdx.json
67+
68+
# Delete intermediate build products to free some space and keep runners happy
69+
(cd .. && rm -r ${PRODUCT})
70+
rm -r /stackable/.m2
71+
72+
ln -s /stackable/trino-server-${NEW_VERSION} /stackable/trino-server
73+
74+
# Set correct permissions
75+
chmod --recursive g=u /stackable
76+
EOF

trino/trino/versions.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
versions = [
2+
{
3+
"product": "451",
4+
"java-devel": "22",
5+
},
6+
{
7+
"product": "470",
8+
"java-devel": "23",
9+
},
10+
{
11+
"product": "476",
12+
"java-devel": "24",
13+
},
14+
]

trino/versions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
{
33
"product": "451",
44
"java-base": "22",
5-
"java-devel": "22",
5+
"trino/trino": "451",
66
"jmx_exporter": "1.3.0",
77
"trino/storage-connector": "451",
88
},
99
{
1010
"product": "470",
1111
"java-base": "23",
12-
"java-devel": "23",
12+
"trino/trino": "470",
1313
"jmx_exporter": "1.3.0",
1414
"trino/storage-connector": "470",
1515
},
1616
{
1717
"product": "476",
1818
"java-base": "24",
19-
"java-devel": "24",
19+
"trino/trino": "476",
2020
"jmx_exporter": "1.3.0",
2121
"trino/storage-connector": "476",
2222
},

0 commit comments

Comments
 (0)