integration: Use vars_files in plays
It's unsightly and hard to maintain collections of references and long lists across multiple playbooks/include files. Centralize them all in ``vars.yml``, then include that in all plays. Minor: Update all files with a newline at the start and end. Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
parent
a30a118fe6
commit
493a72bbc9
13 changed files with 101 additions and 86 deletions
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: clone bats source repo
|
||||
git:
|
||||
repo: "https://github.com/sstephenson/bats.git"
|
||||
|
@ -14,4 +15,4 @@
|
|||
file:
|
||||
src: /usr/local/bin/bats
|
||||
dest: /usr/bin/bats
|
||||
state: link
|
||||
state: link
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: stat the expected cri-o directory
|
||||
stat:
|
||||
path: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
|
||||
|
@ -75,4 +76,4 @@
|
|||
insertafter: 'storage_option = \['
|
||||
regexp: 'overlay2\.override_kernel_check=1'
|
||||
state: present
|
||||
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'
|
||||
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: clone cri-tools source repo
|
||||
git:
|
||||
repo: "https://github.com/kubernetes-incubator/cri-tools.git"
|
||||
|
@ -12,4 +13,4 @@
|
|||
file:
|
||||
src: "{{ ansible_env.GOPATH }}/bin/crictl"
|
||||
dest: /usr/bin/crictl
|
||||
state: link
|
||||
state: link
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: clone kubernetes source repo
|
||||
git:
|
||||
repo: "https://github.com/runcom/kubernetes.git"
|
||||
|
@ -58,4 +59,4 @@
|
|||
dest: /etc/environment
|
||||
line: 'KUBECONFIG=/var/run/kubernetes/admin.kubeconfig'
|
||||
regexp: 'KUBECONFIG='
|
||||
state: present
|
||||
state: present
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: clone plugins source repo
|
||||
git:
|
||||
repo: "https://github.com/containernetworking/plugins.git"
|
||||
|
@ -46,4 +47,4 @@
|
|||
src: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins/bin/bridge"
|
||||
dest: "/opt/cni/bin/bridge-custom"
|
||||
mode: "o=rwx,g=rx,o=rx"
|
||||
remote_src: yes
|
||||
remote_src: yes
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: clone runc source repo
|
||||
git:
|
||||
repo: "https://github.com/opencontainers/runc.git"
|
||||
|
@ -18,4 +19,4 @@
|
|||
file:
|
||||
src: /usr/local/sbin/runc
|
||||
dest: /usr/bin/runc
|
||||
state: link
|
||||
state: link
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: enable and start CRI-O
|
||||
systemd:
|
||||
name: crio
|
||||
|
@ -31,11 +32,6 @@
|
|||
retries: 100
|
||||
delay: 30
|
||||
|
||||
- name: Buffer location for e2e output and reports
|
||||
set_fact:
|
||||
# N/B: This need manual coordination with results.yml
|
||||
artifacts: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/artifacts"
|
||||
|
||||
- name: ensure directory exists for e2e reports
|
||||
file:
|
||||
path: "{{ artifacts }}"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: set up GOPATH if it is not already set
|
||||
lineinfile:
|
||||
dest: /etc/environment
|
||||
|
@ -37,4 +38,4 @@
|
|||
- onsi/ginkgo/ginkgo
|
||||
- onsi/gomega
|
||||
- cloudflare/cfssl/cmd/...
|
||||
- jteeuwen/go-bindata/go-bindata
|
||||
- jteeuwen/go-bindata/go-bindata
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- hosts: all
|
||||
remote_user: root
|
||||
vars:
|
||||
xunit: false
|
||||
vars_files:
|
||||
- "{{ playbook_dir }}/vars.yml"
|
||||
tags:
|
||||
- setup
|
||||
tasks:
|
||||
|
@ -28,8 +28,8 @@
|
|||
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
vars:
|
||||
xunit: false
|
||||
vars_files:
|
||||
- "{{ playbook_dir }}/vars.yml"
|
||||
tags:
|
||||
- integration
|
||||
- e2e
|
||||
|
@ -39,8 +39,8 @@
|
|||
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
vars:
|
||||
xunit: false
|
||||
vars_files:
|
||||
- "{{ playbook_dir }}/vars.yml"
|
||||
tags:
|
||||
- integration
|
||||
tasks:
|
||||
|
@ -49,8 +49,10 @@
|
|||
|
||||
- hosts: all
|
||||
remote_user: root
|
||||
vars_files:
|
||||
- "{{ playbook_dir }}/vars.yml"
|
||||
tags:
|
||||
- e2e
|
||||
tasks:
|
||||
- name: run k8s e2e tests
|
||||
include: e2e.yml
|
||||
include: e2e.yml
|
||||
|
|
|
@ -2,14 +2,9 @@
|
|||
# vim-syntax: ansible
|
||||
|
||||
- hosts: '{{ hosts | default("all") }}'
|
||||
vars_files:
|
||||
- "{{ playbook_dir }}/vars.yml"
|
||||
vars:
|
||||
# Paths use rsync 'source' conventions
|
||||
crio_integration_filepath: "/root/src/github.com/kubernetes-incubator/cri-o/testout.txt"
|
||||
# N/B: This needs coordination with e2e.yml
|
||||
crio_node_e2e_filepath: "/root/go-tools/src/k8s.io/kubernetes/artifacts/" # everything
|
||||
# Treat empty env. var as "undefined and use default()
|
||||
result_dest_basedir: '{{ lookup("env","WORKSPACE") |
|
||||
default(playbook_dir, True) }}/artifacts'
|
||||
_result_filepaths: [] # do not use
|
||||
_dstfnbuff: [] # do not use
|
||||
tasks:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: register a repo for Golang
|
||||
yum_repository:
|
||||
name: 'centos-paas-sig-openshift-origin37-rpms'
|
||||
|
@ -14,61 +15,7 @@
|
|||
package:
|
||||
name: "{{ item }}"
|
||||
state: present
|
||||
with_items:
|
||||
- btrfs-progs-devel
|
||||
- container-selinux
|
||||
- curl
|
||||
- device-mapper-devel
|
||||
- expect
|
||||
- findutils
|
||||
- gcc
|
||||
- git
|
||||
- glib2-devel
|
||||
- glibc-devel
|
||||
- glibc-static
|
||||
- golang
|
||||
- gpgme-devel
|
||||
- hostname
|
||||
- iproute
|
||||
- iptables
|
||||
- krb5-workstation
|
||||
- libassuan-devel
|
||||
- libffi-devel
|
||||
- libgpg-error-devel
|
||||
- libguestfs-tools
|
||||
- libseccomp-devel
|
||||
- libvirt-client
|
||||
- libvirt-python
|
||||
- libxml2-devel
|
||||
- libxslt-devel
|
||||
- make
|
||||
- mlocate
|
||||
- nfs-utils
|
||||
- nmap-ncat
|
||||
- npm
|
||||
- oci-register-machine
|
||||
- oci-systemd-hook
|
||||
- oci-umount
|
||||
- openssl
|
||||
- openssl-devel
|
||||
- ostree-devel
|
||||
- pkgconfig
|
||||
- python
|
||||
- python2-boto
|
||||
- python2-crypto
|
||||
- python2-mock
|
||||
- python-click
|
||||
- python-devel
|
||||
- python-virtualenv
|
||||
- PyYAML
|
||||
- redhat-rpm-config
|
||||
- rpcbind
|
||||
- rsync
|
||||
- sed
|
||||
- skopeo-containers
|
||||
- socat
|
||||
- tar
|
||||
- wget
|
||||
with_items: "{{ rpm_pkgs }}"
|
||||
async: 600
|
||||
poll: 10
|
||||
|
||||
|
@ -116,4 +63,4 @@
|
|||
state: present
|
||||
|
||||
- name: Flush the iptables
|
||||
command: iptables -F
|
||||
command: iptables -F
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
---
|
||||
|
||||
- name: Change test_runner.sh to use bats xunit output
|
||||
lineinfile:
|
||||
dest: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/test/test_runner.sh"
|
||||
|
@ -21,7 +22,7 @@
|
|||
|
||||
- name: set extra shell for non-xunit tests
|
||||
set_fact:
|
||||
extra_shell_suffix: " >testout.txt 2>&1"
|
||||
extra_shell_suffix: " &> {{ artifacts }}/testout.txt"
|
||||
when: not xunit
|
||||
|
||||
- name: run integration tests
|
||||
|
@ -35,16 +36,16 @@
|
|||
|
||||
- name: Make testing output directory
|
||||
file:
|
||||
path: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/reports"
|
||||
path: "{{ artifacts }}"
|
||||
state: directory
|
||||
ignore_errors: yes
|
||||
when: xunit
|
||||
|
||||
- name: Move all xunit files into one dir to scp
|
||||
shell: "mv {{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/test/TestReport-bats*.xml {{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/reports/"
|
||||
shell: "mv {{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/test/TestReport-bats*.xml {{ artifacts }}"
|
||||
when: xunit
|
||||
|
||||
- name: ensure we fail on bad tests
|
||||
fail:
|
||||
msg: Integration tests failed!
|
||||
when: "'not ok' in integration_test.stdout"
|
||||
when: "'not ok' in integration_test.stdout"
|
||||
|
|
67
contrib/test/integration/vars.yml
Normal file
67
contrib/test/integration/vars.yml
Normal file
|
@ -0,0 +1,67 @@
|
|||
---
|
||||
|
||||
# Enable using BATS to output integration-test xunit output (FIXME: broken? Kill it?)
|
||||
xunit: false
|
||||
|
||||
rpm_pkgs:
|
||||
- btrfs-progs-devel
|
||||
- container-selinux
|
||||
- curl
|
||||
- device-mapper-devel
|
||||
- expect
|
||||
- findutils
|
||||
- gcc
|
||||
- git
|
||||
- glib2-devel
|
||||
- glibc-devel
|
||||
- glibc-static
|
||||
- golang
|
||||
- gpgme-devel
|
||||
- hostname
|
||||
- iproute
|
||||
- iptables
|
||||
- krb5-workstation
|
||||
- libassuan-devel
|
||||
- libffi-devel
|
||||
- libgpg-error-devel
|
||||
- libguestfs-tools
|
||||
- libseccomp-devel
|
||||
- libvirt-client
|
||||
- libvirt-python
|
||||
- libxml2-devel
|
||||
- libxslt-devel
|
||||
- make
|
||||
- mlocate
|
||||
- nfs-utils
|
||||
- nmap-ncat
|
||||
- npm
|
||||
- oci-register-machine
|
||||
- oci-systemd-hook
|
||||
- oci-umount
|
||||
- openssl
|
||||
- openssl-devel
|
||||
- ostree-devel
|
||||
- pkgconfig
|
||||
- python
|
||||
- python2-boto
|
||||
- python2-crypto
|
||||
- python2-mock
|
||||
- python-click
|
||||
- python-devel
|
||||
- python-virtualenv
|
||||
- PyYAML
|
||||
- redhat-rpm-config
|
||||
- rpcbind
|
||||
- rsync
|
||||
- sed
|
||||
- skopeo-containers
|
||||
- socat
|
||||
- tar
|
||||
- wget
|
||||
|
||||
# For results.yml Paths use rsync 'source' conventions
|
||||
artifacts: "/tmp/artifacts" # Base-directory for collection
|
||||
crio_integration_filepath: "{{ artifacts }}/testout.txt"
|
||||
crio_node_e2e_filepath: "{{ artifacts }}/junit_01.xml"
|
||||
result_dest_basedir: '{{ lookup("env","WORKSPACE") |
|
||||
default(playbook_dir, True) }}/artifacts'
|
Loading…
Reference in a new issue