Skip to content

Commit 29c7255

Browse files
Martin Zinkszaszm
authored andcommitted
MINIFICPP-2514 Fix Python libloader
Fix and extend verify package to include aarch64 Closes #1919 Signed-off-by: Marton Szasz <[email protected]>
1 parent 53d8027 commit 29c7255

File tree

8 files changed

+100
-59
lines changed

8 files changed

+100
-59
lines changed

.github/workflows/verify-package.yml

Lines changed: 81 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ env:
66
-DENABLE_ELASTICSEARCH=OFF -DENABLE_GRAFANA_LOKI=ON -DENABLE_COUCHBASE=ON -DDOCKER_BUILD_ONLY=ON
77
CCACHE_DIR: ${{ GITHUB.WORKSPACE }}/.ccache
88
jobs:
9-
rocky-build:
10-
name: "Build package (Rocky 8)"
11-
runs-on: ubuntu-22.04
9+
rocky-x86-64-build:
10+
name: "Build package (Rocky 8 x86_64)"
11+
runs-on: ubuntu-24.04
1212
timeout-minutes: 180
1313
steps:
1414
- id: checkout
@@ -38,40 +38,76 @@ jobs:
3838
key: verify-package-ccache-${{github.ref}}-${{github.sha}}
3939
- uses: actions/upload-artifact@v4
4040
with:
41-
name: minifi-tar
41+
name: minifi-x86-64-tar
4242
path: build/nifi-minifi-cpp-*-bin-rockylinux.tar.gz
4343
if-no-files-found: error
4444

45-
docker-tests:
45+
rocky-aarch64-build:
46+
name: "Build package (Rocky 8 aarch64)"
47+
runs-on: ubuntu-24.04-arm
48+
timeout-minutes: 180
49+
steps:
50+
- id: checkout
51+
uses: actions/checkout@v4
52+
- name: cache restore
53+
uses: actions/cache/restore@v4
54+
with:
55+
path: ~/.ccache
56+
key: verify-package-arm-ccache-${{github.ref}}-${{github.sha}}
57+
restore-keys: |
58+
verify-package-arm-ccache-${{github.ref}}-
59+
verify-package-arm-ccache-refs/heads/main-
60+
- id: install_deps
61+
run: |
62+
sudo apt update
63+
sudo apt install -y ccache cmake
64+
echo "PATH=/usr/lib/ccache:$PATH" >> $GITHUB_ENV
65+
- id: build
66+
run: |
67+
if [ -d ~/.ccache ]; then mv ~/.ccache .; fi
68+
mkdir build && cd build && cmake ${DOCKER_CMAKE_FLAGS} -DDOCKER_CCACHE_DUMP_LOCATION=${{ env.CCACHE_DIR }} .. && make rocky
69+
- name: cache save
70+
uses: actions/cache/save@v4
71+
if: always()
72+
with:
73+
path: ${{ env.CCACHE_DIR }}
74+
key: verify-package-arm-ccache-${{github.ref}}-${{github.sha}}
75+
- uses: actions/upload-artifact@v4
76+
with:
77+
name: minifi-aarch64-tar
78+
path: build/nifi-minifi-cpp-*-bin-rockylinux.tar.gz
79+
if-no-files-found: error
80+
81+
docker-x86-64-tests:
4682
name: "${{ matrix.platform.name }}"
47-
runs-on: ubuntu-20.04
83+
runs-on: ubuntu-24.04
4884
timeout-minutes: 180
49-
needs: rocky-build
85+
needs: rocky-x86-64-build
5086
strategy:
5187
fail-fast: false
5288
matrix:
5389
platform: [
54-
{ name: "Rocky Linux 8",
90+
{ name: "Rocky Linux 8 x86-64",
5591
id: "rocky8",
5692
build_cmd: "make rocky8_from_rocky_package",
5793
verify_cmd: "make docker-verify-rocky8" },
58-
{ name: "Rocky Linux 9",
94+
{ name: "Rocky Linux 9 x86-64",
5995
id: "rocky9",
6096
build_cmd: "make rocky9_from_rocky_package",
6197
verify_cmd: "make docker-verify-rocky9" },
62-
{ name: "Ubuntu 22.04",
98+
{ name: "Ubuntu 22.04 x86-64",
6399
id: "ubuntu_jammy",
64100
build_cmd: "make jammy_from_rocky_package",
65101
verify_cmd: "make docker-verify-jammy" },
66-
{ name: "Ubuntu 24.04",
102+
{ name: "Ubuntu 24.04 x86-64",
67103
id: "ubuntu_noble",
68104
build_cmd: "make noble_from_rocky_package",
69105
verify_cmd: "make docker-verify-noble" },
70-
{ name: "Debian 11",
106+
{ name: "Debian 11 x86-64",
71107
id: "debian_bullseye",
72108
build_cmd: "make bullseye_from_rocky_package",
73109
verify_cmd: "make docker-verify-bullseye" },
74-
{ name: "Debian 12",
110+
{ name: "Debian 12 x86-64",
75111
id: "debian_bookworm",
76112
build_cmd: "make bookworm_from_rocky_package",
77113
verify_cmd: "make docker-verify-bookworm" },
@@ -82,7 +118,7 @@ jobs:
82118
uses: actions/checkout@v4
83119
- uses: actions/download-artifact@v4
84120
with:
85-
name: minifi-tar
121+
name: minifi-x86-64-tar
86122
path: build
87123
- id: install_deps
88124
run: |
@@ -104,55 +140,57 @@ jobs:
104140
if: failure()
105141
uses: actions/upload-artifact@v4
106142
with:
107-
name: ${{ matrix.platform.id }}_behavex_output
143+
name: ${{ matrix.platform.id }}_x86_64_behavex_output
108144
path: build/behavex_output
109-
docker-python-tests:
145+
146+
147+
docker-aarch64-tests:
110148
name: "${{ matrix.platform.name }}"
111-
runs-on: ubuntu-20.04
149+
runs-on: ubuntu-24.04-arm
112150
timeout-minutes: 180
113-
needs: rocky-build
151+
needs: rocky-aarch64-build
114152
strategy:
115153
fail-fast: false
116154
matrix:
117155
platform: [
118-
{ name: "Rocky Linux 8 Python",
156+
{ name: "Rocky Linux 8 aarch64",
119157
id: "rocky8",
120-
build_cmd: "make rocky8_py_from_rocky_package",
121-
verify_cmd: "make docker-verify-rocky8_py" },
122-
{ name: "Rocky Linux 9 Python",
158+
build_cmd: "make rocky8_from_rocky_package",
159+
verify_cmd: "make docker-verify-rocky8" },
160+
{ name: "Rocky Linux 9 aarch64",
123161
id: "rocky9",
124-
build_cmd: "make rocky9_py_from_rocky_package",
125-
verify_cmd: "make docker-verify-rocky9_py" },
126-
{ name: "Patchelf-ed Ubuntu 22.04 Python",
127-
id: "patchelfed_ubuntu22.04",
128-
build_cmd: "make patched_jammy_py_from_rocky_package",
129-
verify_cmd: "make docker-verify-patched_jammy_py" },
130-
{ name: "Patchelf-ed Debian 11 Python",
131-
id: "patchelfed_debian11",
132-
build_cmd: "make patched_bullseye_py_from_rocky_package",
133-
verify_cmd: "make docker-verify-patched_bullseye_py" },
134-
{ name: "Ubuntu 22.04 with Anaconda Python",
135-
id: "ubuntu22.04_anaconda",
136-
build_cmd: "make jammy_py_from_rocky_package && make conda_jammy_py_from_rocky_package",
137-
verify_cmd: "make docker-verify-conda_jammy_py" },
138-
{ name: "Rocky Linux 9 in virtualenv Python",
139-
id: "rocky9_venv",
140-
build_cmd: "make rocky9_py_from_rocky_package && make venv_rocky9_py_from_rocky_package",
141-
verify_cmd: "make docker-verify-venv_rocky9_py" }
162+
build_cmd: "make rocky9_from_rocky_package",
163+
verify_cmd: "make docker-verify-rocky9" },
164+
{ name: "Ubuntu 22.04 aarch64",
165+
id: "ubuntu_jammy",
166+
build_cmd: "make jammy_from_rocky_package",
167+
verify_cmd: "make docker-verify-jammy" },
168+
{ name: "Ubuntu 24.04 aarch64",
169+
id: "ubuntu_noble",
170+
build_cmd: "make noble_from_rocky_package",
171+
verify_cmd: "make docker-verify-noble" },
172+
{ name: "Debian 11 aarch64",
173+
id: "debian_bullseye",
174+
build_cmd: "make bullseye_from_rocky_package",
175+
verify_cmd: "make docker-verify-bullseye" },
176+
{ name: "Debian 12 aarch64",
177+
id: "debian_bookworm",
178+
build_cmd: "make bookworm_from_rocky_package",
179+
verify_cmd: "make docker-verify-bookworm" },
142180
]
143181

144182
steps:
145183
- id: checkout
146184
uses: actions/checkout@v4
147185
- uses: actions/download-artifact@v4
148186
with:
149-
name: minifi-tar
187+
name: minifi-aarch64-tar
150188
path: build
151189
- id: install_deps
152190
run: |
153191
sudo apt update
154192
sudo apt install -y python3-virtualenv
155-
- run: cd build && cmake -DENABLE_PYTHON_SCRIPTING=ON -DDOCKER_BUILD_ONLY=ON .. \
193+
- run: cd build && cmake ${DOCKER_CMAKE_FLAGS} .. \
156194
&& ${{ matrix.platform.build_cmd }} && ${{ matrix.platform.verify_cmd }}
157195
- name: Test Reporter
158196
if: always()
@@ -168,5 +206,5 @@ jobs:
168206
if: failure()
169207
uses: actions/upload-artifact@v4
170208
with:
171-
name: ${{ matrix.platform.id }}_behavex_output
209+
name: ${{ matrix.platform.id }}_aarch64_behavex_output
172210
path: build/behavex_output

cmake/VerifyPackageWithDocker.cmake

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ function(ADD_PACKAGE_VERIFY TAG_PREFIX)
2828
endif()
2929
endforeach()
3030

31-
set(DISABLED_TAGS "SKIP_CI,ENABLE_PYTHON_SCRIPTING")
31+
set(DISABLED_TAGS "SKIP_CI,NEEDS_NUMPY")
3232

3333
add_custom_target(
3434
docker-verify-${TAG_PREFIX}
3535
COMMAND ${CMAKE_SOURCE_DIR}/docker/DockerVerify.sh --image-tag-prefix ${TAG_PREFIX} ${MINIFI_VERSION_STR} ${ENABLED_TAGS} --tags_to_exclude=${DISABLED_TAGS} --parallel_processes=${DOCKER_VERIFY_THREADS})
3636
endfunction()
3737

3838

39-
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(rockylinux:8 rocky8 "yum install -y wget")
40-
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(rockylinux:9 rocky9 "yum install -y wget")
41-
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(ubuntu:jammy jammy "apt update \\&\\& apt install -y wget")
42-
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(ubuntu:noble noble "apt update \\&\\& apt install -y wget")
43-
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(debian:bookworm bookworm "apt update \\&\\& apt install -y wget")
44-
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(debian:bullseye bullseye "apt update \\&\\& apt install -y wget")
39+
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(rockylinux:8 rocky8 "dnf install -y wget python3.12-devel python3.12-pip gcc gcc-c++")
40+
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(rockylinux:9 rocky9 "dnf install -y wget python3-devel python3-pip gcc gcc-c++")
41+
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(ubuntu:jammy jammy "apt update \\&\\& apt install -y wget python3-dev python3-venv python3-pip")
42+
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(ubuntu:noble noble "apt update \\&\\& apt install -y wget python3-dev python3-venv python3-pip")
43+
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(debian:bookworm bookworm "apt update \\&\\& apt install -y wget python3-dev python3-venv python3-pip")
44+
CREATE_DOCKER_TARGET_FROM_ROCKY_PACKAGE(debian:bullseye bullseye "apt update \\&\\& apt install -y wget python3-dev python3-venv python3-pip")
4545

4646
if (EXISTS ${CMAKE_SOURCE_DIR}/docker/test/integration/features)
4747
ADD_PACKAGE_VERIFY(rocky8)

docker/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ pyjks==20.0.0
22
shortuuid==1.0.11
33
behavex==2.0.1
44
docker==5.0.0
5-
kafka-python==2.0.2
6-
confluent-kafka==1.7.0
5+
kafka-python-ng==2.2.3
6+
confluent-kafka==2.8.0
77
PyYAML==6.0.1
8-
m2crypto==0.41.0
8+
m2crypto==0.43.0
99
watchdog==2.1.2
1010
pyopenssl==23.0.0
1111
azure-storage-blob==12.13.0

docker/test/integration/cluster/ImageStore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ def __build_minifi_cpp_sql_image(self):
8080
so_location = "psqlodbca.so"
8181
elif "bullseye" in MinifiContainer.MINIFI_TAG_PREFIX or "bookworm" in MinifiContainer.MINIFI_TAG_PREFIX:
8282
install_sql_cmd = "apt -y install odbc-postgresql"
83-
so_location = "/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so"
83+
so_location = "/usr/lib/$(gcc -dumpmachine)/odbc/psqlodbca.so"
8484
elif "jammy" in MinifiContainer.MINIFI_TAG_PREFIX or "noble" in MinifiContainer.MINIFI_TAG_PREFIX:
8585
install_sql_cmd = "apt -y install odbc-postgresql"
86-
so_location = "/usr/lib/x86_64-linux-gnu/odbc/psqlodbca.so"
86+
so_location = "/usr/lib/$(gcc -dumpmachine)/odbc/psqlodbca.so"
8787
else:
8888
install_sql_cmd = "apk --update --no-cache add psqlodbc"
8989
so_location = "psqlodbca.so"
@@ -143,7 +143,7 @@ def __build_minifi_cpp_image_with_nifi_python_processors(self, python_option):
143143
parse_document_sed_cmd = 'sed -i "/class ProcessorDetails:/,/^$/{/^\\s*dependencies\\s*=/,/\\]\\s*$/d}" /opt/minifi/minifi-current/minifi-python/nifi_python_processors/ParseDocument.py && \\'
144144
chunk_document_sed_cmd = 'sed -i "/class ProcessorDetails:/,/^$/{/^\\s*dependencies\\s*=/,/\\]\\s*$/d}" /opt/minifi/minifi-current/minifi-python/nifi_python_processors/ChunkDocument.py && \\'
145145
if python_option == PythonOptions.SYSTEM_INSTALLED_PACKAGES:
146-
if not MinifiContainer.MINIFI_TAG_PREFIX:
146+
if not MinifiContainer.MINIFI_TAG_PREFIX or "bookworm" in MinifiContainer.MINIFI_TAG_PREFIX or "noble" in MinifiContainer.MINIFI_TAG_PREFIX:
147147
additional_cmd = "RUN pip3 install --break-system-packages 'langchain<=0.17.0'"
148148
else:
149149
additional_cmd = "RUN pip3 install 'langchain<=0.17.0'"

docker/test/integration/features/fetch_modbus_tcp.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
@x86_x64_only
1617
@CORE
1718
Feature: Minifi C++ can act as a modbus tcp master
1819

docker/test/integration/features/google_cloud_storage.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Feature: Sending data to Google Cloud Storage using PutGCSObject
2828
And a PutFile processor with the "Directory" property set to "/tmp/output"
2929
And the "success" relationship of the GetFile processor is connected to the PutGCSObject
3030
And the "success" relationship of the PutGCSObject processor is connected to the PutFile
31+
And the "failure" relationship of the PutGCSObject processor is connected to the PutGCSObject
3132

3233
When all instances start up
3334

docker/test/integration/features/steps/steps.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,12 +731,13 @@ def step_impl(context, content, topic_name):
731731

732732
producer = Producer({
733733
"bootstrap.servers": "localhost:29093",
734-
"security.protocol": "ssl",
734+
"security.protocol": "SSL",
735735
"ssl.ca.location": ca_cert_file.name,
736736
"ssl.certificate.location": client_cert_file.name,
737737
"ssl.key.location": client_key_file.name,
738738
"ssl.key.password": "",
739-
"client.id": socket.gethostname()})
739+
"client.id": socket.gethostname(),
740+
"ssl.endpoint.identification.algorithm": "none"})
740741
producer.produce(topic_name, content.encode("utf-8"), callback=delivery_report)
741742
producer.flush(10)
742743

extensions/python/pythonlibloader/PythonLibLoader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class PythonLibLoader {
3838
python_command = python_binary.value();
3939
}
4040
std::string command = python_command +
41-
" -c \"import sysconfig, os, glob; print(min(glob.glob(os.path.join(sysconfig.get_config_var('LIBDIR'), f\\\"libpython{sysconfig.get_config_var('VERSION')}.so*\\\")), key=len, default=''))\"";
41+
R"###( -c "import sysconfig, os, glob; v = sysconfig.get_config_vars(); lib_dir = v['LIBDIR']; ld_lib = v['LDLIBRARY']; so_paths = glob.glob(f'{lib_dir}/*{ld_lib}*'); so_paths.extend(glob.glob(f'{lib_dir}/*/*{ld_lib}*')); print(list(filter(os.path.exists, so_paths))[0])")###";
4242
auto lib_python_path = execCommand(command);
4343
if (lib_python_path.empty()) {
4444
logger_->log_error("Failed to find libpython path from specified python binary: {}", python_command);

0 commit comments

Comments
 (0)