Bug 2051267

Summary: When 'oc adm upgrade --to-image ...' rejects an update as not recommended, it should mention --allow-explicit-upgrade
Product: OpenShift Container Platform Reporter: W. Trevor King <wking>
Component: ocAssignee: Maciej Szulik <maszulik>
oc sub component: oc QA Contact: Evgeni Vakhonin <evakhoni>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: ehoxha, evakhoni, jiajliu, lmohanty, mfojtik, vlaad, wking, wlewis, yanyang, yunjiang
Version: 4.10Keywords: Regression
Target Milestone: ---   
Target Release: 4.10.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2044140 Environment:
Last Closed: 2022-08-31 12:34:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2044140    
Bug Blocks:    

Description W. Trevor King 2022-02-06 21:58:53 UTC
+++ This bug was initially created as a clone of Bug #2044140 +++

Description of problem:
# oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652 
error: cannot refresh available updates:
  Reason: VersionNotFound
  Message: Unable to retrieve available updates: currently reconciling cluster version 4.9.0-0.nightly-2022-01-21-203405 not found in the "stable-4.9" channel

Version:
oc version --client
Client Version: 4.10.0-0.nightly-2022-01-22-102609

How reproducible:
Always

Expect result:
oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652
error: The requested upgrade image is not one of the available updates, you must pass --allow-explicit-upgrade to continue

...

--- Additional comment from W. Trevor King on 2022-02-01 18:52:53 UTC ---

Bug 2045081 is adjacent, so re-scoping this bug to cover these cases [1]:

* RetrievedUpdates!=True (original scope for this bug)
* No targets, and --allow-not-recommended set
* No targets, and --allow-not-recommended not set (original scope of bug 2045081)
* Some targets, but the requested image was not one of them.
* I dunno if it's possible to hit the 'default' case.  Maybe we don't need formal QE verification of the default case.

[1]: https://github.com/openshift/oc/blob/d09c0aa3a764e3040a07ad0fbe320bcd500f2941/pkg/cli/admin/upgrade/upgrade.go#L306-L317

...

--- Additional comment from Evgeni Vakhonin on 2022-02-06 15:50:43 UTC ---

reproducing
Client Version: 4.10.0-0.nightly-2022-02-05-132417
Server Version: 4.10.0-0.nightly-2022-02-05-132417


*case: source version not in the graph:

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652
error: cannot refresh available updates:
  Reason: VersionNotFound
  Message: Unable to retrieve available updates: currently reconciling cluster version 4.10.0-0.nightly-2022-02-05-132417 not found in the "stable-4.10" channel



*case: no targets, --allow-not-recommended applied

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652 --allow-not-recommended
error: no recommended or conditional updates, specify --to-image or wait for new updates to be available



*case: no targets, --allow-not-recommended not applied:

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652
error: no recommended updates, specify --to-image or wait for new updates to be available



*case: some targets, requested != targets

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652
error: the update is not one of the possible targets: 4.10.0-0.nightly-2021-12-23-153012



*case: some targets, requested != targets, --allow-not-recommended applied

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652 --allow-not-recommended
error: the update is not one of the possible targets: 4.10.0-0.nightly-2021-12-23-153012

--- Additional comment from Evgeni Vakhonin on 2022-02-06 17:25:04 UTC ---

verifying
Client Version: 4.11.0-0.nightly-2022-02-05-152519
Server Version: 4.11.0-0.nightly-2022-02-05-152519


*case: source version not in the graph:

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652
error: cannot refresh available updates:
  Reason: VersionNotFound
  Message: Unable to retrieve available updates: currently reconciling cluster version 4.11.0-0.nightly-2022-02-05-152519 not found in the "stable-4.10" channel

specify --allow-explicit-upgrade to continue with the update.


*case: no targets, --allow-not-recommended applied

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652 --allow-not-recommended
error: no recommended or conditional updates, specify --allow-explicit-upgrade to continue with the update or wait for new updates to be available.


*case: no targets, --allow-not-recommended not applied:

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652                       
error: no recommended updates, specify --allow-explicit-upgrade to continue with the update or wait for new updates to be available.


*case: some targets, requested != targets

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652
error: the update is not one of the possible targets: 4.11.0-0.nightly-2022-02-05-211325. specify --allow-explicit-upgrade to continue with the update.


*case: some targets, requested != targets, --allow-not-recommended applied

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652 --allow-not-recommended
error: the update is not one of the possible targets: 4.11.0-0.nightly-2022-02-05-211325. specify --allow-explicit-upgrade to continue with the update.




so far so good.
now lets see no "specify --allow-explicit-upgrade" when it shouldn't be.




*case some targets, requested != targets, without --to-image

#oc adm upgrade --to 4.9.19
error: the update is not one of the possible targets: 4.11.0-0.nightly-2022-02-05-211325. specify --to-image to continue with the update.


*case some targets, requested != targets, with -to-image, --allow-explicit-upgrade

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652 --allow-explicit-upgrade    
warning: The requested upgrade image is not one of the available updates.You have used --allow-explicit-upgrade for the update to proceed anyway
Updating to release image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652



as expected.

Comment 1 Evgeni Vakhonin 2022-03-01 18:35:21 UTC
reproduced in https://bugzilla.redhat.com/show_bug.cgi?id=2044140#c12

pre-merging - verifying: 
Client Version: 4.10.0-pr1052
Server Version: 4.10.0-rc.6


*case: source version not in the graph:
#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652
error: cannot refresh available updates:
  Reason: VersionNotFound
  Message: Unable to retrieve available updates: currently reconciling cluster version 4.10.0-rc.6 not found in the "stable-4.10" channel

specify --allow-explicit-upgrade to continue with the update.


*case: no targets, --allow-not-recommended applied

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652 --allow-not-recommended
error: no recommended or conditional updates, specify --allow-explicit-upgrade to continue with the update or wait for new updates to be available.


*case: no targets, --allow-not-recommended not applied:

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652                       
error: no recommended updates, specify --allow-explicit-upgrade to continue with the update or wait for new updates to be available.


*case: some targets, requested != targets

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652
error: the update is not one of the possible targets: 4.10.0-0.nightly-2022-02-26-230022. specify --allow-explicit-upgrade to continue with the update.


*case: some targets, requested != targets, --allow-not-recommended applied

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652 --allow-not-recommended
error: the update is not one of the possible targets: 4.10.0-0.nightly-2022-02-26-230022. specify --allow-explicit-upgrade to continue with the update.



so far so good.
now lets see no "specify --allow-explicit-upgrade" when it shouldn't be.




*case some targets, requested != targets, without --to-image

#oc adm upgrade --to 4.9.19
error: the update is not one of the possible targets: 4.10.0-0.nightly-2022-02-26-230022. specify --to-image to continue with the update.


*case some targets, requested != targets, with -to-image, --allow-explicit-upgrade

#oc adm upgrade --to-image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652 --allow-explicit-upgrade    
warning: The requested upgrade image is not one of the available updates.You have used --allow-explicit-upgrade for the update to proceed anyway
Updating to release image registry.ci.openshift.org/ocp/release@sha256:f1b711b1f476d021d0bdc2b88cd28d5b92e4459b49c787db2129c6c1aaf26652



as expected.

Comment 5 Evgeni Vakhonin 2022-08-17 09:20:53 UTC
already verified above in https://bugzilla.redhat.com/show_bug.cgi?id=2051267#c1

Comment 8 errata-xmlrpc 2022-08-31 12:34:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Important: OpenShift Container Platform 4.10.30 bug fix and security update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:6133