Skip to content
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

[patch] Provide CLI automation to upgrade CPD v4.8 installations to v5.0 #1270

Merged
merged 17 commits into from
Oct 2, 2024
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
1 change: 1 addition & 0 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ jobs:
wget --header="Authorization:Bearer $ARTIFACTORY_TOKEN" $ARTIFACTORY_GENERIC_RELEASE_URL/ibm-mas/ansible-devops/latest/ibm-mas_devops-latest.tar.gz -O $GITHUB_WORKSPACE/image/cli/install/ibm-mas_devops.tar.gz
fi


# 3. Download Built Artifacts
# -------------------------------------------------------------------------------------------
- name: Download the tekton file built in the other job
Expand Down
29 changes: 22 additions & 7 deletions python/src/mas/cli/update/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def update(self, argv):
"""
self.args = updateArgParser.parse_args(args=argv)
self.noConfirm = self.args.no_confirm
self.devMode = self.args.dev_mode

if self.args.mas_catalog_version:
# Non-interactive mode
Expand All @@ -53,7 +54,13 @@ def update(self, argv):
"dro_migration",
"dro_storage_class",
"dro_namespace",
"skip_pre_check"
"skip_pre_check",
"dev_mode",
"cpd_product_version",
# Dev Mode
"artifactory_username",
"artifactory_token"

]
for key, value in vars(self.args).items():
# These fields we just pass straight through to the parameters and fail if they are not set
Expand Down Expand Up @@ -92,7 +99,8 @@ def update(self, argv):
self.chooseCatalog()

# Validations
self.validateCatalog()
if not self.devMode:
self.validateCatalog()

self.printH1("Dependency Update Checks")
with Halo(text='Checking for IBM Watson Discovery', spinner=self.spinner) as h:
Expand Down Expand Up @@ -333,13 +341,18 @@ def detectMongoDb(self) -> None:
# the case bundles in there anymore
# Longer term we will centralise this information inside the mas-devops python collection,
# where it can be made available to both the ansible collection and this python package.
defaultMongoVersion = "6.0.12"
mongoVersions = {
"v9-240625-amd64": "6.0.12",
"v9-240730-amd64": "6.0.12",
"v9-240827-amd64": "6.0.12"
}
catalogVersion = self.getParam('mas_catalog_version')
if catalogVersion in mongoVersions:
targetMongoVersion = mongoVersions[self.getParam('mas_catalog_version')]
else:
targetMongoVersion = defaultMongoVersion

targetMongoVersion = mongoVersions[self.getParam('mas_catalog_version')]
self.setParam("mongodb_version", targetMongoVersion)

targetMongoVersionMajor = targetMongoVersion.split(".")[0]
Expand Down Expand Up @@ -454,8 +467,7 @@ def detectCP4D(self) -> bool:
cp4dVersions = {
"v9-240625-amd64": "4.8.0",
"v9-240730-amd64": "4.8.0",
"v9-240827-amd64": "4.8.0"

"v9-240827-amd64": "4.8.0"
}

with Halo(text='Checking for IBM Cloud Pak for Data', spinner=self.spinner) as h:
Expand All @@ -476,7 +488,10 @@ def detectCP4D(self) -> bool:
if len(cpds) > 0:
cpdInstanceNamespace = cpds[0]["metadata"]["namespace"]
cpdInstanceVersion = cpds[0]["spec"]["version"]
cpdTargetVersion = cp4dVersions[self.getParam("mas_catalog_version")]
if self.args.cpd_product_version:
cpdTargetVersion = self.getParam("cpd_product_version")
else:
cpdTargetVersion = cp4dVersions[self.getParam("mas_catalog_version")]

currentCpdVersionMajorMinor = f"{cpdInstanceVersion.split('.')[0]}.{cpdInstanceVersion.split('.')[1]}"
targetCpdVersionMajorMinor = f"{cpdTargetVersion.split('.')[0]}.{cpdTargetVersion.split('.')[1]}"
Expand All @@ -492,7 +507,7 @@ def detectCP4D(self) -> bool:
"<u>Dependency Update Notice</u>",
f"Cloud Pak For Data is currently running version {cpdInstanceVersion} and will be updated to version {cpdTargetVersion}",
"It is recommended that you backup your Cloud Pak for Data instance before proceeding:",
" <u>https://www.ibm.com/docs/en/cloud-paks/cp-data/4.8.x?topic=administering-backing-up-restoring-cloud-pak-data</u>"
" <u>https://www.ibm.com/docs/en/cloud-paks/cp-data/5.0.x?topic=administering-backing-up-restoring-cloud-pak-data</u>"
])

# Lookup the storage classes already used by CP4D
Expand Down
28 changes: 28 additions & 0 deletions python/src/mas/cli/update/argParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,36 @@
help="Set Custom Namespace for DRO(Default: redhat-marketplace)",
)

# Development Mode
# -----------------------------------------------------------------------------
devArgGroup = updateArgParser.add_argument_group("Development Mode")
devArgGroup.add_argument(
"--artifactory-username",
required=False,
help="Username for access to development builds on Artifactory"
)
devArgGroup.add_argument(
"--artifactory-token",
required=False,
help="API Token for access to development builds on Artifactory"
)

# More Options
# -----------------------------------------------------------------------------
otherArgGroup = updateArgParser.add_argument_group('More')
otherArgGroup.add_argument(
"--dev-mode",
required=False,
action="store_true",
default=False,
help="Configure installation for development mode",
)
otherArgGroup.add_argument(
"--cp4d-version",
dest="cpd_product_version",
required=False,
help="Product version of CP4D to use"
)
otherArgGroup.add_argument(
'--no-confirm',
required=False,
Expand Down
5 changes: 4 additions & 1 deletion tekton/src/params/install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@
- name: cpd_install_cognos
type: string
default: ""

- name: cpd_install_all
type: string
default: ""

# Dependencies - UDS
# -----------------------------------------------------------------------------
- name: uds_contact_email
Expand Down
1 change: 1 addition & 0 deletions tekton/src/pipelines/install.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ spec:
{{ lookup('template', pipeline_src_dir ~ '/taskdefs/cp4d/cp4d-platform.yml.j2') | indent(4) }}
runAfter:
- cert-manager
- ibm-catalogs

# 3.2 Watson Studio
{{ lookup('template', pipeline_src_dir ~ '/taskdefs/cp4d/cp4d-wsl.yml.j2') | indent(4) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
name: mas-devops-cp4d-service
# Only needed if Predict is being installed
when:
- input: "$(params.mas_app_channel_predict)"
- input: "$(params.mas_app_channel_predict)$(params.cpd_install_all)"
operator: notin
values: [""]
- input: "$(params.cpd_install_openscale)"
Expand Down
2 changes: 1 addition & 1 deletion tekton/src/pipelines/taskdefs/cp4d/cp4d-cognos.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
name: mas-devops-cp4d-service
# Only needed if Manage is being installed and Cognos is chosen to be installed
when:
- input: "$(params.mas_app_channel_manage)"
- input: "$(params.mas_app_channel_manage)$(params.cpd_install_all)"
operator: notin
values: [""]
- input: "$(params.cpd_install_cognos)"
Expand Down
2 changes: 1 addition & 1 deletion tekton/src/pipelines/taskdefs/cp4d/cp4d-platform.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
name: mas-devops-cp4d
# Only needed if either Predict, Assist, Health w/ WSL, or Cognos are being installed
when:
- input: "$(params.mas_app_channel_predict)$(params.mas_app_channel_assist)$(params.mas_appws_bindings_health_wsl_flag)$(params.cpd_install_cognos)"
- input: "$(params.mas_app_channel_predict)$(params.mas_app_channel_assist)$(params.mas_appws_bindings_health_wsl_flag)$(params.cpd_install_cognos)$(params.cpd_install_all)"
operator: notin
values: [""]
2 changes: 1 addition & 1 deletion tekton/src/pipelines/taskdefs/cp4d/cp4d-spark.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
name: mas-devops-cp4d-service
# Only needed if Predict is being installed
when:
- input: "$(params.mas_app_channel_predict)"
- input: "$(params.mas_app_channel_predict)$(params.cpd_install_all)"
operator: notin
values: [""]
workspaces:
Expand Down
2 changes: 1 addition & 1 deletion tekton/src/pipelines/taskdefs/cp4d/cp4d-spss.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
name: mas-devops-cp4d-service
# Only needed if Predict is being installed
when:
- input: "$(params.mas_app_channel_predict)"
- input: "$(params.mas_app_channel_predict)$(params.cpd_install_all)"
operator: notin
values: [""]
- input: "$(params.cpd_install_spss)"
Expand Down
2 changes: 1 addition & 1 deletion tekton/src/pipelines/taskdefs/cp4d/cp4d-wml.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
name: mas-devops-cp4d-service
# Only needed if Predict is being installed
when:
- input: "$(params.mas_app_channel_predict)"
- input: "$(params.mas_app_channel_predict)$(params.cpd_install_all)"
operator: notin
values: [""]
workspaces:
Expand Down
2 changes: 1 addition & 1 deletion tekton/src/pipelines/taskdefs/cp4d/cp4d-wsl.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
name: mas-devops-cp4d-service
# Only needed if either Predict or Health w/ WSL are being installed
when:
- input: "$(params.mas_app_channel_predict)$(params.mas_appws_bindings_health_wsl_flag)"
- input: "$(params.mas_app_channel_predict)$(params.mas_appws_bindings_health_wsl_flag)$(params.cpd_install_all)"
operator: notin
values: [""]
workspaces:
Expand Down