Skip to content

Commit ca96da5

Browse files
authored
chore: Pin build tooling (#1682)
* chore: Pin versions-maven-plugin for mvn versions:set * chore: Disable install scripts for global npm installs * chore(superset): Use the npm version bundled with Node instead of the latest * chore: Only install global npm packages published at least 7 days ago * chore(superset): Pin npm instead of using the version bundled with Node * chore: Update changelog * chore: Pin maven-help-plugin and maven-dependency-plugin for prefix invocations * chore: Address review feedback on tooling pins
1 parent 2c43ef4 commit ca96da5

23 files changed

Lines changed: 100 additions & 44 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ All notable changes to this project will be documented in this file.
3333
- vector: Build with `--locked` ([#1674]).
3434
- nifi: Updated dependencies for `2.6.0` and `2.9.0` ([#1667]).
3535
- ci: Bump `stackabletech/actions` to `v0.18.4` ([#1681]).
36+
- java-devel: Pin `versions-maven-plugin` to `2.22.0` for `mvn versions:set`, `maven-help-plugin` to `3.5.2` for `mvn help:evaluate` and `maven-dependency-plugin` to `3.11.0` for `mvn dependency:get`, which otherwise resolve the latest release on every build unless the product POM pins them ([#1682]).
37+
- spark: Remove duplicated arguments from the `mvn dependency:get` calls for `stax2-api` and `woodstox-core` ([#1682]).
38+
- airflow, druid, hbase, nifi, opensearch-dashboards, superset, trino: Install global npm packages (cdxgen, pnpm, yarn, npm) with `--ignore-scripts`, and only resolve versions that were published at least 7 days ago (`--before`) ([#1682]).
39+
- superset: Pin npm to `10.9.9` instead of installing the latest version with `nvm install --latest-npm` ([#1682]).
3640

3741
### Fixed
3842

@@ -121,6 +125,7 @@ All notable changes to this project will be documented in this file.
121125
[#1677]: https://github.com/stackabletech/docker-images/pull/1677
122126
[#1680]: https://github.com/stackabletech/docker-images/pull/1680
123127
[#1681]: https://github.com/stackabletech/docker-images/pull/1681
128+
[#1682]: https://github.com/stackabletech/docker-images/pull/1682
124129
[#1683]: https://github.com/stackabletech/docker-images/pull/1683
125130
[#1686]: https://github.com/stackabletech/docker-images/pull/1686
126131
[#1689]: https://github.com/stackabletech/docker-images/pull/1689

‎airflow/Dockerfile‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,10 @@ ARCH="${TARGETARCH/amd64/x64}"
130130
mkdir -p /opt/node-cdxgen
131131
curl "https://repo.stackable.tech/repository/packages/node/node-v${CDXGEN_NODEJS_VERSION}-linux-${ARCH}.tar.xz" | \
132132
tar --extract --xz --directory=/opt/node-cdxgen --strip-components=1
133-
PATH="/opt/node-cdxgen/bin:$PATH" npm install --global "@cdxgen/cdxgen@${CDXGEN_VERSION}"
133+
# --ignore-scripts keeps the install scripts of (transitive) dependencies from running.
134+
# --before only resolves versions published at least 7 days ago, including the transitive ones,
135+
# so that a freshly published malicious version is not picked up before it is taken down.
136+
PATH="/opt/node-cdxgen/bin:$PATH" npm install --global --ignore-scripts --before="$(date --utc --date='-7 days' --iso-8601=seconds)" "@cdxgen/cdxgen@${CDXGEN_VERSION}"
134137
EOF
135138

136139
COPY airflow/stackable/constraints/${PRODUCT_VERSION}/constraints-python${PYTHON_VERSION}.txt /tmp/constraints.txt
@@ -180,7 +183,10 @@ if [ -d "./airflow-core" ]; then
180183

181184
# build front-end assets
182185
# TODO: Consider making the pnpm version an ARG
183-
npm install -g pnpm@10.18.2
186+
# --ignore-scripts keeps the install scripts of (transitive) dependencies from running.
187+
# --before only resolves versions published at least 7 days ago, including the transitive ones,
188+
# so that a freshly published malicious version is not picked up before it is taken down.
189+
npm install -g --ignore-scripts --before="$(date --utc --date='-7 days' --iso-8601=seconds)" pnpm@10.18.2
184190
pnpm install --frozen-lockfile
185191
pnpm run build
186192

@@ -212,7 +218,10 @@ else
212218
# build front-end assets
213219
cd airflow/www
214220
# TODO: Consider making the yarn version an ARG
215-
npm install -g yarn@1.22.22
221+
# --ignore-scripts keeps the install scripts of (transitive) dependencies from running.
222+
# --before only resolves versions published at least 7 days ago, including the transitive ones,
223+
# so that a freshly published malicious version is not picked up before it is taken down.
224+
npm install -g --ignore-scripts --before="$(date --utc --date='-7 days' --iso-8601=seconds)" yarn@1.22.22
216225
yarn install --frozen-lockfile
217226
yarn run build
218227

‎druid/Dockerfile‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ ARCH="${TARGETARCH/amd64/x64}"
4848
mkdir -p /opt/node-cdxgen
4949
curl "https://repo.stackable.tech/repository/packages/node/node-v${CDXGEN_NODEJS_VERSION}-linux-${ARCH}.tar.xz" | \
5050
tar --extract --xz --directory=/opt/node-cdxgen --strip-components=1
51-
PATH="/opt/node-cdxgen/bin:$PATH" npm install --global "@cdxgen/cdxgen@${CDXGEN_VERSION}"
51+
# --ignore-scripts keeps the install scripts of (transitive) dependencies from running.
52+
# --before only resolves versions published at least 7 days ago, including the transitive ones,
53+
# so that a freshly published malicious version is not picked up before it is taken down.
54+
PATH="/opt/node-cdxgen/bin:$PATH" npm install --global --ignore-scripts --before="$(date --utc --date='-7 days' --iso-8601=seconds)" "@cdxgen/cdxgen@${CDXGEN_VERSION}"
5255
EOF
5356

5457
USER ${STACKABLE_USER_UID}
@@ -77,10 +80,10 @@ RUN --mount=type=cache,id=maven-${PRODUCT_VERSION},uid=${STACKABLE_USER_UID},tar
7780
cd "$(cat /tmp/DRUID_SOURCE_DIR)" || exit 1
7881
rm /tmp/DRUID_SOURCE_DIR
7982

80-
ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
83+
ORIGINAL_VERSION=$(mvn "org.apache.maven.plugins:maven-help-plugin:${HELP_MAVEN_PLUGIN_VERSION}:evaluate" -Dexpression=project.version -q -DforceStdout)
8184
NEW_VERSION="${PRODUCT_VERSION}-stackable${RELEASE_VERSION}"
8285

83-
mvn versions:set -DnewVersion=$NEW_VERSION
86+
mvn "org.codehaus.mojo:versions-maven-plugin:${VERSIONS_MAVEN_PLUGIN_VERSION}:set" -DnewVersion=$NEW_VERSION
8487

8588
# Make Maven aware of custom Stackable libraries
8689
cp -r /stackable/patched-libs/maven/* /stackable/.m2/repository

‎hadoop/hadoop/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ USER ${STACKABLE_USER_UID}
8080
RUN <<EOF
8181
cd "$(/stackable/patchable --images-repo-root=src checkout hadoop/hadoop ${PRODUCT_VERSION})"
8282

83-
ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
83+
ORIGINAL_VERSION=$(mvn "org.apache.maven.plugins:maven-help-plugin:${HELP_MAVEN_PLUGIN_VERSION}:evaluate" -Dexpression=project.version -q -DforceStdout)
8484
NEW_VERSION=${PRODUCT_VERSION}-stackable${RELEASE_VERSION}
8585

86-
mvn versions:set -DnewVersion=${NEW_VERSION}
86+
mvn "org.codehaus.mojo:versions-maven-plugin:${VERSIONS_MAVEN_PLUGIN_VERSION}:set" -DnewVersion=${NEW_VERSION}
8787

8888
# Since we skip building the hadoop-pipes module, we need to set the version to the original version so it can be pulled from Maven Central
8989
sed -e '/<artifactId>hadoop-pipes<\/artifactId>/,/<\/dependency>/ { s/<version>.*<\/version>/<version>'"$ORIGINAL_VERSION"'<\/version>/ }' -i hadoop-tools/hadoop-tools-dist/pom.xml

‎hbase/hbase-operator-tools/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ cd "$(/stackable/patchable --images-repo-root=src checkout hbase/hbase-operator-
4141
# Make Maven aware of custom Stackable libraries
4242
cp -r /stackable/patched-libs/maven/* /stackable/.m2/repository
4343

44-
ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
44+
ORIGINAL_VERSION=$(mvn "org.apache.maven.plugins:maven-help-plugin:${HELP_MAVEN_PLUGIN_VERSION}:evaluate" -Dexpression=project.version -q -DforceStdout)
4545
NEW_VERSION="${HBASE_OPERATOR_TOOLS_VERSION}-stackable${RELEASE_VERSION}"
4646
FULL_HBASE_OPERATOR_TOOLS_VERSION="${PRODUCT_VERSION}-stackable${RELEASE_VERSION}" # This includes the HBase version and the Stackable release suffix
4747
PATCHED_HBASE_VERSION="${HBASE_VERSION}-stackable${RELEASE_VERSION}"
4848

49-
mvn versions:set -DnewVersion=$NEW_VERSION
49+
mvn "org.codehaus.mojo:versions-maven-plugin:${VERSIONS_MAVEN_PLUGIN_VERSION}:set" -DnewVersion=$NEW_VERSION
5050

5151
# Create snapshot of the source code including custom patches
5252
tar -czf /stackable/hbase-operator-tools-${FULL_HBASE_OPERATOR_TOOLS_VERSION}-src.tar.gz .

‎hbase/hbase/Dockerfile‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ ARCH="${TARGETARCH/amd64/x64}"
3232
mkdir -p /opt/node-cdxgen
3333
curl "https://repo.stackable.tech/repository/packages/node/node-v${CDXGEN_NODEJS_VERSION}-linux-${ARCH}.tar.xz" | \
3434
tar --extract --xz --directory=/opt/node-cdxgen --strip-components=1
35-
PATH="/opt/node-cdxgen/bin:$PATH" npm install --global "@cdxgen/cdxgen@${CDXGEN_VERSION}"
35+
# --ignore-scripts keeps the install scripts of (transitive) dependencies from running.
36+
# --before only resolves versions published at least 7 days ago, including the transitive ones,
37+
# so that a freshly published malicious version is not picked up before it is taken down.
38+
PATH="/opt/node-cdxgen/bin:$PATH" npm install --global --ignore-scripts --before="$(date --utc --date='-7 days' --iso-8601=seconds)" "@cdxgen/cdxgen@${CDXGEN_VERSION}"
3639

3740
microdnf update
3841
microdnf install python3
@@ -67,10 +70,10 @@ cd "$(/stackable/patchable --images-repo-root=src checkout hbase/hbase ${PRODUCT
6770
# Make Maven aware of custom Stackable libraries
6871
cp -r /stackable/patched-libs/maven/* /stackable/.m2/repository
6972

70-
ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
73+
ORIGINAL_VERSION=$(mvn "org.apache.maven.plugins:maven-help-plugin:${HELP_MAVEN_PLUGIN_VERSION}:evaluate" -Dexpression=project.version -q -DforceStdout)
7174
NEW_VERSION="${PRODUCT_VERSION}-stackable${RELEASE_VERSION}"
7275

73-
mvn versions:set -DnewVersion=$NEW_VERSION
76+
mvn "org.codehaus.mojo:versions-maven-plugin:${VERSIONS_MAVEN_PLUGIN_VERSION}:set" -DnewVersion=$NEW_VERSION
7477

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

‎hbase/phoenix/Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ cp -r /stackable/patched-libs/maven/* /stackable/.m2/repository
3535

3636
cd "$(/stackable/patchable --images-repo-root=src checkout phoenix ${PHOENIX_VERSION})"
3737

38-
ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
38+
ORIGINAL_VERSION=$(mvn "org.apache.maven.plugins:maven-help-plugin:${HELP_MAVEN_PLUGIN_VERSION}:evaluate" -Dexpression=project.version -q -DforceStdout)
3939
NEW_VERSION="${PHOENIX_VERSION}-stackable${RELEASE_VERSION}"
4040

41-
mvn versions:set -DnewVersion=$NEW_VERSION
41+
mvn "org.codehaus.mojo:versions-maven-plugin:${VERSIONS_MAVEN_PLUGIN_VERSION}:set" -DnewVersion=$NEW_VERSION
4242

4343
# Create snapshot of the source code including custom patches
4444
tar -czf /stackable/phoenix-${PRODUCT_VERSION}-stackable${RELEASE_VERSION}-src.tar.gz .

‎hive/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ cd "$BUILD_SRC_DIR"
5454
cp -r /stackable/patched-libs/maven/* /stackable/.m2/repository
5555

5656
# generateBackupPoms=false is needed for the Hive 4.0.0 build to succeed, otherwise it fails with the obscure reason: `Too many files with unapproved license`
57-
mvn versions:set -DnewVersion=$NEW_VERSION -DartifactId=* -DgroupId=* -DgenerateBackupPoms=false
57+
mvn "org.codehaus.mojo:versions-maven-plugin:${VERSIONS_MAVEN_PLUGIN_VERSION}:set" -DnewVersion=$NEW_VERSION -DartifactId=* -DgroupId=* -DgenerateBackupPoms=false
5858

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

‎hive/hive-metastore-opa-authorizer/Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ tar -czf /stackable/opa-authorizer-src/hive-metastore-opa-authorizer-${AUTHORIZE
4141
cp -r /stackable/patched-libs/maven/* /stackable/.m2/repository
4242

4343
# Set version
44-
mvn versions:set -DnewVersion=${AUTHORIZER_VERSION}
44+
mvn "org.codehaus.mojo:versions-maven-plugin:${VERSIONS_MAVEN_PLUGIN_VERSION}:set" -DnewVersion=${AUTHORIZER_VERSION}
4545

4646
# The if part can be removed once we do no longer support Hive 3.x.x
4747
# Hive 3.1.3 only works with the shaded jar

‎java-devel/Dockerfile‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,18 @@ EOF
6868
ENV JAVA_HOME="/usr/lib/jvm/temurin-${PRODUCT_VERSION}-jdk"
6969
ENV MAVEN_ARGS="--batch-mode --no-transfer-progress"
7070

71+
# Plugins that are invoked by prefix on the command line (e.g. `mvn versions:set`) resolve to their
72+
# latest release unless the project POM pins them, so their version would change silently between builds.
73+
# Find the latest version here: https://github.com/mojohaus/versions/releases
74+
# renovate: datasource=maven packageName=org.codehaus.mojo:versions-maven-plugin
75+
ENV VERSIONS_MAVEN_PLUGIN_VERSION=2.22.0
76+
# Find the latest version here: https://github.com/apache/maven-help-plugin/releases
77+
# renovate: datasource=maven packageName=org.apache.maven.plugins:maven-help-plugin
78+
ENV HELP_MAVEN_PLUGIN_VERSION=3.5.2
79+
# Find the latest version here: https://github.com/apache/maven-dependency-plugin/releases
80+
# renovate: datasource=maven packageName=org.apache.maven.plugins:maven-dependency-plugin
81+
ENV DEPENDENCY_MAVEN_PLUGIN_VERSION=3.11.0
82+
7183
ARG GITHUB_RUN_ATTEMPT="<unknown>"
7284
ENV GITHUB_RUN_ATTEMPT=${GITHUB_RUN_ATTEMPT}
7385

0 commit comments

Comments
 (0)