Skip to content

Commit 6b47997

Browse files
committed
[reproducer] Add task for overwriting pull secret
The pull_secret.json might contain authentication to necessary registries for CI job, that are not available during the bootstrap process using PreMetal (earlier ZIronic).
1 parent acd3670 commit 6b47997

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

reproducer.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@
138138
name: reproducer
139139
tasks_from: overwrite_zuul_vars.yml
140140

141+
- name: Overwrite pull-secret.json and add missing registries
142+
when:
143+
- not cifmw_deploy_reproducer_env | default(true) | bool
144+
ansible.builtin.include_role:
145+
name: reproducer
146+
tasks_from: overwrite_pull_secret.yml
147+
141148
# NOTE(dpawlik): Since we use ZIronic, some variables are not
142149
# redirected to nested ansible execution - they needs to be
143150
# included on executing host - controller-0.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# No log in that file are necessary and it should not use: cifmw_nolog var.
3+
- name: Slurp full pull-secret from secrets dir
4+
ansible.builtin.slurp:
5+
src: "{{ ansible_user_dir }}/secrets/pull_secret.json"
6+
register: _full_pull_secret
7+
no_log: true
8+
9+
- name: Get current cluster pull-secret
10+
kubernetes.core.k8s_info:
11+
kubeconfig: "{{ cifmw_openshift_kubeconfig | default(ansible_user_dir ~ '/.kube/config') }}"
12+
kind: Secret
13+
name: pull-secret
14+
namespace: openshift-config
15+
register: _cluster_pull_secret
16+
delegate_to: controller-0
17+
no_log: true
18+
19+
- name: Merge and update cluster pull-secret
20+
vars:
21+
_full_auths: "{{ (_full_pull_secret.content | b64decode | from_json).auths }}"
22+
_cluster_auths: "{{ (_cluster_pull_secret.resources[0].data['.dockerconfigjson'] | b64decode | from_json).auths }}"
23+
_merged:
24+
auths: "{{ _cluster_auths | combine(_full_auths, recursive=true) }}"
25+
kubernetes.core.k8s:
26+
kubeconfig: "{{ cifmw_openshift_kubeconfig | default(ansible_user_dir ~ '/.kube/config') }}"
27+
state: present
28+
definition:
29+
apiVersion: v1
30+
kind: Secret
31+
metadata:
32+
name: pull-secret
33+
namespace: openshift-config
34+
type: kubernetes.io/dockerconfigjson
35+
data:
36+
.dockerconfigjson: "{{ _merged | to_json | b64encode }}"
37+
delegate_to: controller-0
38+
no_log: true

0 commit comments

Comments
 (0)