Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-4.12] OCPBUGS-14065: fix: Limit the nested repository path while mirroring the images #642

Merged

Conversation

aguidirh
Copy link
Contributor

Description

This fix is based on the fix created for 4.13 but only with essentials changes needed for 4.12

Based on #623 and #634

Fixes # (OCPBUGS-14065)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 25, 2023
@openshift-ci-robot
Copy link

@aguidirh: This pull request references Jira Issue OCPBUGS-14065, which is invalid:

  • expected Jira Issue OCPBUGS-14065 to depend on a bug targeting a version in 4.13.0, 4.13.z and in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), but no dependents were found

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Description

This fix is based on the fix created for 4.13 but only with essentials changes needed for 4.12

Based on #623 and #634

Fixes # (OCPBUGS-14065)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Contributor

@sherine-k sherine-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label May 25, 2023
@lmzuccarelli
Copy link
Contributor

/lgtm

@aguidirh
Copy link
Contributor Author

/jira refresh

@openshift-ci-robot
Copy link

@aguidirh: This pull request references Jira Issue OCPBUGS-14065, which is invalid:

  • expected Jira Issue OCPBUGS-14065 to depend on a bug targeting a version in 4.13.0, 4.13.z and in one of the following states: VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE), but no dependents were found

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@aguidirh
Copy link
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels May 25, 2023
@openshift-ci-robot
Copy link

@aguidirh: This pull request references Jira Issue OCPBUGS-14065, which is valid. The bug has been moved to the POST state.

6 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.12.z) matches configured target version for branch (4.12.z)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
  • dependent bug Jira Issue OCPBUGS-13591 is in the state Verified, which is one of the valid states (VERIFIED, RELEASE PENDING, CLOSED (ERRATA), CLOSED (CURRENT RELEASE), CLOSED (DONE))
  • dependent Jira Issue OCPBUGS-13591 targets the "4.13.0" version, which is one of the valid target versions: 4.13.0, 4.13.z
  • bug has dependents

Requesting review from QA contact:
/cc @zhouying7780

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot requested a review from zhouying7780 May 25, 2023 09:51
@sherine-k
Copy link
Contributor

/approve

@sherine-k
Copy link
Contributor

/label backport-risk-assessed

@openshift-ci openshift-ci bot added the backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. label May 26, 2023
@sherine-k
Copy link
Contributor

/label backport-risk-assessed
/approve

@openshift-ci
Copy link

openshift-ci bot commented May 26, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: aguidirh, sherine-k

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 26, 2023
@sherine-k
Copy link
Contributor

/retitle [release-4.12] OCPBUGS-14065: fix: Limit the nested repository path while mirroring the images

@openshift-ci openshift-ci bot changed the title OCPBUGS-14065: fix: Limit the nested repository path while mirroring the images [release-4.12] OCPBUGS-14065: fix: Limit the nested repository path while mirroring the images May 29, 2023
@kasturinarra
Copy link

kasturinarra commented May 29, 2023

Below are the steps i have followed to test this:

  1. clone the oc-mirror repor
  2. git checkout release-4.12
  3. gh pr checkout 642
  4. make build
  5. Run oc-mirror -h, verify that --max-nested-paths is present
    --max-nested-paths int Number of nested paths, for destination registries that limit nested paths
  6. start a local docker registry by running the command podman run -d -p 5000:5000 -v /home/fedora/registry:/var/lib/registry/docker/registry --privileged -e REGISTRY_STORAGE_DELETE_ENABLED=true --restart=always --name registry quay.io/openshifttest/registry@sha256:1106aedc1b2e386520bc2fb797d9a7af47d651db31d8e7ab472f2352da37d1b3
  7. Now run command ./oc-mirror --config /tmp/config.yaml docker://localhost:5000/knarra/mynamespace/myns1/local-storage-operator --dest-use-http , see that it works fine by not specifying any --max-nested-paths
  8. Now run command ./oc-mirror --config /tmp/config.yaml docker://quay.io/knarra/lso to push contents to quay and see that slashes after "=" in the mapping.txt is not replaced by -
registry.redhat.io/redhat/redhat-operator-index:v4.12=quay.io/knarra/lso/redhat/redhat-operator-index:v4.12
registry.redhat.io/openshift4/ose-local-storage-diskmaker@sha256:398414dc2abad094c2e97a57514d69d5c80790510e19af105692f2864cc9c566=quay.io/knarra/lso/openshift4/ose-local-storage-diskmaker:df3814e9
registry.redhat.io/openshift4/ose-local-storage-operator@sha256:5f01648146118a5c156733f174addf7f64b794b1edda8e237fb42cb353222102=quay.io/knarra/lso/openshift4/ose-local-storage-operator:d7f3b07
registry.redhat.io/openshift4/ose-local-storage-operator-bundle@sha256:56386aaf90d66683b384a49b052f8b2ed7f969ef47d83b7e76badf2ddf5339e1=quay.io/knarra/lso/openshift4/ose-local-storage-operator-bundle:3dbae7c1
registry.redhat.io/openshift4/ose-kube-rbac-proxy@sha256:116dbeb371324607d361d4f1a9daeb5890e44d29b96c9800b2b1d93d21635dec=quay.io/knarra/lso/openshift4/ose-kube-rbac-proxy:ec31b7f8
quay.io/openshifttest/bench-army-knife@sha256:078db36d45ce0ece589e58e8de97ac1188695ac155bc668345558a8dd77059f6=quay.io/knarra/lso/openshifttest/bench-army-knife:latest
---
apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
  name: generic-0
spec:
  repositoryDigestMirrors:
  - mirrors:
    - quay.io/knarra/lso/openshifttest
    source: quay.io/openshifttest
---
apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
  labels:
    operators.openshift.org/catalog: "true"
  name: operator-0
spec:
  repositoryDigestMirrors:
  - mirrors:
    - quay.io/knarra/lso/openshift4
    source: registry.redhat.io/openshift4
  - mirrors:
    - quay.io/knarra/lso/redhat
    source: registry.redhat.io/redhat
  1. Now run command ./oc-mirror --config /tmp/config.yaml docker://quay.io/knarra/mynamespace/mynamespace1/lso --max-nested-paths=5 to push contents to quay and see that slashes after "=" in the mapping.txt is replaced by -
mapping.txt:
==============
quay.io/openshifttest/bench-army-knife@sha256:078db36d45ce0ece589e58e8de97ac1188695ac155bc668345558a8dd77059f6=quay.io/knarra/mynamespace/mynamespace1/lso/openshifttest-bench-army-knife:latest
registry.redhat.io/redhat/redhat-operator-index:v4.12=quay.io/knarra/mynamespace/mynamespace1/lso/redhat/redhat-operator-index:v4.12
registry.redhat.io/openshift4/ose-local-storage-operator@sha256:5f01648146118a5c156733f174addf7f64b794b1edda8e237fb42cb353222102=quay.io/knarra/mynamespace/mynamespace1/lso/openshift4-ose-local-storage-operator:d7f3b07
registry.redhat.io/openshift4/ose-local-storage-operator-bundle@sha256:56386aaf90d66683b384a49b052f8b2ed7f969ef47d83b7e76badf2ddf5339e1=quay.io/knarra/mynamespace/mynamespace1/lso/openshift4-ose-local-storage-operator-bundle:3dbae7c1
registry.redhat.io/openshift4/ose-kube-rbac-proxy@sha256:116dbeb371324607d361d4f1a9daeb5890e44d29b96c9800b2b1d93d21635dec=quay.io/knarra/mynamespace/mynamespace1/lso/openshift4-ose-kube-rbac-proxy:ec31b7f8
registry.redhat.io/openshift4/ose-local-storage-diskmaker@sha256:398414dc2abad094c2e97a57514d69d5c80790510e19af105692f2864cc9c566=quay.io/knarra/mynamespace/mynamespace1/lso/openshift4-ose-local-storage-diskmaker:df3814e9
[fedora@preserve-fedora36 ~]$ cat oc-mirror-workspace/results-1685382321/imageContentSourcePolicy.yaml 
---
apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
  name: generic-0
spec:
  repositoryDigestMirrors:
  - mirrors:
    - quay.io/knarra/mynamespace/mynamespace1/lso
    source: quay.io/openshifttest
---
apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
  labels:
    operators.openshift.org/catalog: "true"
  name: operator-0
spec:
  repositoryDigestMirrors:
  - mirrors:
    - quay.io/knarra/mynamespace/mynamespace1/lso/openshift4-ose-kube-rbac-proxy
    source: registry.redhat.io/openshift4/ose-kube-rbac-proxy
  - mirrors:
    - quay.io/knarra/mynamespace/mynamespace1/lso/openshift4-ose-local-storage-diskmaker
    source: registry.redhat.io/openshift4/ose-local-storage-diskmaker
  - mirrors:
    - quay.io/knarra/mynamespace/mynamespace1/lso/redhat/redhat-operator-index
    source: registry.redhat.io/redhat/redhat-operator-index
  - mirrors:
    - quay.io/knarra/mynamespace/mynamespace1/lso/openshift4-ose-local-storage-operator
    source: registry.redhat.io/openshift4/ose-local-storage-operator
  - mirrors:
    - quay.io/knarra/mynamespace/mynamespace1/lso/openshift4-ose-local-storage-operator-bundle
    source: registry.redhat.io/openshift4/ose-local-storage-operator-bundle
  1. Verify that if user sets an incorrect nested path below error is thrown
[fedora@preserve-fedora36 ~]$ sudo ./oc-mirror --config /tmp/config.yaml docker://quay.io/knarra/mynamespace/mynamespace1/lso --max-nested-paths=4
error: the max-nested-paths value (4) must be strictly higher than the number of path-components in the destination knarra/mynamespace/mynamespace1/lso - try increasing the value

Based on the above adding lgtm & qe-approved labels to the PR

@kasturinarra
Copy link

/lgtm

@kasturinarra
Copy link

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label May 29, 2023
@kasturinarra
Copy link

/label cherry-pick-approved

@openshift-ci openshift-ci bot added the cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. label May 29, 2023
@openshift-ci
Copy link

openshift-ci bot commented May 29, 2023

@aguidirh: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot merged commit c5fea1e into openshift:release-4.12 May 29, 2023
5 checks passed
@openshift-ci-robot
Copy link

@aguidirh: Jira Issue OCPBUGS-14065: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-14065 has been moved to the MODIFIED state.

In response to this:

Description

This fix is based on the fix created for 4.13 but only with essentials changes needed for 4.12

Based on #623 and #634

Fixes # (OCPBUGS-14065)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-merge-robot
Copy link
Contributor

Fix included in accepted release 4.12.0-0.nightly-2023-05-29-223551

@openshift-merge-robot
Copy link
Contributor

Fix included in accepted release 4.12.0-0.nightly-2023-05-31-232541

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. backport-risk-assessed Indicates a PR to a release branch has been evaluated and considered safe to accept. cherry-pick-approved Indicates a cherry-pick PR into a release branch has been approved by the release branch manager. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants