@@ -8,6 +8,7 @@ FROM oci.stackable.tech/sdp/git-sync/git-sync:${GIT_SYNC} AS git-sync-image
88FROM  stackable/image/java-devel AS nifi-builder
99
1010ARG  PRODUCT
11+ ARG  RELEASE
1112ARG  MAVEN_VERSION="3.9.8" 
1213ARG  STACKABLE_USER_UID
1314
@@ -45,8 +46,13 @@ curl 'https://repo.stackable.tech/repository/m2/tech/stackable/nifi/stackable-bc
4546
4647cd "$(/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.
5763fi
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
6875find . -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
7784done
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
8693chmod -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
187194COPY  --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/
190197COPY  --chown=${STACKABLE_USER_UID}:0 --from=nifi-iceberg-bundle-builder /stackable/*-src.tar.gz /stackable
191198COPY  --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
194201COPY  --chown=${STACKABLE_USER_UID}:0 --from=opa-authorizer-builder /stackable/nifi-opa-plugin-${NIFI_OPA_AUTHORIZER_PLUGIN}-src.tar.gz  /stackable
195202COPY  --chown=${STACKABLE_USER_UID}:0 --from=opa-authorizer-builder /stackable/LICENSE /licenses/NIFI_OPA_PLUGIN_LICENSE
196203COPY  --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
220227ln -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
225232chown --no-dereference ${STACKABLE_USER_UID}:0 /stackable/nifi
226233chmod --recursive g=u /stackable/python
227234chmod --recursive g=u /stackable/bin
228- chmod g=u /stackable/nifi-${PRODUCT}
235+ chmod g=u /stackable/nifi-${PRODUCT}-stackable${RELEASE} 
229236chmod g=u /stackable/*-src.tar.gz
230237EOF
231238
0 commit comments