Skip to content

Commit 5d7d6f3

Browse files
nightkrmaltesander
andauthored
Rebuild Trino from source (#687)
* Build Trino from source * Build JMX exporter and trino-storage from source * Build Trino 428 and OPA authorizer from source * Build Trino 414 from source * Fix Trino 442 build * Drop deprecated Trino 428 support * Drop trino-storage git repo override It was only used by Trino 428 * Clean up unused dockerfile args * Update trino/Dockerfile Co-authored-by: Malte Sander <[email protected]> * Update trino/Dockerfile Co-authored-by: Malte Sander <[email protected]> * Update trino/Dockerfile Co-authored-by: Malte Sander <[email protected]> * Update trino/Dockerfile Co-authored-by: Malte Sander <[email protected]> * Update trino/Dockerfile Co-authored-by: Malte Sander <[email protected]> * Change Trino download script to download sources instead * Add folder prefix to all source archive files * Mirror Trino on Nexus * Merge symlink layers * POSIX compliance * Changelog * Note that Trino 428 is dropped * Move log4shell env variable back into main Trino image * Fix bundled plugins not loading correctly --------- Co-authored-by: Malte Sander <[email protected]>
1 parent 65c1675 commit 5d7d6f3

6 files changed

+180
-101
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ All notable changes to this project will be documented in this file.
4343
- kafka: use java-devel as base layer for the builder stage ([#665])
4444
- opa-bundle-builder: Bump image to 1.1.2 ([#666])
4545
- opa: Build from source ([#676])
46+
- trino: Build from source ([#687]).
4647
- spark: Build from source ([#679])
4748

4849
### Fixed
@@ -60,6 +61,7 @@ All notable changes to this project will be documented in this file.
6061

6162
- zookeeper: Remove unsupported version 3.9.1 ([#628]).
6263
- java-base: Remove openjdk-devel rpm package again to reduce the vulnerability surface ([#665])
64+
- trino: Remove unsupported version 428 ([#687]).
6365

6466
[#583]: https://github.com/stackabletech/docker-images/pull/583
6567
[#611]: https://github.com/stackabletech/docker-images/pull/611
@@ -88,6 +90,7 @@ All notable changes to this project will be documented in this file.
8890
[#682]: https://github.com/stackabletech/docker-images/pull/682
8991
[#684]: https://github.com/stackabletech/docker-images/pull/684
9092
[#685]: https://github.com/stackabletech/docker-images/pull/685
93+
[#687]: https://github.com/stackabletech/docker-images/pull/687
9194
[#688]: https://github.com/stackabletech/docker-images/pull/688
9295
[#696]: https://github.com/stackabletech/docker-images/pull/696
9396
[#695]: https://github.com/stackabletech/docker-images/pull/695

conf.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@
194194
"product": "11",
195195
"stackable-base": "1.0.0",
196196
},
197+
{
198+
"product": "17",
199+
"stackable-base": "1.0.0",
200+
},
201+
{
202+
"product": "21",
203+
"stackable-base": "1.0.0",
204+
},
197205
],
198206
},
199207
{
@@ -420,20 +428,15 @@
420428
{
421429
"product": "414",
422430
"java-base": "17",
431+
"java-devel": "17",
423432
"opa_authorizer": "stackable0.2.0",
424433
"jmx_exporter": "0.20.0",
425-
"storage_connector": "414",
426-
},
427-
{
428-
"product": "428",
429-
"java-base": "17",
430-
"opa_authorizer": "stackable0.3.0",
431-
"jmx_exporter": "0.20.0",
432-
"storage_connector": "428-jackson",
434+
"storage_connector": "413",
433435
},
434436
{
435437
"product": "442",
436438
"java-base": "21",
439+
"java-devel": "21",
437440
"jmx_exporter": "0.20.0",
438441
"storage_connector": "442",
439442
"opa_authorizer": "",

trino/Dockerfile

Lines changed: 92 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,102 @@
44
# Ignoring DL4006 globally because we inherit the SHELL from our base image
55
# hadolint global ignore=DL3038,DL4006
66

7-
FROM stackable/image/java-base
7+
# Not tagging base image because it is built as part of the same process
8+
# hadolint ignore=DL3006
9+
FROM stackable/image/java-devel AS storage-connector-builder
10+
11+
ARG STORAGE_CONNECTOR
12+
13+
WORKDIR /stackable
14+
15+
RUN curl --fail -L "https://repo.stackable.tech/repository/packages/trino-storage/trino-storage-${STORAGE_CONNECTOR}-src.tar.gz" | tar -xzC .
16+
RUN --mount=type=cache,target=/root/.m2/repository cd trino-storage-${STORAGE_CONNECTOR}-src && \
17+
# Upstream builds are marked as -SNAPSHOT, even for release builds
18+
mvn versions:set -DnewVersion=${STORAGE_CONNECTOR} && \
19+
mvn package -DskipTests -Dmaven.gitcommitid.skip=true
20+
21+
# # TODO: remove the OPA authorizer builder once Trino versions 414 and 428 are removed
22+
# Not tagging base image because it is built as part of the same process
23+
# hadolint ignore=DL3006
24+
FROM stackable/image/java-devel AS opa-authorizer-builder
25+
26+
ARG PRODUCT
27+
ARG OPA_AUTHORIZER
28+
29+
WORKDIR /stackable
30+
31+
RUN if [ -n "${OPA_AUTHORIZER}" ]; then \
32+
curl --fail -L "https://repo.stackable.tech/repository/packages/trino-opa-authorizer/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}-src.tar.gz" | tar -xzC .; \
33+
fi
34+
RUN --mount=type=cache,target=/root/.m2/repository if [ -n "${OPA_AUTHORIZER}" ]; then \
35+
cd trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}-src && \
36+
mvn package -DskipTests; \
37+
fi
38+
39+
# Create an empty dummy plugin folder for newer versions that don't need the plugin anymore
40+
RUN mkdir -p trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}-src/target/out
41+
42+
# Not tagging base image because it is built as part of the same process
43+
# hadolint ignore=DL3006
44+
FROM stackable/image/java-devel AS builder
845

946
ARG PRODUCT
1047
# External OPA authorizer only required for 414 and 428, included in 438
1148
# The `OPA_AUTHORIZER` is not set in the conf.py for version 438 to remove the ARG as soon as 414 and 428 are removed
1249
ARG OPA_AUTHORIZER
50+
ARG STORAGE_CONNECTOR
51+
52+
WORKDIR /stackable
53+
54+
RUN curl --fail -L "https://repo.stackable.tech/repository/packages/trino-server/trino-server-${PRODUCT}-src.tar.gz" | tar -xzC .
55+
RUN --mount=type=cache,target=/root/.m2/repository cd "trino-server-${PRODUCT}-src" && \
56+
mvn package -DskipTests -Dmaven.gitcommitid.skip=true --projects="!docs"
57+
RUN tar -xzf /stackable/trino-server-${PRODUCT}-src/core/trino-server/target/trino-server-${PRODUCT}.tar.gz -C /stackable && \
58+
chown --recursive stackable /stackable/trino-server-${PRODUCT}
59+
60+
COPY --from=storage-connector-builder /stackable/trino-storage-${STORAGE_CONNECTOR}-src/target/trino-storage-${STORAGE_CONNECTOR} /stackable/trino-server-${PRODUCT}/plugin/trino-storage-${STORAGE_CONNECTOR}
61+
# # TODO: remove the following COPY statement once Trino versions 414 and 428 are removed
62+
COPY --from=opa-authorizer-builder /stackable/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}-src/target/out /stackable/trino-server-${PRODUCT}/plugin/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}
63+
# We have no way to copy a folder conditionally, so delete the opa authorizer folder if no version is selected
64+
# Otherwise Trino will crash since empty plugin folders are not allowed
65+
RUN [ -n "${OPA_AUTHORIZER}" ] || rmdir /stackable/trino-server-${PRODUCT}/plugin/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}
66+
67+
# For earlier versions this script removes the .class file that contains the
68+
# vulnerable code.
69+
# TODO: This can be restricted to target only versions which do not honor the environment
70+
# varible that has been set above but this has not currently been implemented
71+
COPY shared/log4shell.sh /bin
72+
RUN /bin/log4shell.sh /stackable/trino-server-${PRODUCT}
73+
74+
# Ensure no vulnerable files are left over
75+
# This will currently report vulnerable files being present, as it also alerts on
76+
# SocketNode.class, which we do not remove with our scripts.
77+
# Further investigation will be needed whether this should also be removed.
78+
COPY shared/log4shell_1.6.1-log4shell_Linux_x86_64 /bin/log4shell_scanner_x86_64
79+
COPY shared/log4shell_1.6.1-log4shell_Linux_aarch64 /bin/log4shell_scanner_aarch64
80+
COPY shared/log4shell_scanner /bin/log4shell_scanner
81+
RUN /bin/log4shell_scanner s /stackable/trino-server-${PRODUCT}
82+
# ===
83+
84+
# Not tagging base image because it is built as part of the same process
85+
# hadolint ignore=DL3006
86+
FROM stackable/image/java-devel AS jmx-exporter-builder
87+
88+
ARG JMX_EXPORTER
89+
90+
WORKDIR /stackable
91+
92+
RUN curl --fail -L "https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus-${JMX_EXPORTER}-src.tar.gz" | tar -xzC .
93+
RUN --mount=type=cache,target=/root/.m2/repository cd jmx_prometheus-${JMX_EXPORTER}-src && \
94+
mvn package
95+
96+
# Not tagging base image because it is built as part of the same process
97+
# hadolint ignore=DL3006
98+
FROM stackable/image/java-base
99+
100+
ARG PRODUCT
13101
ARG JMX_EXPORTER
14102
ARG RELEASE
15-
ARG STORAGE_CONNECTOR
16103

17104
LABEL name="Trino" \
18105
maintainer="[email protected]" \
@@ -38,45 +125,16 @@ WORKDIR /stackable
38125
COPY --chown=stackable:stackable trino/stackable /stackable
39126
COPY --chown=stackable:stackable trino/licenses /licenses
40127

41-
RUN curl --fail -L https://repo.stackable.tech/repository/packages/trino-server/trino-server-${PRODUCT}.tar.gz | tar -xzC . && \
42-
ln -s /stackable/trino-server-${PRODUCT} /stackable/trino-server
43-
44-
RUN curl --fail https://repo.stackable.tech/repository/packages/jmx-exporter/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar \
45-
-o /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar && \
46-
chmod +x /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar && \
128+
COPY --from=builder /stackable/trino-server-${PRODUCT} /stackable/trino-server-${PRODUCT}
129+
COPY --from=jmx-exporter-builder /stackable/jmx_prometheus-${JMX_EXPORTER}-src/jmx_prometheus_javaagent/target/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar
130+
RUN ln -s /stackable/trino-server-${PRODUCT} /stackable/trino-server && \
47131
ln -s /stackable/jmx/jmx_prometheus_javaagent-${JMX_EXPORTER}.jar /stackable/jmx/jmx_prometheus_javaagent.jar
48132

49-
# TODO: remove the following RUN statement once Trino versions 414 and 428 are removed
50-
RUN if [[ -n ${OPA_AUTHORIZER} ]] ; then \
51-
curl --fail -L https://repo.stackable.tech/repository/packages/trino-opa-authorizer/trino-opa-authorizer-${PRODUCT}-${OPA_AUTHORIZER}.tar.gz | tar -xzC /stackable/trino-server/plugin ; \
52-
fi
53-
54-
RUN curl --fail https://repo.stackable.tech/repository/packages/trino-storage/trino-storage-${STORAGE_CONNECTOR}.zip -o /tmp/trino-storage-${STORAGE_CONNECTOR}.zip && \
55-
unzip /tmp/trino-storage-${STORAGE_CONNECTOR}.zip -d /stackable/trino-server/plugin && \
56-
rm -f /tmp/trino-storage-${STORAGE_CONNECTOR}.zip
57-
58133
# ===
59134
# Mitigation for CVE-2021-44228 (Log4Shell)
60135
# This variable is supported as of Log4j version 2.10 and
61136
# disables the vulnerable feature
62137
ENV LOG4J_FORMAT_MSG_NO_LOOKUPS=true
63138

64-
# For earlier versions this script removes the .class file that contains the
65-
# vulnerable code.
66-
# TODO: This can be restricted to target only versions which do not honor the environment
67-
# varible that has been set above but this has not currently been implemented
68-
COPY shared/log4shell.sh /bin
69-
RUN /bin/log4shell.sh /stackable/trino-server-${PRODUCT}
70-
71-
# Ensure no vulnerable files are left over
72-
# This will currently report vulnerable files being present, as it also alerts on
73-
# SocketNode.class, which we do not remove with our scripts.
74-
# Further investigation will be needed whether this should also be removed.
75-
COPY shared/log4shell_1.6.1-log4shell_Linux_x86_64 /bin/log4shell_scanner_x86_64
76-
COPY shared/log4shell_1.6.1-log4shell_Linux_aarch64 /bin/log4shell_scanner_aarch64
77-
COPY shared/log4shell_scanner /bin/log4shell_scanner
78-
RUN /bin/log4shell_scanner s /stackable/trino-server-${PRODUCT}
79-
# ===
80-
81139
WORKDIR /stackable/trino-server
82140
CMD ["bin/launcher", "run", "--etc-dir=/stackable/conf"]
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
VERSION=${1:?"Missing version number argument (arg 1)"}
5+
NEXUS_USER=${2:?"Missing Nexus username argument (arg 2)"}
6+
7+
read -r -s -p "Nexus Password: " NEXUS_PASSWORD
8+
echo ""
9+
10+
# https://stackoverflow.com/questions/4632028/how-to-create-a-temporary-directory
11+
# Find the directory name of the script
12+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
13+
14+
# the temp directory used, within $DIR
15+
WORK_DIR=$(mktemp -d -p "$DIR")
16+
17+
# check if tmp dir was created
18+
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
19+
echo "Could not create temp dir"
20+
exit 1
21+
fi
22+
23+
# deletes the temp directory
24+
function cleanup {
25+
rm -rf "$WORK_DIR"
26+
}
27+
28+
# register the cleanup function to be called on the EXIT signal
29+
trap cleanup EXIT
30+
31+
cd "$WORK_DIR" || exit
32+
33+
src_file=trino-storage-$VERSION-src.tar.gz
34+
35+
echo "Downloading Trino Storage"
36+
# Trino Storage provides no offficial source tarballs, download from Git
37+
git clone https://github.com/snowlift/trino-storage "trino-storage-${VERSION}" "--branch=v${VERSION}" --depth=1
38+
39+
echo "Archiving Trino Storage"
40+
git -C "trino-storage-${VERSION}" archive "v${VERSION}" --format=tar.gz --prefix="trino-storage-${VERSION}-src/" > "${src_file}"
41+
sha256sum "${src_file}" | cut --delimiter=' ' --field=1 > "${src_file}.sha256"
42+
43+
echo "Uploading everything to Nexus"
44+
EXIT_STATUS=0
45+
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${src_file}" 'https://repo.stackable.tech/repository/packages/trino-storage/' || EXIT_STATUS=$?
46+
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${src_file}.sha256" 'https://repo.stackable.tech/repository/packages/trino-storage/' || EXIT_STATUS=$?
47+
48+
if [ $EXIT_STATUS -ne 0 ]; then
49+
echo "ERROR: Upload failed"
50+
exit 1
51+
fi
52+
53+
echo "Successfully uploaded version ${VERSION} of Trino Storage to Nexus"
54+
echo "https://repo.stackable.tech/service/rest/repository/browse/packages/trino-storage/"

trino/upload_new_trino_version.sh

Lines changed: 9 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -30,67 +30,20 @@ trap cleanup EXIT
3030

3131
cd "$WORK_DIR" || exit
3232

33-
bin_file=trino-server-$VERSION.tar.gz
33+
src_file=trino-server-$VERSION-src.tar.gz
3434

35-
echo "Downloading Trino (this can take a while, it is intentionally downloading from a slow mirror that contains all old versions)"
36-
curl --fail -LOs "https://repo1.maven.org/maven2/io/trino/trino-server/${VERSION}/${bin_file}"
37-
curl --fail -LOs "https://repo1.maven.org/maven2/io/trino/trino-server/${VERSION}/${bin_file}.asc"
38-
curl --fail -LOs "https://repo1.maven.org/maven2/io/trino/trino-server/${VERSION}/${bin_file}.sha1"
35+
echo "Downloading Trino"
36+
# Trino provides no offficial source tarballs, download from Git
37+
git clone https://github.com/trinodb/trino "trino-${VERSION}" "--branch=${VERSION}" --depth=1
3938

40-
# It is probably redundant to check both the checksum and the signature but it's cheap and why not
41-
echo "Validating SHA1 Checksum"
42-
if ! (sha1sum "${bin_file}" | cut -d " " -f 1 | diff -Z - "${bin_file}.sha1"); then
43-
echo "ERROR: The SHA1 sum does not match"
44-
exit 1
45-
fi
46-
47-
echo "Adding pinned public key for signature"
48-
# We lock the public key here until trino has a better workflow for signing
49-
gpg --no-default-keyring --keyring "${WORK_DIR}"/keyring --import <<-EOF
50-
-----BEGIN PGP PUBLIC KEY BLOCK-----
51-
Comment: Hostname:
52-
Version: Hockeypuck 2.1.0-223-gdc2762b
53-
54-
xsBNBErpKk4BCADmT8y00Y1BcsB6KqEww68wyfH7129Izs2wHikHOEcPQWz2ROrb
55-
ug16Y+uvJkAzjD1EgJ9t/CSU4JbAT11I7u7oHMYlgtyEg06nAruQlwchs1vMrcPj
56-
mJ2aK3dOMHmYtiZ2Qq2ZUxnGvv1T+ywOsukV/4idZ1X9Z4qlQTg8jtp7gceRJ3Ct
57-
yiRoZ4lV+H+dV07dk9gEqiMJyCaf96IT+CIB5Xv6Z1jpKLxOAONzdENa5K9cfI+m
58-
HflrDmqg6apZ3obwzmEC+88K78A9w/+PK/VgK7OCaCkp816Vr2ej2e0qxpXz1xN4
59-
gyo/JUEqutf8gMKvmPuU2BnbdoNapf9f8LttABEBAAHNJU1hcnRpbiBUcmF2ZXJz
60-
byA8bXRyYXZlcnNvQGdtYWlsLmNvbT7CwHgEEwECACIFAkrpKk4CGwMGCwkIBwMC
61-
BhUIAgkKCwQWAgMBAh4BAheAAAoJEA62n3b9FxU4cVwH/jR9rwRB2uA7+bSuJBCM
62-
Ak2JWPwo2Ek8RjHb4VMlbKsPDW15nX8JriINesQ5ELecOMVgHKV24Mv31c/2Yh6Y
63-
SuEuYvauGdtPbREo7evZU/R3r54uCcNaK8ZpLeZQXRMNKKwBUKRnF1G+lRuVvORj
64-
abkbrUSfIS/cFKFzcCVzKLCbTpbfJ5JJmjulg5p8KpRS2/R63mAn7JRRDuSa1SJQ
65-
FgerzSoe4/t0GBCusBs8TsnEQ2X4OdQP95nBL3TANwMUupdX9dBa1h8c8gps1Uak
66-
xRYsbAANoCPfVUUpLT6WpsYk5X28+sXngVK2BJfoaq5zi2ATfQdBHIedRihCQrTk
67-
VjXOwE0ESukqTgEIAMNTWjnhzQeyUjGvvcuczhiKWj8lPlLCpN8AF168PNQDFoDC
68-
Uxdi7S5OKiwwDxm1cUy/gbij6qLazIAgSBRrW5C4dNK+SIAcgtNfLbT5Z/4mlOfg
69-
ErYH+lAxCNO3k+AzfVU/n0ZShhEuNhVgHc8pDiI/MXCZZKsAJxPFVu7pxiEM7LdT
70-
sSunzM/jZDrfIU7KBjZdlz0FK8L624+tAJD7WomQ8Ddx3MpOju+ShpP3YqddU0Hx
71-
jjP1eGkcZibJzKmByQw0r5WX9ePFJ0K86ovWNKTcnDJbUEwhq2s/lJsIsvbcbNaI
72-
LaOTEiQI2EBy0OB72zrvUcw0Xwaipft0BCwUIN0AEQEAAcLAXwQYAQIACQUCSukq
73-
TgIbDAAKCRAOtp92/RcVOBcYB/9KXC+CV3GBFZNViBJdPAzGFD5FIcr83riwy2RK
74-
cbehekBjETfLjSfNzB60HnAeU/l+vIOTsLLu1dk0XehG6Laq4325kIZGmRIIqIzZ
75-
qMNG/DLmqMwicSnbw+4hJLU6GQdLNXu0fGDjK4NuZ0yRur0e2JHbgKNgFDnttJx/
76-
ER6Q1SfaIKZSKSd46EFYX2f63Uu7w+yIgvpQCaRUG7Lqz7NJVxxCiF+qRdVEY2E3
77-
hhyG1DGAMMXETV2Hp7SoBmQjAqqwAy1aLwyyNgn1Ft38T+6/IBMGQHMnBcWfOd41
78-
LoKR7XroVADNIdggJawYzZNyU6clw/O1if5vSURumLeul13T
79-
=p7ZF
80-
-----END PGP PUBLIC KEY BLOCK-----
81-
EOF
82-
83-
echo "Validating signature"
84-
if ! (gpgv --keyring "${WORK_DIR}"/keyring "${bin_file}.asc" "${bin_file}" 2> /dev/null); then
85-
echo "ERROR: The signature could not be verified"
86-
exit 1
87-
fi
39+
echo "Archiving Trino"
40+
git -C "trino-${VERSION}" archive "${VERSION}" --format=tar.gz --prefix="trino-server-${VERSION}-src/" > "${src_file}"
41+
sha256sum "${src_file}" | cut --delimiter=' ' --field=1 > "${src_file}.sha256"
8842

8943
echo "Uploading everything to Nexus"
9044
EXIT_STATUS=0
91-
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${bin_file}" 'https://repo.stackable.tech/repository/packages/trino-server/' || EXIT_STATUS=$?
92-
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${bin_file}.asc" 'https://repo.stackable.tech/repository/packages/trino-server/' || EXIT_STATUS=$?
93-
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${bin_file}.sha1" 'https://repo.stackable.tech/repository/packages/trino-server/' || EXIT_STATUS=$?
45+
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${src_file}" 'https://repo.stackable.tech/repository/packages/trino-server/' || EXIT_STATUS=$?
46+
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${src_file}.sha256" 'https://repo.stackable.tech/repository/packages/trino-server/' || EXIT_STATUS=$?
9447

9548
if [ $EXIT_STATUS -ne 0 ]; then
9649
echo "ERROR: Upload failed"

upload_new_jmx_exporter_version.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,28 @@ fi
2121

2222
# deletes the temp directory
2323
function cleanup {
24-
rm -rf "$WORK_DIR"
24+
rm -rf "$WORK_DIR"
2525
}
2626

2727
# register the cleanup function to be called on the EXIT signal
2828
trap cleanup EXIT
2929

3030
cd "$WORK_DIR" || exit
3131

32+
src_file=jmx_prometheus-$VERSION-src.tar.gz
33+
3234
# JMX Exporter does not currently publish signatures or SBOMs (as of 2023-07-24, latest version at this point 0.19.0)
3335
echo "Downloading JMX Exporter"
34-
curl --fail -LOs "https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/$VERSION/jmx_prometheus_javaagent-$VERSION.jar"
36+
# JMX Exporter provides no offficial source tarballs, download from Git
37+
git clone https://github.com/prometheus/jmx_exporter "jmx_prometheus-${VERSION}" "--branch=${VERSION}" --depth=1
38+
39+
echo "Archiving JMX Exporter"
40+
git -C "jmx_prometheus-${VERSION}" archive "${VERSION}" --format=tar.gz --prefix="jmx_prometheus-${VERSION}-src/" > "${src_file}"
41+
sha256sum "${src_file}" | cut --delimiter=' ' --field=1 > "${src_file}.sha256"
3542

3643
echo "Uploading to Nexus"
37-
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "jmx_prometheus_javaagent-$VERSION.jar" 'https://repo.stackable.tech/repository/packages/jmx-exporter/'
44+
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${src_file}" 'https://repo.stackable.tech/repository/packages/jmx-exporter/'
45+
curl --fail -u "$NEXUS_USER:$NEXUS_PASSWORD" --upload-file "${src_file}.sha256" 'https://repo.stackable.tech/repository/packages/jmx-exporter/'
3846

3947
echo "Successfully uploaded new version of JMX Exporter ($VERSION) to Nexus"
4048
echo "https://repo.stackable.tech/service/rest/repository/browse/packages/jmx-exporter/"

0 commit comments

Comments
 (0)