openshift / oc-mirror

Lifecycle manager for internet-disconnected OpenShift environments
Apache License 2.0
87 stars 80 forks source link

"could not parse reference:" Error while Mirroring an image set to a mirror registry using oc-mirror #897

Open grantcurell opened 1 month ago

grantcurell commented 1 month ago

Exact same problem as https://github.com/openshift/oc-mirror/issues/643 except I'm on 4.16.

I'm sure I'm doing something wrong, but at a very minimum, this is a bug in the sense that it should output the problem and not an empty string:

[grant@rockydesktop mirror-registry]$ ../oc-mirror --config=./imageset-config.yaml docker://$quayHostname:8443
Checking push permissions for grant-staging.openshift.lan:8443
Found: oc-mirror-workspace/src/publish
Found: oc-mirror-workspace/src/v2
Found: oc-mirror-workspace/src/charts
Found: oc-mirror-workspace/src/release-signatures
error: parsing reference "": could not parse reference:

I'm following these instructions

grantcurell commented 1 month ago

The problem seems to be this command is broken:

oc mirror init <--registry <storage_backend> > imageset-config.yaml 

The imageset-config.yaml it generates is incorrect. It generates a file with the following format. I'm not sure why it has v4.17 which at time of writing doesn't exist.

kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v1alpha2
storageConfig:
  registry:
    imageURL: grant-staging.openshift.lan:8443
    skipTLS: false
mirror:
  platform:
    channels:
    - name: stable-4.16
      type: ocp
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
    packages:
    - name: serverless-operator
      channels:
      - name: stable
  additionalImages:
  - name: registry.redhat.io/ubi8/ubi:latest
  helm: {}

I updated based on a friend's instructions to:

kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v1alpha2
mirror:
  platform:
    channels:
      - name: stable-4.16
        minVersion: 4.16.0
        maxVersion: 4.17.0
  operators:
    - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.16
      packages:
        - name: kubernetes-nmstate-operator
        - name: kubevirt-hyperconverged
        - name: serverless-operator
          channels:
          - name: stable
        - name: local-storage-operator
        - name: odf-operator
        - name: sriov-network-operator
  additionalImages:
    - name: registry.redhat.io/rhel8/support-tools:latest
    - name: registry.redhat.io/ubi8/ubi:latest
  helm: {}

That obviously has some extra operators but it seems like the main difference is it doesn't have my repo info in it. That worked and mirrored correctly.

dmc5179 commented 1 month ago

I have the same error. When running the command

oc-mirror init --registry ip-10-0-170-23.us-east-2.compute.internal:8443 > imageset-config.yaml

I get this output

kind: ImageSetConfiguration
apiVersion: mirror.openshift.io/v1alpha2
storageConfig:
  registry:
    imageURL: ip-10-0-170-23.us-east-2.compute.internal:8443
    skipTLS: false
mirror:
  platform:
    channels:
    - name: stable-4.16
      type: ocp
  operators:
  - catalog: registry.redhat.io/redhat/redhat-operator-index:v4.17
    packages:
    - name: serverless-operator
      channels:
      - name: stable
  additionalImages:
  - name: registry.redhat.io/ubi8/ubi:latest
  helm: {}

The output should not reference v4.17. At a minimum the output should reference the same major release as the oc-mirror binary, which in this case is:

Client Version: version.Info{Major:"", Minor:"", GitVersion:"4.16.0-202407100906.p0.g75da281.assembly.stream.el9-75da281", GitCommit:"75da281989a147ead237e738507bbd8cec3175e5", GitTreeState:"clean", BuildDate:"2024-07-10T09:46:55Z", GoVersion:"go1.21.11 (Red Hat 1.21.11-1.module+el8.10.0+21986+2112108a) X:strictfipsruntime", Compiler:"gc", Platform:"linux/amd64"}
dmc5179 commented 1 month ago

Bug created: https://issues.redhat.com/browse/OCPBUGS-37931