Bug 2044140 - 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.11.0
Assignee: Lalatendu Mohanty
QA Contact: Evgeni Vakhonin
URL:
Whiteboard:
: 2045081 (view as bug list)
Depends On:
Blocks: 2051267
TreeView+ depends on / blocked
 
Reported: 2022-01-24 05:53 UTC by Yunfei Jiang
Modified: 2022-08-10 10:43 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2051267 (view as bug list)
Environment:
Last Closed: 2022-08-10 10:43:39 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift oc pull 1041 0 None Merged Bug 2044140: Updated the error message to include the suggestion 2022-02-05 04:02:23 UTC
Github openshift oc pull 1050 0 None Merged Bug 2044140: pkg/cli/admin/upgrade: Fix nextStep option sense 2022-02-05 04:02:24 UTC
Red Hat Product Errata RHSA-2022:5069 0 None None None 2022-08-10 10:43:53 UTC

Description Yunfei Jiang 2022-01-24 05:53:12 UTC
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

Comment 2 Evgeni Vakhonin 2022-01-30 15:52:59 UTC
done some pre-merge on this one..

reproducing:
Client Version: 4.10.0-0.nightly-2022-01-29-094046

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-01-29-094046 not found in the "stable-4.10" channel

verifying:
cluster-bot build openshift/oc#1041
Client Version: 4.10.0-0.ci.test-2022-01-30-114824-ci-ln-v7j1j6k-latest

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.ci.test-2022-01-30-114824-ci-ln-v7j1j6k-latest not found in the "stable-4.10" channel


hmm... looks like the PR haven't changed the behavior.. 
is it still WIP??

Comment 3 Lalatendu Mohanty 2022-02-01 04:02:39 UTC
The error message you were looking for was at https://github.com/openshift/oc/blob/fd5446fb51074372e95b9133adcab1cbfec4682e/pkg/cli/admin/upgrade/upgrade.go#L280. The Code has gone through refactoring [1] while adding flag --allow-not-recommended to oc adm upgrade. The refactoring was done to make code behave similar way for both --to and --to-image. I am not sure if we should go back to the previous error messages which was specific to --to-image. I have updated the PR again and waiting to see what others reviewers think. 

[1] https://github.com/openshift/oc/commit/6c8d9352d3e459a44faa0de6209d761aae25ff47#diff-95dd836dcdd15c8809f02598420db11692d674c596a8a488980187f68c9ef1e6

Comment 4 W. Trevor King 2022-02-01 09:04:38 UTC
*** Bug 2045081 has been marked as a duplicate of this bug. ***

Comment 6 W. Trevor King 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

Comment 8 Evgeni Vakhonin 2022-02-03 16:21:52 UTC
hmm.. just checked 
Client Version: 4.11.0-0.nightly-2022-02-03-131620
Server Version: 4.11.0-0.nightly-2022-02-03-131620

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-03-131620 not found in the "stable-4.10" channel

specify --to-image to continue with the update.


is asking for "--to-image" when --to-image is already supplied, which is what i reported in bug 2045081 btw


is [1] this condition wrong?

[1]: https://github.com/openshift/oc/blob/master/pkg/cli/admin/upgrade/upgrade.go#L307

Comment 12 Evgeni Vakhonin 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

Comment 13 Evgeni Vakhonin 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 14 errata-xmlrpc 2022-08-10 10:43:39 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.11.0 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:5069


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