diff --git a/README.md b/README.md index 58545c0f74e..100452f8541 100644 --- a/README.md +++ b/README.md @@ -18,4 +18,4 @@ Documentation Want to contribute to MAS Command Line Interface? ------------------------------------------------------------------------------- We welcome every Maximo Application Suite users, developers and enthusiasts to contribute to the MAS Command Line Interface while fixing code issues and implementing new automated functionalities. -You can contribute to this collection by raising [a new issue](https://github.com/ibm-mas/cli/issues) with suggestions on how to make our MAS automation engine even better, or if you want to become a new code contributor, please refer to the [Contributing Guidelines](CONTRIBUTING.md) and learn more about how to get started. +You can contribute to this collection by raising [a new issue](https://github.com/ibm-mas/cli/issues) with suggestions on how to make our MAS automation engine even better, or if you want to become a new code contributor, please refer to the [Contributing Guidelines](CONTRIBUTING.md) and learn more about how to get started. \ No newline at end of file diff --git a/image/cli/app-root/src/run-playbook.sh b/image/cli/app-root/src/run-playbook.sh index 0e657ff1db6..dbc387e4572 100644 --- a/image/cli/app-root/src/run-playbook.sh +++ b/image/cli/app-root/src/run-playbook.sh @@ -25,8 +25,9 @@ if [ -n "$SLACK_TOKEN" ] && [ -n "$SLACK_CHANNEL" ]; then --action ansible-start \ --task-name "$DEVOPS_SUITE_NAME" \ --pipeline-name "${PIPELINERUN_NAME:-unknown}" \ - --instance-id "${DEVOPS_ENVIRONMENT:-}" || true - echo "# ----------------- Sending Start Notification Suite: $DEVOPS_SUITE_NAME | pipeline: $PIPELINE_NAME($PIPELINERUN_NAME) | Instance id: $DEVOPS_ENVIRONMENT -------------------- #" + --instance-id "${DEVOPS_ENVIRONMENT:-}" \ + --namespace "${PIPELINE_NAMESPACE:-}" || true + echo "# ----------------- Sending Start Notification Suite: $DEVOPS_SUITE_NAME | pipeline: $PIPELINE_NAME($PIPELINERUN_NAME) | Instance id: $DEVOPS_ENVIRONMENT -------------------- #" fi ansible-playbook ibm.mas_devops."$@" @@ -39,8 +40,9 @@ if [ -n "$SLACK_TOKEN" ] && [ -n "$SLACK_CHANNEL" ]; then --rc $rc \ --task-name "$DEVOPS_SUITE_NAME" \ --pipeline-name "${PIPELINERUN_NAME:-unknown}" \ - --instance-id "${DEVOPS_ENVIRONMENT:-}" || true - echo "# ----------------- Sending Start Notification Suite: $DEVOPS_SUITE_NAME | pipeline: $PIPELINE_NAME($PIPELINERUN_NAME) | Instance id: $DEVOPS_ENVIRONMENT -------------------- #" + --instance-id "${DEVOPS_ENVIRONMENT:-}" \ + --namespace "${PIPELINE_NAMESPACE:-}" || true + echo "# ----------------- Sending Start Notification Suite: $DEVOPS_SUITE_NAME | pipeline: $PIPELINE_NAME($PIPELINERUN_NAME) | Instance id: $DEVOPS_ENVIRONMENT -------------------- #" fi python3 /opt/app-root/src/save-junit-to-mongo.py diff --git a/image/cli/app-root/src/run-role.sh b/image/cli/app-root/src/run-role.sh index 3783ed2a311..dd8b737d191 100644 --- a/image/cli/app-root/src/run-role.sh +++ b/image/cli/app-root/src/run-role.sh @@ -15,14 +15,14 @@ python3 /opt/app-root/src/register-start.py export ROLE_NAME=$1 shift - # Send Slack start notification if configured if [ -n "$SLACK_TOKEN" ] && [ -n "$SLACK_CHANNEL" ]; then python3 /opt/app-root/bin/mas-devops-notify-slack \ --action ansible-start \ --task-name "$DEVOPS_SUITE_NAME" \ --pipeline-name "${PIPELINERUN_NAME:-unknown}" \ - --instance-id "${DEVOPS_ENVIRONMENT:-}" || true + --instance-id "${DEVOPS_ENVIRONMENT:-}" \ + --namespace "${PIPELINE_NAMESPACE:-}" || true echo "# ----------------- Sending Start Notification Suite: $DEVOPS_SUITE_NAME | pipeline: $PIPELINE_NAME($PIPELINERUN_NAME) | Instance id: $DEVOPS_ENVIRONMENT -------------------- #" fi @@ -36,7 +36,8 @@ if [ -n "$SLACK_TOKEN" ] && [ -n "$SLACK_CHANNEL" ]; then --rc $rc \ --task-name "$DEVOPS_SUITE_NAME" \ --pipeline-name "${PIPELINERUN_NAME:-unknown}" \ - --instance-id "${DEVOPS_ENVIRONMENT:-}" || true + --instance-id "${DEVOPS_ENVIRONMENT:-}" \ + --namespace "${PIPELINE_NAMESPACE:-}" || true echo "# ----------------- Sending Stop Notification Suite: $DEVOPS_SUITE_NAME | pipeline: $PIPELINE_NAME($PIPELINERUN_NAME) | Instance id: $DEVOPS_ENVIRONMENT -------------------- #" fi diff --git a/python/src/mas/cli/aiservice/install/app.py b/python/src/mas/cli/aiservice/install/app.py index 92ccae34dde..81c8707f96b 100644 --- a/python/src/mas/cli/aiservice/install/app.py +++ b/python/src/mas/cli/aiservice/install/app.py @@ -55,7 +55,6 @@ from mas.devops.tekton import ( installOpenShiftPipelines, updateTektonDefinitions, - prepareAiServicePipelinesNamespace, prepareInstallSecrets, testCLI, launchInstallPipeline @@ -582,13 +581,6 @@ def install(self, argv): with Halo(text=f'Preparing namespace ({pipelinesNamespace})', spinner=self.spinner) as h: createNamespace(self.dynamicClient, pipelinesNamespace) - prepareAiServicePipelinesNamespace( - dynClient=self.dynamicClient, - instanceId=self.getParam("aiservice_instance_id"), - storageClass=self.pipelineStorageClass, - accessMode=self.pipelineStorageAccessMode, - configureRBAC=(self.getParam("service_account_name") == "") - ) prepareInstallSecrets( dynClient=self.dynamicClient, namespace=pipelinesNamespace, diff --git a/python/src/mas/cli/aiservice/install/argParser.py b/python/src/mas/cli/aiservice/install/argParser.py index 38e054aa4e4..0fa543a82b4 100644 --- a/python/src/mas/cli/aiservice/install/argParser.py +++ b/python/src/mas/cli/aiservice/install/argParser.py @@ -563,6 +563,18 @@ def isValidFile(parser, arg) -> str: required=False, help="Run the install pipeline under a custom service account (also disables creation of the default 'pipeline' service account)", ) +otherArgGroup.add_argument( + "--slack-token", + dest="slack_token", + required=False, + help="Slack bot token for sending pipeline notifications" +) +otherArgGroup.add_argument( + "--slack-channel", + dest="slack_channel", + required=False, + help="Slack channel(s) for notifications (comma-separated for multiple channels)" +) otherArgGroup.add_argument( "-h", "--help", diff --git a/python/src/mas/cli/aiservice/install/params.py b/python/src/mas/cli/aiservice/install/params.py index 30c3285f8ca..bc216a854d3 100644 --- a/python/src/mas/cli/aiservice/install/params.py +++ b/python/src/mas/cli/aiservice/install/params.py @@ -101,6 +101,7 @@ "rsl_token", "rsl_ca_crt", "environment_type", + "configure_aiassistant", # Certificate Issuer "aiservice_certificate_issuer", diff --git a/python/src/mas/cli/aiservice/upgrade/argParser.py b/python/src/mas/cli/aiservice/upgrade/argParser.py index 66270a0ac33..b56740e4bde 100644 --- a/python/src/mas/cli/aiservice/upgrade/argParser.py +++ b/python/src/mas/cli/aiservice/upgrade/argParser.py @@ -61,6 +61,18 @@ default=False, help="Configure upgrade for development mode", ) +otherArgGroup.add_argument( + "--slack-token", + dest="slack_token", + required=False, + help="Slack bot token for sending pipeline notifications" +) +otherArgGroup.add_argument( + "--slack-channel", + dest="slack_channel", + required=False, + help="Slack channel(s) for notifications (comma-separated for multiple channels)" +) otherArgGroup.add_argument( '-h', "--help", action='help', diff --git a/python/src/mas/cli/install/app.py b/python/src/mas/cli/install/app.py index abab1d6e0ad..edf7eedc7f9 100644 --- a/python/src/mas/cli/install/app.py +++ b/python/src/mas/cli/install/app.py @@ -1880,7 +1880,14 @@ def nonInteractiveMode(self) -> None: self.setParam("manage_bind_aiservice_tenant_id", "user") elif key == "configure_aiassistant": if value is not None and value != "": - self.setParam("configure_aiassistant", value) + # Convert boolean-like values to "pipeline" or "none" + if value in ["true", "True", "TRUE", "1", "yes", "Yes", "YES"]: + self.setParam("configure_aiassistant", "pipeline") + elif value in ["false", "False", "FALSE", "0", "no", "No", "NO"]: + self.setParam("configure_aiassistant", "none") + else: + # Use the value as-is (should be "pipeline", "none", or "configure") + self.setParam("configure_aiassistant", value) elif key == "manage_bind_aiservice_instance_id": # only set if AI Service not being installed if not vars(self.args).get("aiservice_instance_id") and value is not None and value != "": diff --git a/python/src/mas/cli/install/argBuilder.py b/python/src/mas/cli/install/argBuilder.py index 3982a62b29c..ffd8a4ad0d8 100644 --- a/python/src/mas/cli/install/argBuilder.py +++ b/python/src/mas/cli/install/argBuilder.py @@ -226,6 +226,8 @@ def buildCommand(self) -> str: command += f" --facilities-channel \"{self.getParam('mas_app_channel_facilities')}\"{newline}" if self.installAIService: command += f" --aiservice-channel \"{self.getParam('aiservice_channel')}\"{newline}" + if self.getParam('configure_aiassistant') != "": + command += f" --configure-aiassistant \"{self.getParam('configure_aiassistant')}\"{newline}" # Arcgis # ----------------------------------------------------------------------------- diff --git a/python/src/mas/cli/install/params.py b/python/src/mas/cli/install/params.py index c44424da6a7..9bbc033b751 100644 --- a/python/src/mas/cli/install/params.py +++ b/python/src/mas/cli/install/params.py @@ -217,6 +217,7 @@ "rsl_token", "rsl_ca_crt", "environment_type", + "configure_aiassistant", # Certificate Issuer "aiservice_certificate_issuer", diff --git a/python/src/mas/cli/mirror/config.py b/python/src/mas/cli/mirror/config.py index 90265b24578..5bb35982790 100644 --- a/python/src/mas/cli/mirror/config.py +++ b/python/src/mas/cli/mirror/config.py @@ -16,6 +16,7 @@ ("Optional Dependencies", "aiservice", "ibm-aiservice", "aiservice_version"), ("Optional Dependencies", "aiservice", "ibm-aiservice-tenant", "aiservice_version"), + ("Optional Dependencies", "odh", "opendatahub", "odh_version"), ("Optional Dependencies", "data-dictionary", "ibm-data-dictionary", "dd_version"), diff --git a/python/test/aiservice/install/test_app.py b/python/test/aiservice/install/test_app.py index fea867b99e1..f9c7f0b9aa9 100644 --- a/python/test/aiservice/install/test_app.py +++ b/python/test/aiservice/install/test_app.py @@ -53,7 +53,6 @@ def test_install_noninteractive(tmpdir): mock.patch('mas.cli.aiservice.install.app.getCurrentCatalog') as get_current_catalog, mock.patch('mas.cli.aiservice.install.app.installOpenShiftPipelines'), mock.patch('mas.cli.aiservice.install.app.updateTektonDefinitions'), - mock.patch('mas.cli.aiservice.install.app.prepareAiServicePipelinesNamespace'), mock.patch('mas.cli.aiservice.install.app.launchInstallPipeline') as launch_ai_service_install_pipeline ): dynamic_client_class.return_value = dynamic_client @@ -148,7 +147,6 @@ def test_install_interactive_advanced(tmpdir): mock.patch('mas.cli.aiservice.install.app.getCurrentCatalog') as get_current_catalog, mock.patch('mas.cli.aiservice.install.app.installOpenShiftPipelines'), mock.patch('mas.cli.aiservice.install.app.updateTektonDefinitions'), - mock.patch('mas.cli.aiservice.install.app.prepareAiServicePipelinesNamespace'), mock.patch('mas.cli.aiservice.install.app.launchInstallPipeline') as launch_ai_service_install_pipeline, mock.patch('mas.cli.cli.isSNO') as is_sno, mock.patch('mas.cli.displayMixins.prompt') as mixins_prompt, @@ -278,7 +276,6 @@ def test_install_interactive_simplified(tmpdir): mock.patch('mas.cli.aiservice.install.app.getCurrentCatalog') as get_current_catalog, mock.patch('mas.cli.aiservice.install.app.installOpenShiftPipelines'), mock.patch('mas.cli.aiservice.install.app.updateTektonDefinitions'), - mock.patch('mas.cli.aiservice.install.app.prepareAiServicePipelinesNamespace'), mock.patch('mas.cli.aiservice.install.app.launchInstallPipeline') as launch_ai_service_install_pipeline, mock.patch('mas.cli.cli.isSNO') as is_sno, mock.patch('mas.cli.displayMixins.prompt') as mixins_prompt, diff --git a/python/test/utils/install_test_helper.py b/python/test/utils/install_test_helper.py index a398b3cb803..65984640118 100644 --- a/python/test/utils/install_test_helper.py +++ b/python/test/utils/install_test_helper.py @@ -282,11 +282,9 @@ def run_install_test(self): from mas.cli.aiservice.install.app import AiServiceInstallApp app_class = AiServiceInstallApp app_module = 'mas.cli.aiservice.install.app' - prepare_namespace_func = 'prepareAiServicePipelinesNamespace' else: app_class = InstallApp app_module = 'mas.cli.install.app' - prepare_namespace_func = 'preparePipelinesNamespace' self.setup_test_files() self.start_watchdog() @@ -305,7 +303,6 @@ def run_install_test(self): mock.patch(f'{app_module}.installOpenShiftPipelines'), mock.patch(f'{app_module}.updateTektonDefinitions'), mock.patch(f'{app_module}.createNamespace'), - mock.patch(f'{app_module}.{prepare_namespace_func}'), mock.patch(f'{app_module}.launchInstallPipeline') as launch_install_pipeline, mock.patch('mas.cli.install.app.configureIngressForPathBasedRouting') as configure_ingress, mock.patch('mas.cli.cli.isSNO') as is_sno, diff --git a/python/test/utils/mirror_test_helper.py b/python/test/utils/mirror_test_helper.py index c9bf106f3ee..659e528877b 100644 --- a/python/test/utils/mirror_test_helper.py +++ b/python/test/utils/mirror_test_helper.py @@ -180,6 +180,7 @@ def setup_mocks(self): 'db2u_version': '11.5.9.0+123', 'amlen_extras_version': '1.0.0', 'aiservice_version': {'9.1.x': '1.0.0'}, + 'odh_version': '2.32.0', 'dd_version': '1.0.0', 'mongo_extras_version_default': '6.0.0', 'couchdb_version': '1.0.13', diff --git a/tekton/src/params/install-aiservice.yml.j2 b/tekton/src/params/install-aiservice.yml.j2 index d415bf930d2..4d87d68f76a 100644 --- a/tekton/src/params/install-aiservice.yml.j2 +++ b/tekton/src/params/install-aiservice.yml.j2 @@ -20,6 +20,10 @@ type: string description: Environment type default: "" +- name: configure_aiassistant + type: string + description: Configure AI Assistant integration + default: "" # MAS Application Configuration - IBM Maximo AI Service - S3 # ----------------------------------------------------------------------------- @@ -172,4 +176,4 @@ - name: aiservice_certificate_issuer type: string description: Name of the Issuer to configure AI Service to issue certificates - default: "" + default: "" \ No newline at end of file diff --git a/tekton/src/pipelines/mas-install.yml.j2 b/tekton/src/pipelines/mas-install.yml.j2 index cc064cbb1df..e091ec8eee8 100644 --- a/tekton/src/pipelines/mas-install.yml.j2 +++ b/tekton/src/pipelines/mas-install.yml.j2 @@ -505,6 +505,9 @@ spec: - input: "$(params.aiservice_channel)" operator: notin values: [""] + - input: "$(params.configure_aiassistant)" + operator: in + values: ["pipeline"] # 15. Verify health of the cluster before we consider the install complete # -------------------------------------------------------------------------