cri-o/contrib/test/crio-integration-playbook.yaml

359 lines
11 KiB
YAML
Raw Normal View History

## This playbook expects --extra-vars "commit=<commit>"
## and either --extra-vars "pullrequest=<PR #>" or
## --skip-tags pr
- hosts: all
remote_user: root
vars:
xunit: false
tasks:
- name: Update all packages
yum:
name: '*'
state: latest
async: 600
poll: 10
when: (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS')
ignore_errors: true
- name: Update all packages on Fedora
dnf:
name: '*'
state: latest
async: 600
poll: 10
when: ansible_distribution == 'Fedora'
- name: Make sure we have all required packages
yum:
name: "{{ item }}"
state: latest
with_items:
- wget
- git
- make
- gcc
- tar
- libseccomp-devel
- golang
- glib2-devel
- glibc-static
- container-selinux
- btrfs-progs-devel
- device-mapper-devel
- glibc-devel
- gpgme-devel
- libassuan-devel
- libgpg-error-devel
- pkgconfig
- json-glib-devel
- skopeo-containers
async: 600
poll: 10
when: (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS')
- name: Make sure we have all required packages on Fedora
dnf:
name: "{{ item }}"
state: latest
with_items:
- wget
- git
- make
- gcc
- tar
- libseccomp-devel
- golang
- glib2-devel
- glibc-static
- container-selinux
- btrfs-progs-devel
- device-mapper-devel
- glibc-devel
- gpgme-devel
- libassuan-devel
- libgpg-error-devel
- pkgconfig
- json-glib-devel
- skopeo-containers
async: 600
poll: 10
when: ansible_distribution == 'Fedora'
- name: Make testing directories to conform to testing standards
file:
path: "{{ item }}"
state: directory
with_items:
- /root/src/github.com/kubernetes-incubator
- /root/src/github.com/opencontainers
- /opt/cni/bin
- /etc/cni/net.d
- /usr/local/go
- name: install Golang upstream in CentOS
shell: |
curl -fsSL "https://golang.org/dl/go1.8.1.linux-amd64.tar.gz" \
| tar -xzC /usr/local
when: ansible_distribution == 'CentOS'
- name: Set custom Golang path for CentOS
lineinfile:
dest: /root/.bashrc
line: 'export PATH=/usr/local/go/bin:$PATH'
insertafter: 'EOF'
regexp: 'export PATH=/usr/local/go/bin:$PATH'
state: present
when: ansible_distribution == 'CentOS'
- name: set sysctl vm.overcommit_memory=1 for CentOS
shell: |
sysctl -w vm.overcommit_memory=1
when: ansible_distribution == 'CentOS'
- name: disable selinux on CentOS :(
shell: |
setenforce 0
when: ansible_distribution == 'CentOS'
- name: git clone bats repo
git:
repo: https://github.com/sstephenson/bats.git
dest: /root/src/bats
async: 600
poll: 10
- name: Fetch the xunit feature PR for bats
shell: "git fetch origin +refs/pull/161/head:refs/remotes/origin/pr/161"
args:
chdir: /root/src/bats
async: 600
poll: 10
when: xunit
- name: Git checkout the xunit PR for bats
shell: "git checkout origin/pr/161"
args:
chdir: /root/src/bats
async: 600
poll: 10
when: xunit
- name: git clone runc repo
git:
repo: https://github.com/opencontainers/runc
dest: /root/src/github.com/opencontainers/runc
async: 600
poll: 10
- name: git clone cri-o repo
git:
repo: https://github.com/kubernetes-incubator/cri-o
dest: /root/src/github.com/kubernetes-incubator/cri-o
async: 600
poll: 10
- name: git clone cni repo
git:
repo: https://github.com/containernetworking/cni
dest: /root/src/github.com/containernetworking/cni
async: 600
poll: 10
- name: Git fetch the PR
shell: "git fetch origin +refs/pull/{{ pullrequest }}/head:refs/remotes/origin/pr/{{ pullrequest }}"
args:
chdir: /root/src/github.com/kubernetes-incubator/cri-o
tags:
- pr
async: 600
poll: 10
- name: Git checkout the commit into working branch
shell: "git checkout {{ commit }}"
args:
chdir: /root/src/github.com/kubernetes-incubator/cri-o
async: 600
poll: 10
- name: Install bats
command: bats/install.sh /usr/local
args:
chdir: /root/src
- name: Add go testing dir to bashrc files
lineinfile:
dest: /root/.bashrc
line: 'export GOPATH=/root'
insertafter: 'EOF'
regexp: 'export GOPATH=/root'
state: present
- name: Source the bashrc file
shell: source /root/.bashrc
- name: Build cni networking
shell: ./build.sh
args:
chdir: /root/src/github.com/containernetworking/cni
- name: cp bin to cni bin dir
shell: cp /root/src/github.com/containernetworking/cni/bin/* /opt/cni/bin
- name: curl ocid bridge conf file for cni networking
get_url:
url: https://raw.githubusercontent.com/kubernetes-incubator/cri-o/master/contrib/cni/10-ocid-bridge.conf
dest: /etc/cni/net.d/10-ocid-bridge.conf
- name: curl loopback conf for cni networking
get_url:
url: https://raw.githubusercontent.com/kubernetes-incubator/cri-o/master/contrib/cni/99-loopback.conf
dest: /etc/cni/net.d/99-loopback.conf
- name: make clean
make:
target: clean
chdir: /root/src/github.com/opencontainers/runc
async: 600
poll: 10
- name: make runc
make:
params: BUILDTAGS="seccomp selinux"
chdir: /root/src/github.com/opencontainers/runc
async: 600
poll: 10
- name: install runc
make:
target: install
chdir: /root/src/github.com/opencontainers/runc
async: 600
poll: 10
- name: Change test_runner.sh to use bats xunit output
lineinfile:
dest: /root/src/github.com/kubernetes-incubator/cri-o/test/test_runner.sh
line: 'execute time bats --tap --junit $TESTS'
regexp: 'execute time bats --tap \$TESTS'
state: present
when: xunit
- name: Copy plugin args so tests dont hang
shell: "cp test/plugin_test_args.bash /opt/cni/bin/"
args:
chdir: /root/src/github.com/kubernetes-incubator/cri-o/
- name: run integration tests RHEL
shell: 'CGROUP_MANAGER=systemd STORAGE_OPTS="--storage-driver=overlay2 --storage-opt overlay2.override_kernel_check=1" make localintegration > testout.txt'
args:
chdir: /root/src/github.com/kubernetes-incubator/cri-o
async: 3600
poll: 10
ignore_errors: yes
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'
- name: run integration tests RHEL with xunit results
shell: 'CGROUP_MANAGER=systemd STORAGE_OPTS="--storage-driver=overlay2 --storage-opt overlay2.override_kernel_check=1" make localintegration'
args:
chdir: /root/src/github.com/kubernetes-incubator/cri-o
async: 3600
poll: 10
ignore_errors: yes
when: (ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS') and xunit
- name: run integration tests Fedora
shell: 'CGROUP_MANAGER=systemd STORAGE_OPTS="--storage-driver=overlay2" make localintegration > testout.txt'
args:
chdir: /root/src/github.com/kubernetes-incubator/cri-o
async: 3600
poll: 10
ignore_errors: yes
when: ansible_distribution == 'Fedora'
- name: run integration tests Fedora with xunit results
shell: 'CGROUP_MANAGER=systemd STORAGE_OPTS="--storage-driver=overlay2" make localintegration'
args:
chdir: /root/src/github.com/kubernetes-incubator/cri-o
async: 3600
poll: 10
ignore_errors: yes
when: (ansible_distribution == 'Fedora' and xunit)
- name: Make testing output directory
file:
path: /root/src/github.com/kubernetes-incubator/cri-o/reports
state: directory
ignore_errors: yes
when: xunit
- name: Move all xunit files into one dir to scp
shell: 'mv /root/src/github.com/kubernetes-incubator/cri-o/test/TestReport-bats*.xml /root/src/github.com/kubernetes-incubator/cri-o/reports/'
when: xunit
# XXX: kube tests from now on
- name: git clone k8s repo
git:
repo: https://github.com/kubernetes/kubernetes
dest: /root/src/k8s.io/kubernetes
version: 2899f47bc
force: yes
async: 600
poll: 10
- name: make and install CRI-O
shell: |
make install.tools && \
make && \
make install && \
make install.systemd && \
make install.config
args:
chdir: /root/src/github.com/kubernetes-incubator/cri-o
async: 600
poll: 10
- name: link runc
file: src=/usr/local/sbin/runc dest=/usr/bin/runc state=link
- name: run CRI-O with systemd cgroup manager
replace:
regexp: 'cgroupfs'
replace: 'systemd'
name: /etc/crio/crio.conf
backup: yes
- name: run with overlay2
replace:
regexp: 'storage_driver = ""'
replace: 'storage_driver = "overlay2"'
name: /etc/crio/crio.conf
backup: yes
- name: add overlay2 storage opts on RHEL/CentOS
lineinfile:
dest: /etc/crio/crio.conf
line: '"overlay2.override_kernel_check=1"'
insertafter: 'storage_option = \['
regexp: 'overlay2\.override_kernel_check=1'
state: present
when: ansible_distribution == 'RHEL' or ansible_distribution == 'CentOS'
- name: enable and start CRI-O
systemd:
name: crio
state: started
enabled: yes
daemon_reload: yes
async: 600
poll: 10
- name: disable selinux for k8s conformance tests
shell: |
setenforce 0
async: 600
poll: 10
- name: Go get the go-bindata file
shell: go get -u github.com/jteeuwen/go-bindata/go-bindata
args:
chdir: /root/src/k8s.io/kubernetes
async: 600
poll: 10
- name: Install etcd
command: hack/install-etcd.sh
args:
chdir: /root/src/k8s.io/kubernetes
async: 600
poll: 10
- name: Install necessary github go packages
shell: go get github.com/onsi/ginkgo/ginkgo ; go get github.com/onsi/gomega ; go get -u github.com/cloudflare/cfssl/cmd/...
args:
chdir: /root/src/k8s.io/kubernetes
async: 600
poll: 10
- name: Add path to bashrc files
lineinfile:
dest: /root/.bashrc
line: 'export PATH=$PATH:/root/src/k8s.io/kubernetes/third_party/etcd'
insertafter: 'EOF'
regexp: 'export PATH=\$PATH:/root/src/k8s.io/kubernetes/third_party/etcd'
state: present
- name: gather correct hostname
shell: |
cat /etc/hostname
register: hostname
- name: inject hostname into /etc/hosts
lineinfile:
dest: /etc/hosts
line: '127.0.0.1 {{ hostname.stdout }}'
insertafter: 'EOF'
regexp: '127\.0\.0\.1\s+{{ hostname.stdout }}'
state: present
- name: run k8s tests
shell: |
make test-e2e-node PARALLELISM=1 RUNTIME=remote CONTAINER_RUNTIME_ENDPOINT=/var/run/crio.sock IMAGE_SERVICE_ENDPOINT=/var/run/crio.sock TEST_ARGS="--prepull-images=true" FOCUS="\[Conformance\]" >> node-e2e.log
args:
chdir: /root/src/k8s.io/kubernetes
async: 7200
poll: 10
ignore_errors: true
# XXX: tests on RHEL/CentOS are unreliable fow now
when: ansible_distribution == 'Fedora'