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

improve the option to upgrade from a previous rhoai version to a newer one on selfmanaged cluster #2011

Open
wants to merge 2 commits into
base: releases/2.10.0
Choose a base branch
from

Conversation

kobihk
Copy link
Contributor

@kobihk kobihk commented Nov 7, 2024

In this MR I updated the upgrade logic to be able to run upgrade of our rhoai operator in case of:

  • CLUSTER_TYPE: selfmanaged
  • TEST_ENVIRONMENT: PSI
  • RHODS_DEPLOYMENT_TYPE: OperatorHub

Related to Jira ticket: RHOAIENG-2720

Signed-off-by: Kobi Hakimi [email protected]

@kobihk kobihk self-assigned this Nov 7, 2024
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Robocop found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Contributor

github-actions bot commented Nov 7, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
491 0 0 491 100

@kobihk kobihk changed the title add the option to install previous rhoai version on psi operatorhub t… improve the option to upgrade from a previous rhoai version to a newer one on selfmanaged cluster Nov 7, 2024
@@ -155,7 +155,7 @@ Get RHODS Version
${RHODS_VERSION}= Run oc get csv -n ${OPERATOR_NAMESPACE} | grep "opendatahub" | awk -F ' {2,}' '{print $3}'
END
END
Log Product:${PRODUCT} Version:${RHODS_VERSION}
Log To Console Product:${PRODUCT} Version:${RHODS_VERSION}
Copy link
Contributor

Choose a reason for hiding this comment

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

you can do both things by adding "console=yes" in the Log parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like the descriptive keyword
Unless there is an advantage by using the param "console=yes"

Copy link
Contributor

Choose a reason for hiding this comment

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

Log to console doesn't log in the HTML report no? while Log with console=yes does both

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good to know :)
I'll update it.
Thank you!!

${csv_created}= Run Process oc get csv --no-headers -n ${operators_namespace} | awk '/${display_name}/ {print \$1}' shell=yes
IF "${csv_created.stdout}" == "${EMPTY}" CONTINUE
Log To Console The Result of csv_created Output is: ${csv_created.stdout} RC: ${csv_created.rc}
IF '$csv_created.stdout' == '${EMPTY}' CONTINUE
Copy link
Contributor

Choose a reason for hiding this comment

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

why changing from "${csv_created.stdout}" to '$csv_created.stdout'? it is a regular string check, the original version should work just fine

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did it because of this error:

Variables in the original expression ''${csv_created.stdout}' == '${EMPTY}'' were resolved before the expression was evaluated. Try using ''$csv_created.stdout' == '$EMPTY'' syntax to avoid that. See Evaluating Expressions appendix in Robot Framework User Guide for more details.

Copy link
Contributor

Choose a reason for hiding this comment

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

but this is not a new code, was it broken before?

IF ${csv_ready.rc} == ${0} BREAK
END

Check For Resource Exist In Command Output
Copy link
Contributor

Choose a reason for hiding this comment

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

it's actually running the command, not just checking the output

Run Command And Fail If Output Is Empty maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the Keyword name and I also added doc string to make it clear

Comment on lines 32 to 34
IF "${RHOAI_VERSION}" != "${EMPTY}"
${rhoai_version} = Set Variable ${RHOAI_VERSION}
END
Copy link
Contributor

Choose a reason for hiding this comment

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

cannot you just pass ${RHOAI_VERSION} to the next line? Also, is RHOAI version is actually empty, next line may fail because the ${rhoai_version} variable wouldn't exist

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds reasonable :)

IF ${patch_status} == 0
Log To Console Approving the installplan ${installplan_name} successfully!!
ELSE
Log To Console Failed to approving the installplan ${installplan_name}
Copy link
Contributor

Choose a reason for hiding this comment

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

why not FAIL here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Comment on lines +265 to +267
data["CLUSTER_TYPE"] = config_data["CLUSTER_TYPE"]
data["TEST_ENV"] = config_data["TEST_ENV"]
data["INSTALL_TYPE"] = config_data["INSTALL_TYPE"] if config_data.get("INSTALL_TYPE") else "OperatorHub"
Copy link
Contributor

Choose a reason for hiding this comment

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

we haven't had need for it so far, why this is necessary now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it would be better to add them to the test config file instead of sending them each time like we are doing in:
https://gitlab.cee.redhat.com/ods/jenkins/-/blob/master/vars/deployRhoaiOperator.groovy?ref_type=heads#L110-180

Copy link
Contributor

Choose a reason for hiding this comment

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

in your pr for CI, it is still passing the parameter, so maybe this change is not necessary now. Up to you, important thing is that we don't introduce new regression risk for things we won't use

@kobihk kobihk force-pushed the add_option_for_rhoai_upgrade_2.10.0 branch from d6bf3c8 to 3547f04 Compare November 26, 2024 14:03
Copy link

sonarcloud bot commented Nov 26, 2024

@kobihk kobihk requested a review from bdattoma November 26, 2024 14:04
@kobihk kobihk added the verified This PR has been tested with Jenkins label Nov 26, 2024
# In case of upgrade there are 2 operators, we need to wait until only one will be available
${lines}= Split String ${csv_created.stdout} \n
${line_count}= Get Length ${lines}
IF ${line_count} > 1 CONTINUE
${csv_ready}= Run Process
... oc wait --timeout\=${timeout} --for jsonpath\='{.status.phase}'\=Succeeded csv -n ${operators_namespace} ${csv_created.stdout} shell=yes
Copy link
Contributor

Choose a reason for hiding this comment

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

hm shouldn't you pass the CSV name as well?

Log To Console ${resource_type} ${resource_name} in the namespace ${namespace} attribute ${attribute_path} value is EMPTY
END
RETURN ${value}

Wait For Installplan And Approve It
[Documentation] Wait for the operator's installplan to appear then approve it in case of Manual installplan approval
Copy link
Contributor

Choose a reason for hiding this comment

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

WHILE "${installplan_name}" == "${EMPTY}" limit=5m

could you check if we could re-use code instead of creating a new keyword?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
verified This PR has been tested with Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants