Bug 2067989 - Should not exit with code 1 when only has warning
Summary: Should not exit with code 1 when only has warning
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.11
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 4.11.z
Assignee: Ross Peoples
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-24 08:06 UTC by zhou ying
Modified: 2023-09-19 10:03 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-01-04 06:46:40 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2022:9107 0 None None None 2023-01-04 06:47:00 UTC

Description zhou ying 2022-03-24 08:06:02 UTC
Description of problem:
Should not exit with code 1 when only has warning

Version-Release number of selected component (if applicable):
oc-mirror version 
Client Version: version.Info{Major:"0", Minor:"2", GitVersion:"v0.2.0-alpha.1", GitCommit:"3abb4c3fc71a815e6a3f6a90122ef4d51be67392", GitTreeState:"clean", BuildDate:"2022-03-21T21:07:36Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}


How reproducible:
Always

Steps to reproduce the issue:
1. Run the oc-mirror with imageset :
cat imageset.yaml 
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
storageConfig:
  #registry:
  #  imageURL: fx2-1a.cloud.lab.eng.bos.redhat.com:8443/ocp4/openshift4
  #  skipTLS: true
  local:
    path: /home/ocmirrortest
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.9 # References entire catalog

`oc-mirror --config imageset.yaml file://  --continue-on-error`

Actual results:
1. The command exit with code 1 , but actually command succeed only with some warning;
`oc-mirror --config imageset.yaml file://  --continue-on-error`
....
sha256:5b4372c899a751943ac8515c18714b880ae5dff3d0cb8e992ebe9bcfbfbe8731 file://rhacm2/grc-ui-rhel8:da8a17e2
sha256:2522cd150c3cc6413b5b6d8e56fdd9bee962ce0c9deefbb1030c0a70e2e3a64c file://rhacm2/grc-ui-rhel8:56a982ae
info: Mirroring completed in 3h43m11.01s (10.92MB/s)
WARNING one or more errors occurred                  
WARNING image "registry.access.redhat.com/ubi8/openjdk-11@sha256:308113a00212e3b006e0f5a955f4743a1604b39f18aca1bf5e0275ac0aeb7d44" is invalid or does not exist 
WARNING image "registry.redhat.io/openshift-gitops-1/argocd-rhel8@sha256:ff4ad30752cf0d321cd6c2c6fd4490b716607ea2960558347440f2f370a586a8" is invalid or does not exist 
WARNING image "registry.redhat.io/rhpam-7/rhpam-kogito-rhel8-operator@sha256:7aa5491e5d26b29cd0e271d24996e587a65b50f5a8d871bd004b53da65ee0038" is invalid or does not exist 
INFO Creating archive /home/ocmirrortest/mirror_seq1_000000.tar 
error: one or more errors occurred
[root@localhost ocmirrortest]# echo $?
1



Expected results:
1. Command exit with code 0 .


Additional info:

Comment 1 Jennifer Power 2022-05-18 14:00:18 UTC
@yinzhou This issue should be resolved in the currently 4.11 nightly. Since errors are occurring and oc-mirror is configured to continue, the log level has been changed from WARNING to ERROR and will still exit 1.

Comment 2 zhou ying 2022-05-20 00:51:51 UTC
Still could reproduce:

cat packageonly.yaml 
apiVersion: mirror.openshift.io/v1alpha2
kind: ImageSetConfiguration
mirror:
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.10

oc-mirror --config packageonly.yaml file://out   --continue-on-error
.......
mounted: file://integration/service-registry-kafkasql-rhel8 sha256:61ed54903a04abab8581e15c3dceb66513a3c48342df06635b2eb33dd72127e8 112.4MiB
uploading: file://integration/service-registry-kafkasql-rhel8 sha256:b494664a27b97059e18ebeff9aa59082c579568c98bdc371b2a3fa7ac5bf25b9 103.9MiB
sha256:eb972d1348c9554cfcf14a6f9ba971dd1f4b6a360a4cf331007cc61c899af4c6 file://cryostat-tech-preview/cryostat-rhel8:acb23560
sha256:77cd28f83652a8b93f652ee96b621206ead640755424bdd6d33f48417bfda307 file://integration/service-registry-kafkasql-rhel8
sha256:64b0a3fabb0e272d3d247a1e4b406576d5cf57822236ce4dad8af48eb7e36fd0 file://integration/service-registry-kafkasql-rhel8:85c4a4a2
sha256:b47a7f1bca9f8fe12d93b312a4042010524fb45d3f381b892366012b3a76344c file://ansible-automation-platform-21/ee-29-rhel8
sha256:016beda9d48da91b36f1779fedf0f399d8e4dae9ebfb090bdbfa810cdf878577 file://ansible-automation-platform-21/ee-29-rhel8:ca16061a
info: Mirroring completed in 3h39m17.58s (10.67MB/s)
one or more errors occurred
one or more errors occurred
one or more errors occurred
image "registry.redhat.io/rhel9-beta/tang-operator@sha256:9963167fe37897473167d5b1af578881592479093e086d2ffb7ff4b7bec4d39e" has invalid component "5d5e645f"
image "registry.redhat.io/rhel9-beta/tang-operator@sha256:9963167fe37897473167d5b1af578881592479093e086d2ffb7ff4b7bec4d39e" has invalid component "5d5e645f"
image "registry.redhat.io/rhel9-beta/tang-operator@sha256:9963167fe37897473167d5b1af578881592479093e086d2ffb7ff4b7bec4d39e" has invalid component "5d5e645f"
image "registry.redhat.io/rhel9-beta/tang-operator-bundle@sha256:be7053361e3a0e2639b4f4e242aca4ed28aa467f41273ee303228e159d0fef04" has invalid component "41640040"
image "registry.redhat.io/rhel9-beta/tang-operator-bundle@sha256:be7053361e3a0e2639b4f4e242aca4ed28aa467f41273ee303228e159d0fef04" has invalid component "41640040"
image "registry.redhat.io/rhel9-beta/tang-operator-bundle@sha256:be7053361e3a0e2639b4f4e242aca4ed28aa467f41273ee303228e159d0fef04" has invalid component "41640040"
image "registry.redhat.io/openshift4/ose-cloud-event-proxy@sha256:3f61447a327af2851a48e7c8f4e01939a00f7495ec900590b14bc58a7c8ab274" is invalid or does not exist
image "registry.redhat.io/openshift4/ose-cloud-event-proxy@sha256:3f61447a327af2851a48e7c8f4e01939a00f7495ec900590b14bc58a7c8ab274" is invalid or does not exist
image "registry.redhat.io/openshift4/ose-cloud-event-proxy@sha256:3f61447a327af2851a48e7c8f4e01939a00f7495ec900590b14bc58a7c8ab274" is invalid or does not exist
Creating archive /home/ocmirrortest/out/mirror_seq1_000000.tar
error: one or more errors occurred
[root@localhost ocmirrortest]# echo $?
1

Comment 3 Jennifer Power 2022-05-23 13:26:40 UTC
@yinzhou Since errors are still being reported, we decided to leave the exit code as 1. We just changed the log level. I believe this matches the behavior of oc when using continue-on-error.

Comment 4 zhou ying 2022-06-14 08:01:35 UTC
Jennifer Power

Got you , thanks .

Comment 5 Maciej Szulik 2022-12-12 12:26:35 UTC
Based on the above comments it seems to be fixed now, moving to modified.

Comment 10 zhou ying 2022-12-22 01:40:57 UTC
since no code fix , will move to verified status.

Comment 12 errata-xmlrpc 2023-01-04 06:46:40 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 (Moderate: OpenShift Container Platform 4.11.21 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:9107


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