Skip to content

fix: automatically determine NiFi version create reporting task script #1189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ All notable changes to this project will be documented in this file.
- hive: Patch for postgres CVE-2024-1597 ([#1100]).
- bump image-tools (for `bake`) and nixpkgs (for `nodejs_20`, used by pre-commit) ([#1100]).
- bump image-tools (for `bake`) to fix `RELEASE` arg ([#1188]).
- nifi: automatically determine NiFi version create reporting task script ([#1189]).

### Removed

Expand Down Expand Up @@ -211,6 +212,7 @@ All notable changes to this project will be documented in this file.
[#1184]: https://github.com/stackabletech/docker-images/pull/1184
[#1185]: https://github.com/stackabletech/docker-images/pull/1185
[#1188]: https://github.com/stackabletech/docker-images/pull/1188
[#1189]: https://github.com/stackabletech/docker-images/pull/1189

## [25.3.0] - 2025-03-21

Expand Down
11 changes: 6 additions & 5 deletions nifi/python/create_nifi_reporting_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,19 @@ def find_reporting_task(name: str, port: str):
return None


def create_reporting_task(name: str, port: str, version: str):
def create_reporting_task(name: str, port: str):
"""Create a ReportingTask"""
nifi_version = nipyapi.system.get_system_diagnostics().system_diagnostics.aggregate_snapshot.version_info.ni_fi_version
task = nipyapi.nifi.models.reporting_task_entity.ReportingTaskEntity(
revision=nipyapi.nifi.models.revision_dto.RevisionDTO(version=0),
disconnected_node_acknowledged=False,
component=nipyapi.nifi.models.reporting_task_dto.ReportingTaskDTO(
name=name,
type="org.apache.nifi.reporting.prometheus.PrometheusReportingTask",
bundle=nipyapi.nifi.models.bundle_dto.BundleDTO(
group="org.apache.nifi", artifact="nifi-prometheus-nar", version=version
group="org.apache.nifi",
artifact="nifi-prometheus-nar",
version=nifi_version,
),
properties={
"prometheus-reporting-task-metrics-endpoint-port": port,
Expand Down Expand Up @@ -158,9 +161,7 @@ def main():
reporting_task = find_reporting_task(name=task_name, port=port)

if reporting_task is None:
reporting_task = create_reporting_task(
name=task_name, port=port, version=args["nifi_version"]
)
reporting_task = create_reporting_task(name=task_name, port=port)
print(
get_reporting_task_name(task=reporting_task)
+ " [%s] -> CREATED" % reporting_task.id
Expand Down