Skip to content
Open
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
38 changes: 38 additions & 0 deletions python/src/mas/cli/install/settings/aiSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,41 @@ def generateAiCfg(self, instanceId: str, scope: str, destination: str, workspace

def configAi(self, silentMode=False) -> None:
"""Configure AiCfg for MAS installation"""

# FIRST: Check MAS version - AiCfg is only supported in MAS 9.2+
# This must be done BEFORE checking user preferences to prevent errors on 9.1
mas_channel = self.getParam("mas_channel")
is_mas_92_or_later = False

if mas_channel:
try:
# Extract major.minor version (e.g., "9.2" from "9.2.0")
version_parts = mas_channel.split(".")
if len(version_parts) >= 2:
major = int(version_parts[0])
minor = int(version_parts[1])
is_mas_92_or_later = (major > 9) or (major == 9 and minor >= 2)
except (ValueError, IndexError):
pass

# If MAS 9.1 or earlier, force disable AiCfg regardless of user input
if not is_mas_92_or_later:
if not silentMode:
self.printH1("Configure AiCfg")
self.printDescription(
[
"⚠️ IMPORTANT: AiCfg is only available in MAS 9.2 and later.",
f" Your MAS channel is: {mas_channel or 'not set'}",
"",
"AiCfg configuration will be skipped.",
"If you upgrade to MAS 9.2+ in the future, you can configure AiCfg then.",
]
)
self.setParam("configure_aiassistant", "none")
print_formatted_text("⚠️ AiCfg configuration skipped (requires MAS 9.2+)")
return

# MAS 9.2+ - proceed with normal configuration
if not silentMode:
self.printH1("Configure AiCfg")
self.printDescription(
Expand Down Expand Up @@ -165,3 +200,6 @@ def configAi(self, silentMode=False) -> None:
else:
self.setParam("configure_aiassistant", "none")
print_formatted_text("AiCfg configuration skipped")


# Made with Bob
6 changes: 2 additions & 4 deletions python/test/install/test_dev_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ def test_install_master_dev_mode(tmpdir):
# 14. Kafka configuration
".*Create system Kafka instance.*": lambda msg: "y",
".*Kafka version.*": lambda msg: "3.8.0",
# 14. AiCfg configuration
".*Do you want to configure AiCfg.*": lambda msg: "n",
# 14. AiCfg configuration - SKIPPED for MAS 9.1 (only available in 9.2+)
# 15. Final confirmation
".*Use additional configurations.*": lambda msg: "n",
".*Proceed with these settings.*": lambda msg: "y",
Expand Down Expand Up @@ -193,8 +192,7 @@ def test_install_master_dev_mode_existing_catalog(tmpdir):
# 14. Kafka configuration
".*Create system Kafka instance.*": lambda msg: "y",
".*Kafka version.*": lambda msg: "3.8.0",
# 14. AiCfg configuration
".*Do you want to configure AiCfg.*": lambda msg: "n",
# 14. AiCfg configuration - SKIPPED for MAS 9.1 (only available in 9.2+)
# 15. Final confirmation
".*Use additional configurations.*": lambda msg: "n",
".*Proceed with these settings.*": lambda msg: "y",
Expand Down
3 changes: 1 addition & 2 deletions python/test/install/test_existing_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ def test_install_interactive_existing_catalog(tmpdir):
".*Create MongoDb cluster.*": lambda msg: "y",
# 14. Db2 configuration
".*Create Manage dedicated Db2 instance.*": lambda msg: "y",
# 14. AiCfg configuration
".*Do you want to configure AiCfg.*": lambda msg: "n",
# 14. AiCfg configuration - SKIPPED for MAS 9.1 (only available in 9.2+)
# 15. Final confirmation
".*Use additional configurations.*": lambda msg: "n",
".*Proceed with these settings.*": lambda msg: "y",
Expand Down
3 changes: 1 addition & 2 deletions python/test/install/test_no_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ def test_install_interactive_no_catalog(tmpdir):
# 14. Kafka configuration
".*Create system Kafka instance.*": lambda msg: "y",
".*Kafka version.*": lambda msg: "3.8.0",
# 15. AiCfg configuration
".*Do you want to configure AiCfg.*": lambda msg: "n",
# 15. AiCfg configuration - SKIPPED for MAS 9.1 (only available in 9.2+)
# 16. Final confirmation
".*Use additional configurations.*": lambda msg: "n",
".*Proceed with these settings.*": lambda msg: "y",
Expand Down
5 changes: 5 additions & 0 deletions tekton/src/pipelines/mas-install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,8 @@ spec:

# 14.2 Generate AiCfg with auto-detected values
# -------------------------------------------------------------------------
# Note: AiCfg CRD is only available in MAS 9.2+, so we guard this task
# to prevent errors on MAS 9.1 clusters
{{ lookup('template', pipeline_src_dir ~ '/taskdefs/aiservice/gencfg-aiservice.yml.j2') | indent(4) }}
runAfter:
- aiservice
Expand All @@ -508,6 +510,9 @@ spec:
- input: "$(params.configure_aiassistant)"
operator: in
values: ["pipeline"]
- input: "$(params.mas_channel)"
operator: notin
values: ["", "9.0.*", "9.1.*"]

# 15. Verify health of the cluster before we consider the install complete
# -------------------------------------------------------------------------
Expand Down
Loading