diff --git a/python/src/mas/cli/install/settings/aiSettings.py b/python/src/mas/cli/install/settings/aiSettings.py index 05a7764557..72189f16d6 100644 --- a/python/src/mas/cli/install/settings/aiSettings.py +++ b/python/src/mas/cli/install/settings/aiSettings.py @@ -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( @@ -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 diff --git a/python/test/install/test_dev_mode.py b/python/test/install/test_dev_mode.py index 072c815391..7ba76d6691 100644 --- a/python/test/install/test_dev_mode.py +++ b/python/test/install/test_dev_mode.py @@ -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", @@ -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", diff --git a/python/test/install/test_existing_catalog.py b/python/test/install/test_existing_catalog.py index 00ae8831aa..7c8f5960b8 100644 --- a/python/test/install/test_existing_catalog.py +++ b/python/test/install/test_existing_catalog.py @@ -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", diff --git a/python/test/install/test_no_catalog.py b/python/test/install/test_no_catalog.py index 67101a7c35..caea1d5e76 100644 --- a/python/test/install/test_no_catalog.py +++ b/python/test/install/test_no_catalog.py @@ -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", diff --git a/tekton/src/pipelines/mas-install.yml.j2 b/tekton/src/pipelines/mas-install.yml.j2 index 83f6cb13f3..ebe18ca448 100644 --- a/tekton/src/pipelines/mas-install.yml.j2 +++ b/tekton/src/pipelines/mas-install.yml.j2 @@ -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 @@ -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 # -------------------------------------------------------------------------