Skip to content
Merged
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
21 changes: 12 additions & 9 deletions hack/testing-olm-upgrade/upgrade-common
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ EOL
fi

log::info "Waiting for deployment $name to be ready in $ns"
wait_for_deployment_to_be_ready "$ns" "$name" $((2 * "$minute"))
wait_for_deployment_to_be_ready "$ns" "$name" $((2 * $minute))
}

wait_for_deployment_to_be_ready(){
Expand Down Expand Up @@ -397,15 +397,18 @@ discover_versions(){
major_version="$(echo $full_version | cut -d'.' -f1)"
minor_version="$(echo $full_version | cut -d'.' -f2)"

# we shouldn't run into this yet... maybe for 6.0 but we should like
# add the 'Replaces' spec field and use that for the previous_version
if [[ $minor_version -eq 0 ]]; then
log::info "Will be unable to calculate the previous_version since our minor version is 0"
exit 0
export version="$(echo $major_version.$minor_version)"

# Hard rewrite of 5.0.0 to superficial 4.7.0, as replacement for
# the breaking point when OpenShift Logging shifted release schema.
if [[ $major_version -eq 5 ]] && [[ $minor_version -eq 0 ]]; then
# Set this to 4.7 because we need to calculate the latest previous
# version prior to 5.0, which is 4.6 for OpenShift Logging.
major_version=4
minor_version=7
Copy link
Contributor

Choose a reason for hiding this comment

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

previous version should be 4.7 or 4.6?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previous to 5.0 is 4.6, but in order to calculate that via get_latests_previous_version in need to fake 5.0 as 4.7. The whole block should be removed in master.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok

Copy link
Contributor

@ewolinetz ewolinetz Mar 5, 2021

Choose a reason for hiding this comment

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

i think the fix should instead happen in the "get_latest_previous_version"
this feels like a hacky way to resolve this...

it also means that we are dependent on the 4.7 manifest being in our branch for this to work...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No we are not dependent to 4.7 manifest. We only pretend 5.0 to be 4.7 for the sake of this bash sourcery. The version 4.7 is used for calculation of 4.6 to create Subscription using operatorhub.

fi

export version="$(echo $major_version.$minor_version)"
Copy link
Contributor

Choose a reason for hiding this comment

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

I see the export above the if block, but it serves the same purpose as it would if we exported it here after the if block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No it is not! The export version should be set to 5.0 so that the upgrade bash sourcery can patch the subscription. However get_latest_previous_version needs the value 4.7 to calculate 4.6 as the previous version and in turn create the initial subscription.

get_latest_previous_version $version
get_latest_previous_version "$(echo $major_version.$minor_version)"
}

get_es_pods_count() {
Expand Down Expand Up @@ -491,7 +494,7 @@ deploy_previous_version() {

# deploy elasticsearch-operator
log::info "Deploying elasticsearch-operator ${previous_version} from marketplace..."
deploy_marketplace_operator "openshift-operators-redhat" "elasticsearch-operator" "$previous_version" "elasticsearch-operator"
deploy_marketplace_operator "openshift-operators-redhat" "elasticsearch-operator" "$previous_version" "elasticsearch-operator" true

# check if the operator is running
log::info "Verifying if elasticsearch-operator deployment is ready..."
Expand Down