Skip to content

[NAE-2406] S3 storage bucket alias#437

Merged
machacjozef merged 3 commits into
release/7.0.0-rev10from
NAE-2406
May 19, 2026
Merged

[NAE-2406] S3 storage bucket alias#437
machacjozef merged 3 commits into
release/7.0.0-rev10from
NAE-2406

Conversation

@renczesstefan
Copy link
Copy Markdown
Member

@renczesstefan renczesstefan commented May 4, 2026

Description

Implements NAE-2406

Dependencies

No new dependencies were introduced

Third party dependencies

No new dependencies were introduced

Blocking Pull requests

There are no dependencies on other PR

How Has Been This Tested?

This was tested manually and with unit tests. File attached to task.

Test Configuration

Name Tested on
OS macOS Tahoe 26.3
Runtime Java 21
Dependency Manager Maven 3.9.9n
Framework version Spring Boot 3.4.4
Run parameters
Other configuration

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • My changes have been checked, personally or remotely, with @machacjozef
  • I have commented my code, particularly in hard-to-understand areas
  • I have resolved all conflicts with the target branch of the PR
  • I have updated and synced my code with the target branch
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes:
    • Lint test
    • Unit tests
    • Integration tests
  • I have checked my contribution with code analysis tools:
  • I have made corresponding changes to the documentation:
    • Developer documentation
    • User Guides
    • Migration Guides

Summary by CodeRabbit

  • New Features

    • MinIO storage now supports per-host bucket aliases and host-aware bucket resolution, so buckets can be mapped or defaulted automatically when not explicitly provided.
  • Chores

    • Removed unused imports and minor config cleanup.

Review Change Stack

- Extended `MinIoHostInfo` class to support `bucketAliases` mapping for enhanced bucket aliasing functionality.
- Updated `MinIoStorageService`:
  - Modified `createStorage` to attach bucket aliases dynamically based on the host.
  - Introduced `getMappedBucketIfExists` for resolving bucket aliases.
  - Adjusted `getBucketOrDefault` to work with the new alias mapping implementation.
- Minor refactoring and cleanup, such as removing unused annotations.
- updated resolution of mapped buckets
@renczesstefan renczesstefan self-assigned this May 4, 2026
@renczesstefan renczesstefan added improvement A change that improves on an existing feature Medium labels May 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 15d7a8b2-4e3c-4d45-9e02-92d788c26144

📥 Commits

Reviewing files that changed from the base of the PR and between c902dca and d6e6068.

📒 Files selected for processing (2)
  • application-engine/src/main/java/com/netgrif/application/engine/files/minio/MinIoStorageService.java
  • application-engine/src/main/resources/application-dev.yaml

Walkthrough

The pull request adds per-host bucket aliases to MinIO host configuration and updates MinIoStorageService to resolve buckets using host-aware alias mappings; two unused imports were removed.

Changes

MinIO Bucket Alias Resolution

Layer / File(s) Summary
Data shape and config
application-engine/src/main/java/com/netgrif/application/engine/files/minio/MinIoHostInfo.java, application-engine/src/main/resources/application-dev.yaml
MinIoHostInfo adds bucketAliases: Map<String, String> and application-dev.yaml adds a bucket-aliases mapping (pistucket: uat-pistucket).
Bucket resolution and storage creation
application-engine/src/main/java/com/netgrif/application/engine/files/minio/MinIoStorageService.java
createStorage(Data) now sets bucket via getBucketOrDefault(host, bucket) even when incoming bucket is null. getBucketOrDefault converted from static to instance (getBucketOrDefault(String host, String bucket)), and getMappedBucketIfExists(String host, String aliasKey) was added to consult per-host bucketAliases.
Cleanup
application-engine/src/main/java/com/netgrif/application/engine/files/minio/StorageConfigurationProperties.java, application-engine/src/main/java/com/netgrif/application/engine/startup/runner/StorageRunner.java
Removed unused imports.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'NAE-2406 S3 storage bucket alias' directly reflects the main change: adding bucket aliasing support to the MinIO storage configuration, as evidenced by the new bucketAliases field and alias mapping logic throughout the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@application-engine/src/main/java/com/netgrif/application/engine/files/minio/MinIoStorageService.java`:
- Around line 163-170: getMappedBucketIfExists performs four redundant calls to
properties.getMinIo().getHosts(host); cache the result in a local variable
(e.g., var hostConfig or hosts) at the start of the method and use that variable
in the null checks, getBucketAliases() call, containsKey(aliasKey) check and
get(aliasKey) retrieval inside getMappedBucketIfExists to avoid repeated
lookups.
- Around line 52-64: In createStorage in MinIoStorageService, the inner
null-check around data.getStorage().getBucket() prevents getBucketOrDefault from
applying the DEFAULT_BUCKET fallback; remove that inner if and always call
storage.setBucket(getBucketOrDefault(storage.getHost(),
data.getStorage().getBucket())) when data.getStorage().getHost() is non-null so
MinIoStorage.bucket is set (possibly to DEFAULT_BUCKET) as intended; keep the
existing enabled check (properties.getMinIo().isEnabled()) and
StorageNotEnabledException handling unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 876f6072-63f2-4039-9a40-24dded3e9005

📥 Commits

Reviewing files that changed from the base of the PR and between c627375 and c902dca.

📒 Files selected for processing (4)
  • application-engine/src/main/java/com/netgrif/application/engine/files/minio/MinIoHostInfo.java
  • application-engine/src/main/java/com/netgrif/application/engine/files/minio/MinIoStorageService.java
  • application-engine/src/main/java/com/netgrif/application/engine/files/minio/StorageConfigurationProperties.java
  • application-engine/src/main/java/com/netgrif/application/engine/startup/runner/StorageRunner.java
💤 Files with no reviewable changes (2)
  • application-engine/src/main/java/com/netgrif/application/engine/startup/runner/StorageRunner.java
  • application-engine/src/main/java/com/netgrif/application/engine/files/minio/StorageConfigurationProperties.java

- updated according to PR
@renczesstefan
Copy link
Copy Markdown
Member Author

@coderabbitai please recheck the PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Tip

For best results, initiate chat on the files or code changes.

@renczesstefan Sure! I'll recheck the PR right away.

[full_review]

@renczesstefan
Copy link
Copy Markdown
Member Author

@coderabbitai is there any other issue? You did not add new comments, but you are still requesting changes.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Review rate limit: 1/1 review remaining, available now.

@renczesstefan
Copy link
Copy Markdown
Member Author

@coderabbitai pls accept this if there is nothing to do.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

Let me check the current state of review comments before approving.


🏁 Script executed:

#!/bin/bash
# Check open review comments from coderabbitai on PR `#437`
gh pr view 437 --repo netgrif/application-engine --json reviews,reviewDecision,state

# List review comments from coderabbitai
gh api repos/netgrif/application-engine/pulls/437/comments --jq '.[] | select(.user.login == "coderabbitai[bot]") | {id: .id, body: .body, resolved: .resolved, path: .path, line: .line}'

# Also check pull request reviews
gh api repos/netgrif/application-engine/pulls/437/reviews --jq '.[] | select(.user.login == "coderabbitai[bot]") | {id: .id, state: .state, body: .body}'

Length of output: 12449


Let me verify the fixes in the current code before approving.


🏁 Script executed:

#!/bin/bash
# Read the current state of MinIoStorageService.java to verify both fixes
fd -e java -F 'MinIoStorageService.java' --exec cat {}

Length of output: 7154


@renczesstefan Both previously flagged issues have been properly addressed in commit d6e6068:

  1. DEFAULT_BUCKET fallback regression — The inner null guard around getBucket() has been removed, so getBucketOrDefault is now always called when a host is set, correctly falling back to DEFAULT_BUCKET when bucket is null. ✅
  2. Redundant getHosts(host) lookupsgetMappedBucketIfExists now caches the result in a local hostInfo variable, eliminating the four repeated lookups. ✅

Everything looks good — approving now!

[approve]

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@machacjozef machacjozef merged commit f91b9a8 into release/7.0.0-rev10 May 19, 2026
6 of 7 checks passed
@machacjozef machacjozef deleted the NAE-2406 branch May 19, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement A change that improves on an existing feature Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants