Add prepare-workspace-openshift role
Change-Id: I41ce5a1ec5ca8b1b101af77169e31fc4a9131ae9
This commit is contained in:
parent
2b670759ed
commit
517bc81404
@ -24,6 +24,7 @@ General Purpose Roles
|
||||
.. zuul:autorole:: persistent-firewall
|
||||
.. zuul:autorole:: prepare-workspace
|
||||
.. zuul:autorole:: prepare-workspace-git
|
||||
.. zuul:autorole:: prepare-workspace-openshift
|
||||
.. zuul:autorole:: remove-build-sshkey
|
||||
.. zuul:autorole:: remove-gpgkey
|
||||
.. zuul:autorole:: remove-sshkey
|
||||
|
15
roles/prepare-workspace-openshift/README.rst
Normal file
15
roles/prepare-workspace-openshift/README.rst
Normal file
@ -0,0 +1,15 @@
|
||||
Prepare remote workspaces
|
||||
|
||||
This role can be used instead of the `prepare-workspace` role when the
|
||||
synchronize module doesn't work with kubectl connection. It copies the
|
||||
prepared source repos to the pods' cwd using the `oc rsync` command.
|
||||
|
||||
This role is intended to run once before any other role in a Zuul job.
|
||||
This role requires the origin-clients to be installed.
|
||||
|
||||
**Role Variables**
|
||||
|
||||
.. zuul:rolevar:: openshift_pods
|
||||
:default: {{ zuul.resources }}
|
||||
|
||||
The dictionary of pod name, pod information to copy the sources to.
|
1
roles/prepare-workspace-openshift/defaults/main.yaml
Normal file
1
roles/prepare-workspace-openshift/defaults/main.yaml
Normal file
@ -0,0 +1 @@
|
||||
openshift_pods: "{{ zuul.resources }}"
|
4
roles/prepare-workspace-openshift/tasks/main.yaml
Normal file
4
roles/prepare-workspace-openshift/tasks/main.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
- include_tasks: rsync.yaml
|
||||
when: item.1.pod is defined
|
||||
loop: "{{ openshift_pods.items()|list }}"
|
17
roles/prepare-workspace-openshift/tasks/rsync.yaml
Normal file
17
roles/prepare-workspace-openshift/tasks/rsync.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: Create src directory
|
||||
command: >
|
||||
oc --context "{{ item.1.context }}"
|
||||
--namespace "{{ item.1.namespace }}"
|
||||
exec {{ item.1.pod }} mkdir src
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Copy src repos to the pod
|
||||
command: >
|
||||
oc --context "{{ item.1.context }}"
|
||||
--namespace "{{ item.1.namespace }}"
|
||||
rsync -q --progress=false
|
||||
{{ zuul.executor.src_root }}/
|
||||
{{ item.1.pod }}:src/
|
||||
no_log: true
|
||||
delegate_to: localhost
|
Loading…
Reference in New Issue
Block a user