Skip to content

Commit 3acf99e

Browse files
committed
Skip pull secret extraction when pre-populated
When the pull-secret file already exists with content (size > 0), skip the kubeconfig-based extraction from the Kubernetes API. This allows adoption CI jobs to pre-populate the pull secret from the hypervisor where the kubeconfig is accessible, instead of requiring the container to reach the OCP API directly. The always-block cleanup is also skipped for pre-populated files since the file lifecycle is managed externally. Assisted-By: Claude Code Change-Id: I66e6f1206a9e5e64d28b56aa2a3b658d57b5ba21 Signed-off-by: Itay Matza <imatza@redhat.com>
1 parent d0ba31d commit 3acf99e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

collection/tools/roles/tools_get_openshift_release/tasks/get_openshift_release_binaries.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@
2626
msg: "'openshift_release_pull_spec' must be set by get_openshift_release_build_name.yml"
2727
when: openshift_release_pull_spec is not defined or openshift_release_pull_spec == ''
2828

29+
- name: Check if pull secret is pre-populated
30+
ansible.builtin.stat:
31+
path: "{{ pull_secret_file }}"
32+
register: _pull_secret_preexists
33+
2934
- name: Extract pull secret from host cluster via Kubernetes API
35+
when: not (_pull_secret_preexists.stat.exists and _pull_secret_preexists.stat.size > 0)
3036
changed_when: true
3137
ansible.builtin.shell: |
3238
python3 << 'PYEOF'
@@ -183,6 +189,7 @@
183189

184190
always:
185191
- name: Remove pull secret file
192+
when: not (_pull_secret_preexists.stat.exists | default(false))
186193
ansible.builtin.file:
187194
path: "{{ pull_secret_file }}"
188195
state: absent

0 commit comments

Comments
 (0)