Skip to content

Commit a187657

Browse files
authored
feat: custom version for NiFi (#1172)
* feat: support custom product versions * chore: changelog
1 parent bca4124 commit a187657

File tree

2 files changed

+21
-13
lines changed

2 files changed

+21
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ All notable changes to this project will be documented in this file.
132132
- nifi: Remove `2.2.0` ([#1114]).
133133
- kafka: Remove `3.7.1` and `3.8.0` ([#1117]).
134134
- spark-connect-client: Remove `3.5.5` ([#1142]).
135+
- nifi: Enable custom versions ([#1172]).
135136
- kafka: Enable custom versions ([#1171]).
136137
- omid: Enable custom versions ([#1174]).
137138

nifi/Dockerfile

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ FROM oci.stackable.tech/sdp/git-sync/git-sync:${GIT_SYNC} AS git-sync-image
88
FROM stackable/image/java-devel AS nifi-builder
99

1010
ARG PRODUCT
11+
ARG RELEASE
1112
ARG MAVEN_VERSION="3.9.8"
1213
ARG STACKABLE_USER_UID
1314

@@ -45,8 +46,13 @@ curl 'https://repo.stackable.tech/repository/m2/tech/stackable/nifi/stackable-bc
4546

4647
cd "$(/stackable/patchable --images-repo-root=src checkout nifi ${PRODUCT})"
4748

49+
ORIGINAL_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
50+
NEW_VERSION="${PRODUCT}-stackable${RELEASE}"
51+
52+
mvn versions:set -DnewVersion=$NEW_VERSION
53+
4854
# Create snapshot of the source code including custom patches
49-
tar -czf /stackable/nifi-${PRODUCT}-src.tar.gz .
55+
tar -czf /stackable/nifi-${NEW_VERSION}-src.tar.gz .
5056

5157
# NOTE: Since NiFi 2.0.0 PutIceberg Processor and services were removed, so including the `include-iceberg` profile does nothing.
5258
# Additionally some modules were moved to optional build profiles, so we need to add `include-hadoop` to get `nifi-parquet-nar` for example.
@@ -57,13 +63,14 @@ else
5763
fi
5864

5965
# Copy the binaries to the /stackable folder
60-
mv nifi-assembly/target/nifi-${PRODUCT}-bin/nifi-${PRODUCT} /stackable/nifi-${PRODUCT}
66+
mv nifi-assembly/target/nifi-${NEW_VERSION}-bin/nifi-${NEW_VERSION} /stackable/nifi-${NEW_VERSION}
6167

6268
# Copy the SBOM as well
63-
mv nifi-assembly/target/bom.json /stackable/nifi-${PRODUCT}/nifi-${PRODUCT}.cdx.json
69+
sed -i "s/${NEW_VERSION}/${ORIGINAL_VERSION}/g" nifi-assembly/target/bom.json
70+
mv nifi-assembly/target/bom.json /stackable/nifi-${NEW_VERSION}/nifi-${NEW_VERSION}.cdx.json
6471

6572
# Get a list of NARs
66-
export NARS=$(ls /stackable/nifi-${PRODUCT}/lib/*.nar | awk -F '/' '{ print $5 }' | sed "s/\-${PRODUCT}.nar\$//g")
73+
export NARS=$(ls /stackable/nifi-${NEW_VERSION}/lib/*.nar | awk -F '/' '{ print $5 }' | sed "s/\-${NEW_VERSION}.nar\$//g")
6774
# Get a list of SBOMs
6875
find . -name bom.json > bomlist.txt
6976

@@ -72,15 +79,15 @@ for nar in $NARS; do
7279
match=$(grep "\/$nar\/target\/bom.json" bomlist.txt || true)
7380
if [[ -n "$match" ]]; then
7481
# Copy the SBOM of the NAR
75-
cp "$match" "/stackable/nifi-${PRODUCT}/$nar.cdx.json"
82+
cp "$match" "/stackable/nifi-${NEW_VERSION}/$nar.cdx.json"
7683
fi
7784
done
7885

7986
# Remove sources
8087
(cd .. && rm -r ${PRODUCT})
8188

8289
# Remove generated docs in binary
83-
rm -rf /stackable/nifi-${PRODUCT}/docs
90+
rm -rf /stackable/nifi-${NEW_VERSION}/docs
8491

8592
# Set correct permissions
8693
chmod -R g=u /stackable
@@ -182,15 +189,15 @@ LABEL name="Apache NiFi" \
182189
summary="The Stackable image for Apache NiFi." \
183190
description="This image is deployed by the Stackable Operator for Apache NiFi."
184191

185-
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-builder /stackable/nifi-${PRODUCT} /stackable/nifi-${PRODUCT}/
186-
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-builder /stackable/nifi-${PRODUCT}-src.tar.gz /stackable
192+
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-builder /stackable/nifi-${PRODUCT}-stackable${RELEASE} /stackable/nifi-${PRODUCT}-stackable${RELEASE}/
193+
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-builder /stackable/nifi-${PRODUCT}-stackable${RELEASE}-src.tar.gz /stackable
187194
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-builder /stackable/stackable-bcrypt.jar /stackable/stackable-bcrypt.jar
188-
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-iceberg-bundle-builder /stackable/*.nar /stackable/nifi-${PRODUCT}/lib/
189-
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-iceberg-bundle-builder /stackable/*.cdx.json /stackable/nifi-${PRODUCT}/lib/
195+
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-iceberg-bundle-builder /stackable/*.nar /stackable/nifi-${PRODUCT}-stackable${RELEASE}/lib/
196+
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-iceberg-bundle-builder /stackable/*.cdx.json /stackable/nifi-${PRODUCT}-stackable${RELEASE}/lib/
190197
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-iceberg-bundle-builder /stackable/*-src.tar.gz /stackable
191198
COPY --chown=${STACKABLE_USER_UID}:0 --from=nifi-builder /stackable/git-sync /stackable/git-sync
192199

193-
COPY --chown=${STACKABLE_USER_UID}:0 --from=opa-authorizer-builder /stackable/opa-authorizer.nar /stackable/nifi-${PRODUCT}/extensions/opa-authorizer.nar
200+
COPY --chown=${STACKABLE_USER_UID}:0 --from=opa-authorizer-builder /stackable/opa-authorizer.nar /stackable/nifi-${PRODUCT}-stackable${RELEASE}/extensions/opa-authorizer.nar
194201
COPY --chown=${STACKABLE_USER_UID}:0 --from=opa-authorizer-builder /stackable/nifi-opa-plugin-${NIFI_OPA_AUTHORIZER_PLUGIN}-src.tar.gz /stackable
195202
COPY --chown=${STACKABLE_USER_UID}:0 --from=opa-authorizer-builder /stackable/LICENSE /licenses/NIFI_OPA_PLUGIN_LICENSE
196203
COPY --chown=${STACKABLE_USER_UID}:0 nifi/stackable/bin /stackable/bin
@@ -219,13 +226,13 @@ pip install --no-cache-dir \
219226
# This can be removed once older versions / operators using this are no longer supported
220227
ln -s /stackable/stackable-bcrypt.jar /bin/stackable-bcrypt.jar
221228

222-
ln -s /stackable/nifi-${PRODUCT} /stackable/nifi
229+
ln -s /stackable/nifi-${PRODUCT}-stackable${RELEASE} /stackable/nifi
223230

224231
# fix missing permissions / ownership
225232
chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/nifi
226233
chmod --recursive g=u /stackable/python
227234
chmod --recursive g=u /stackable/bin
228-
chmod g=u /stackable/nifi-${PRODUCT}
235+
chmod g=u /stackable/nifi-${PRODUCT}-stackable${RELEASE}
229236
chmod g=u /stackable/*-src.tar.gz
230237
EOF
231238

0 commit comments

Comments
 (0)