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:
Chris Evich 2017-09-26 07:27:18 -04:00
parent a30a118fe6
commit 493a72bbc9
13 changed files with 101 additions and 86 deletions

View file

@ -1,4 +1,5 @@
--- ---
- name: clone bats source repo - name: clone bats source repo
git: git:
repo: "https://github.com/sstephenson/bats.git" repo: "https://github.com/sstephenson/bats.git"
@ -14,4 +15,4 @@
file: file:
src: /usr/local/bin/bats src: /usr/local/bin/bats
dest: /usr/bin/bats dest: /usr/bin/bats
state: link state: link

View file

@ -1,4 +1,5 @@
--- ---
- name: stat the expected cri-o directory - name: stat the expected cri-o directory
stat: stat:
path: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o" path: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
@ -75,4 +76,4 @@
insertafter: 'storage_option = \[' insertafter: 'storage_option = \['
regexp: 'overlay2\.override_kernel_check=1' regexp: 'overlay2\.override_kernel_check=1'
state: present state: present
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS' when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'

View file

@ -1,4 +1,5 @@
--- ---
- name: clone cri-tools source repo - name: clone cri-tools source repo
git: git:
repo: "https://github.com/kubernetes-incubator/cri-tools.git" repo: "https://github.com/kubernetes-incubator/cri-tools.git"
@ -12,4 +13,4 @@
file: file:
src: "{{ ansible_env.GOPATH }}/bin/crictl" src: "{{ ansible_env.GOPATH }}/bin/crictl"
dest: /usr/bin/crictl dest: /usr/bin/crictl
state: link state: link

View file

@ -1,4 +1,5 @@
--- ---
- name: clone kubernetes source repo - name: clone kubernetes source repo
git: git:
repo: "https://github.com/runcom/kubernetes.git" repo: "https://github.com/runcom/kubernetes.git"
@ -58,4 +59,4 @@
dest: /etc/environment dest: /etc/environment
line: 'KUBECONFIG=/var/run/kubernetes/admin.kubeconfig' line: 'KUBECONFIG=/var/run/kubernetes/admin.kubeconfig'
regexp: 'KUBECONFIG=' regexp: 'KUBECONFIG='
state: present state: present

View file

@ -1,4 +1,5 @@
--- ---
- name: clone plugins source repo - name: clone plugins source repo
git: git:
repo: "https://github.com/containernetworking/plugins.git" repo: "https://github.com/containernetworking/plugins.git"
@ -46,4 +47,4 @@
src: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins/bin/bridge" src: "{{ ansible_env.GOPATH }}/src/github.com/containernetworking/plugins/bin/bridge"
dest: "/opt/cni/bin/bridge-custom" dest: "/opt/cni/bin/bridge-custom"
mode: "o=rwx,g=rx,o=rx" mode: "o=rwx,g=rx,o=rx"
remote_src: yes remote_src: yes

View file

@ -1,4 +1,5 @@
--- ---
- name: clone runc source repo - name: clone runc source repo
git: git:
repo: "https://github.com/opencontainers/runc.git" repo: "https://github.com/opencontainers/runc.git"
@ -18,4 +19,4 @@
file: file:
src: /usr/local/sbin/runc src: /usr/local/sbin/runc
dest: /usr/bin/runc dest: /usr/bin/runc
state: link state: link

View file

@ -1,4 +1,5 @@
--- ---
- name: enable and start CRI-O - name: enable and start CRI-O
systemd: systemd:
name: crio name: crio
@ -31,11 +32,6 @@
retries: 100 retries: 100
delay: 30 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 - name: ensure directory exists for e2e reports
file: file:
path: "{{ artifacts }}" path: "{{ artifacts }}"

View file

@ -1,4 +1,5 @@
--- ---
- name: set up GOPATH if it is not already set - name: set up GOPATH if it is not already set
lineinfile: lineinfile:
dest: /etc/environment dest: /etc/environment
@ -37,4 +38,4 @@
- onsi/ginkgo/ginkgo - onsi/ginkgo/ginkgo
- onsi/gomega - onsi/gomega
- cloudflare/cfssl/cmd/... - cloudflare/cfssl/cmd/...
- jteeuwen/go-bindata/go-bindata - jteeuwen/go-bindata/go-bindata

View file

@ -1,7 +1,7 @@
- hosts: all - hosts: all
remote_user: root remote_user: root
vars: vars_files:
xunit: false - "{{ playbook_dir }}/vars.yml"
tags: tags:
- setup - setup
tasks: tasks:
@ -28,8 +28,8 @@
- hosts: all - hosts: all
remote_user: root remote_user: root
vars: vars_files:
xunit: false - "{{ playbook_dir }}/vars.yml"
tags: tags:
- integration - integration
- e2e - e2e
@ -39,8 +39,8 @@
- hosts: all - hosts: all
remote_user: root remote_user: root
vars: vars_files:
xunit: false - "{{ playbook_dir }}/vars.yml"
tags: tags:
- integration - integration
tasks: tasks:
@ -49,8 +49,10 @@
- hosts: all - hosts: all
remote_user: root remote_user: root
vars_files:
- "{{ playbook_dir }}/vars.yml"
tags: tags:
- e2e - e2e
tasks: tasks:
- name: run k8s e2e tests - name: run k8s e2e tests
include: e2e.yml include: e2e.yml

View file

@ -2,14 +2,9 @@
# vim-syntax: ansible # vim-syntax: ansible
- hosts: '{{ hosts | default("all") }}' - hosts: '{{ hosts | default("all") }}'
vars_files:
- "{{ playbook_dir }}/vars.yml"
vars: 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 _result_filepaths: [] # do not use
_dstfnbuff: [] # do not use _dstfnbuff: [] # do not use
tasks: tasks:

View file

@ -1,4 +1,5 @@
--- ---
- name: register a repo for Golang - name: register a repo for Golang
yum_repository: yum_repository:
name: 'centos-paas-sig-openshift-origin37-rpms' name: 'centos-paas-sig-openshift-origin37-rpms'
@ -14,61 +15,7 @@
package: package:
name: "{{ item }}" name: "{{ item }}"
state: present state: present
with_items: with_items: "{{ 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
async: 600 async: 600
poll: 10 poll: 10
@ -116,4 +63,4 @@
state: present state: present
- name: Flush the iptables - name: Flush the iptables
command: iptables -F command: iptables -F

View file

@ -1,4 +1,5 @@
--- ---
- name: Change test_runner.sh to use bats xunit output - name: Change test_runner.sh to use bats xunit output
lineinfile: lineinfile:
dest: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/test/test_runner.sh" 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 - name: set extra shell for non-xunit tests
set_fact: set_fact:
extra_shell_suffix: " >testout.txt 2>&1" extra_shell_suffix: " &> {{ artifacts }}/testout.txt"
when: not xunit when: not xunit
- name: run integration tests - name: run integration tests
@ -35,16 +36,16 @@
- name: Make testing output directory - name: Make testing output directory
file: file:
path: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/reports" path: "{{ artifacts }}"
state: directory state: directory
ignore_errors: yes ignore_errors: yes
when: xunit when: xunit
- name: Move all xunit files into one dir to scp - 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 when: xunit
- name: ensure we fail on bad tests - name: ensure we fail on bad tests
fail: fail:
msg: Integration tests failed! msg: Integration tests failed!
when: "'not ok' in integration_test.stdout" when: "'not ok' in integration_test.stdout"

View 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'