Bug 2051267 - When 'oc adm upgrade --to-image ...' rejects an update as not recommended, it should mention --allow-explicit-upgrade
Summary: When 'oc adm upgrade --to-image ...' rejects an update as not recommended, it...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.10
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 4.10.z
Assignee: Maciej Szulik
QA Contact: Evgeni Vakhonin
URL:
Whiteboard:
Depends On: 2044140
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-06 21:58 UTC by W. Trevor King
Modified: 2022-08-31 12:34 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 2044140
Environment:
Last Closed: 2022-08-31 12:34:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 1052 0 None Merged Bug 2051267: pkg/cli/admin/upgrade: Mention --allow-explicit-upgrade next step when appropriate 2022-08-16 07:46:10 UTC
Red Hat Product Errata RHSA-2022:6133 0 None None None 2022-08-31 12:34:43 UTC

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


Note You need to log in before you can comment on or make changes to this bug.