chore: Use oc-mirror v2 as v1 is deprecated in OCP 4.18#1646
Conversation
Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR TypeEnhancement Description
|
| Relevant files | |||
|---|---|---|---|
| Enhancement |
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes and they look great!
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `.rhdh/scripts/prepare-restricted-environment.sh:1052-1059` </location>
<code_context>
+ if [[ -f "${manifest}" ]]; then
+ debugf "Processing CatalogSource: ${manifest}"
+ # Replace some metadata and add the default list of secrets
+ "$YQ" -i '.metadata.name = "rhdh-catalog"' -i "${manifest}"
+ "$YQ" -i '.spec.displayName = "Red Hat Developer Hub Catalog (Airgapped)"' -i "${manifest}"
+ "$YQ" -i '.spec.secrets = (.spec.secrets // []) + ["internal-reg-auth-for-rhdh", "internal-reg-ext-auth-for-rhdh", "reg-pull-secret"]' -i "${manifest}"
+ if [[ -n "${TO_REGISTRY}" ]]; then
+ invoke_cluster_cli apply -f "${manifest}"
</code_context>
<issue_to_address>
**suggestion (performance):** Multiple in-place yq edits could be consolidated for efficiency.
Combine all yq edits into a single command per manifest to minimize process overhead and avoid race conditions.
```suggestion
if [[ -f "${manifest}" ]]; then
debugf "Processing CatalogSource: ${manifest}"
# Replace some metadata and add the default list of secrets in a single yq command
"$YQ" -i '
.metadata.name = "rhdh-catalog" |
.spec.displayName = "Red Hat Developer Hub Catalog (Airgapped)" |
.spec.secrets = (.spec.secrets // []) + ["internal-reg-auth-for-rhdh", "internal-reg-ext-auth-for-rhdh", "reg-pull-secret"]
' "${manifest}"
if [[ -n "${TO_REGISTRY}" ]]; then
invoke_cluster_cli apply -f "${manifest}"
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||
… equivalent in v2 (images must exist or command fails)' AND '--dest-skip-tls: Replaced with --dest-tls-verify=false' AND '--continue-on-error: No equivalent in v2 (command stops on first error)' Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
Replace complex yq filter generation that was returning null values with direct use of existing auth file containing valid credentials. Prevents authentication failures in oc-mirror v2 workflow. Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
…ster resource generation AND Add --cache-dir option for persistent caching to improve performance and enable incremental mirroring AND Fix ImageSetConfiguration channel structure to ensure proper YAML formatting AND Add cache directory support with default location at /home/fndlovu/.oc-mirror-cache Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
…ipping Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
…rning => Continue anyway Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
|
cc/ @rm3l / @gazarenkov please review |
Signed-off-by: Fortune Ndlovu <fndlovu@redhat.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rm3l The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Description
This PR updates the airgap script to use
oc-mirror v2as v1 has been deprecated in OCP 4.18. Changes essentially include the consistent use of theoc-mirror --v2OpenShift CLI plugin and only applying relevant feature updates throughout the workflow. This migration ensures compatibility with OCP 4.18+.Which issue(s) does this PR fix or relate to
PR acceptance criteria
How to test changes / Special notes to the reviewer
Summary by Sourcery
Switch to oc-mirror v2 for image mirroring by updating script flags, config API version, and resource handling while removing deprecated v1 workarounds
Enhancements: