-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun-local-kata-ci.yaml
90 lines (90 loc) · 2.72 KB
/
run-local-kata-ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
- name: Create kata repo
hosts: all
vars_files:
- env-vars.yaml
remote_user: kata
tasks:
- name: Create rsync config
become: true
copy:
dest: /etc/rsyncd.conf
content: |
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
[kata]
path = /home/kata/go/src/github.com/kata-containers
comment = kata repo
read only = no
uid = kata
gid = kata
- name: Create kata directory
file:
path: /home/kata/go/src/github.com/kata-containers/kata-containers
state: directory
- name: Create kata tests directory
file:
path: /home/kata/go/src/github.com/kata-containers/tests
state: directory
- name: Start rsyncd service
become: true
command: rsync --daemon
- name: Synchronize kata-containers repo
synchronize:
src: '{{ kata_containers_repo_path }}/kata-containers'
dest: rsync://kata@{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}/kata
recursive: yes
- name: Synchronize tests repo
synchronize:
src: '{{ kata_containers_repo_path }}/tests'
dest: rsync://kata@{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}/kata
recursive: yes
- name: Disable swap to run k8s tests
command: swapoff -a
become: true
- name: Clean-up Agent dir
command:
cmd: make clean
chdir: /home/kata/go/src/github.com/kata-containers/kata-containers/tools/osbuilder
- name: Clean cni dir
file:
path: /etc/cni/net.d
state: absent
become: true
- name: Clean kube directory
file:
path: /home/kata/.kube
state: absent
become: true
- name: Remove log file
file:
path: '{{ guest_kata_log_file }}'
state: absent
- name: Kill eventual remaining jenkins_job.sh
command: killall jenkins_job_build.sh
ignore_errors: yes
- name: Run Kata CI job
environment:
BAREMETAL: true
WORKSPACE: "/home/kata"
CI_JOB: "{{ ci_job }}"
shell: ./jenkins_job_build.sh github.com/kata-containers/kata-containers &> '{{ guest_kata_log_file }}'
args:
chdir: /home/kata/go/src/github.com/kata-containers/tests/.ci
creates: '{{ guest_kata_log_file }}'
executable: /bin/bash
async: 1000
poll: 0
register: ci_register
- name: Check CI job every {{ poll_time }} sec
async_status:
jid: "{{ ci_register.ansible_job_id }}"
register: job_result
until: job_result.finished
delay: '{{ poll_time }}'
retries: '{{ num_tries }}'
ignore_errors: yes
- name: Copy log file locally
fetch:
src: '{{ guest_kata_log_file }}'
dest: '{{ host_kata_log_dir }}'