Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion operators/quay-operator/quay_disconnected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- name: Replace registry.redhat.io with internal quay
ansible.builtin.replace:
path: "{{ workingDir }}/config/imagesetconfiguration.internal.yaml"
regexp: 'catalog: registry.redhat.io'
regexp: 'catalog: {{ dc_cache_address | default("registry.redhat.io") }}'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify which source host is used for catalog lines and whether Line 17 can miss matches.

set -euo pipefail

echo "== Where rh_operator_catalog/dc_cache_address are defined or overridden =="
rg -n -C2 '\brh_operator_catalog\b|\bdc_cache_address\b'

echo
echo "== Catalog rendering source in template =="
rg -n -C2 'catalog:|rh_operator_catalog|_core_plugin_operators' templates/imagesetconfiguration.yaml.j2

echo
echo "== Current replacement task context =="
rg -n -C2 'Replace registry.redhat.io with internal quay|ansible.builtin.replace|regexp:' operators/quay-operator/quay_disconnected.yaml

Repository: rh-ecosystem-edge/enclave

Length of output: 5414


Fix incomplete regex pattern that won't match rendered catalog content.

The regex on line 17 expects catalog: registry.redhat.io (or catalog: <dc_cache_address>), but the generated imagesetconfiguration.internal.yaml contains the full catalog path and version: catalog: registry.redhat.io/redhat/redhat-operator-index:v4.20. This mismatch causes the replacement to fail silently.

Additionally, if dc_cache_address contains regex metacharacters (e.g., dots in hostnames), they must be escaped in the pattern.

Suggested fix
-    regexp: 'catalog: {{ dc_cache_address | default("registry.redhat.io") }}'
+    regexp: 'catalog:\s+({{ dc_cache_address | default("registry.redhat.io", true) | regex_escape }}/.*|registry\.redhat\.io.*)'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
regexp: 'catalog: {{ dc_cache_address | default("registry.redhat.io") }}'
regexp: 'catalog:\s+({{ dc_cache_address | default("registry.redhat.io", true) | regex_escape }}/.*|registry\.redhat\.io.*)'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@operators/quay-operator/quay_disconnected.yaml` at line 17, The regexp under
the key "regexp" currently only matches "catalog: <host>" and should be changed
to match the full catalog path and version and to escape any regex
metacharacters in dc_cache_address; update the "regexp" value so it (1) matches
"catalog:" followed by optional whitespace, (2) inserts the dc_cache_address
(defaulting to "registry.redhat.io") with regex metacharacters escaped, and (3)
allows a slash and the rest of the image path and tag (e.g.,
/redhat/redhat-operator-index:v4.20) by matching the remainder non-greedily;
reference the regexp key and the dc_cache_address variable in
quay_disconnected.yaml when making this change.

replace: "catalog: {{ quayHostname }}:8443"

- name: Ensure .config/containers/ exists
Expand Down
24 changes: 13 additions & 11 deletions playbooks/02-mirror.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@
tags: always
tags: always

- name: Collect plugin operators for imageset
ansible.builtin.include_tasks:
file: tasks/collect_core_plugin_operators.yaml
apply:
tags:
- mirror-registry
- mirror-plugins
- mirror-cache
tags:
- mirror-registry
- mirror-plugins
- mirror-cache

- name: Include tasks for mirror-cache
ansible.builtin.include_tasks:
file: tasks/mirror_cache.yaml
Expand All @@ -47,17 +60,6 @@
success_msg: "Running in disconnected mode - proceeding with mirroring"
tags: mirror-registry

- name: Collect plugin operators for imageset
ansible.builtin.include_tasks:
file: tasks/collect_core_plugin_operators.yaml
apply:
tags:
- mirror-registry
- mirror-plugins
tags:
- mirror-registry
- mirror-plugins

- name: Include tasks for mirror-registry
ansible.builtin.include_tasks:
file: tasks/mirror_registry.yaml
Expand Down
Loading