Merge pull request #963 from stevekuznetsov/skuznets/assume-golang
Install Golang from source
This commit is contained in:
commit
a8ea146d71
8 changed files with 100 additions and 120 deletions
21
contrib/test/integration/README.md
Normal file
21
contrib/test/integration/README.md
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
# Fedora and RHEL Integration and End-to-End Tests
|
||||||
|
|
||||||
|
This directory contains playbooks to set up for and run the integration and
|
||||||
|
end-to-end tests for CRI-O on RHEL and Fedora hosts. Two entrypoints exist:
|
||||||
|
|
||||||
|
- `main.yml`: sets up the machine and runs tests
|
||||||
|
- `results.yml`: gathers test output to `/tmp/artifacts`
|
||||||
|
|
||||||
|
When running `main.yml`, three tags are present:
|
||||||
|
|
||||||
|
- `setup`: run all tasks to set up the system for testing
|
||||||
|
- `e2e`: build CRI-O from source and run Kubernetes node E2Es
|
||||||
|
- `integration`: build CRI-O from source and run the local integration suite
|
||||||
|
|
||||||
|
The playbooks assume the following things about your system:
|
||||||
|
|
||||||
|
- on RHEL, the server and extras repos are configured and certs are present
|
||||||
|
- `ansible` is installed and the host is boot-strapped to allow `ansible` to run against it
|
||||||
|
- the `$GOPATH` is set and present for all shells (*e.g.* written in `/etc/environment`)
|
||||||
|
- CRI-O is checked out to the correct state at `${GOPATH}/src/github.com/kubernetes-incubator/cri-o`
|
||||||
|
- the user running the playbook has access to passwordless `sudo`
|
|
@ -4,7 +4,6 @@
|
||||||
git:
|
git:
|
||||||
repo: "https://github.com/sstephenson/bats.git"
|
repo: "https://github.com/sstephenson/bats.git"
|
||||||
dest: "{{ ansible_env.GOPATH }}/src/github.com/sstephenson/bats"
|
dest: "{{ ansible_env.GOPATH }}/src/github.com/sstephenson/bats"
|
||||||
version: "{{ 'pull/161/head' if xunit else 'HEAD' }}"
|
|
||||||
|
|
||||||
- name: install bats
|
- name: install bats
|
||||||
command: "./install.sh /usr/local"
|
command: "./install.sh /usr/local"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
version: "16e6fe4d7199c5689db4630a9330e6a8a12cecd1"
|
version: "16e6fe4d7199c5689db4630a9330e6a8a12cecd1"
|
||||||
|
|
||||||
- name: install crictl
|
- name: install crictl
|
||||||
command: "go install github.com/kubernetes-incubator/cri-tools/cmd/crictl"
|
command: "/usr/bin/go install github.com/kubernetes-incubator/cri-tools/cmd/crictl"
|
||||||
|
|
||||||
- name: link crictl
|
- name: link crictl
|
||||||
file:
|
file:
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
- name: Buffer the e2e testing command to workaround Ansible YAML folding "feature"
|
- name: Buffer the e2e testing command to workaround Ansible YAML folding "feature"
|
||||||
set_fact:
|
set_fact:
|
||||||
e2e_shell_cmd: >
|
e2e_shell_cmd: >
|
||||||
go run hack/e2e.go
|
/usr/bin/go run hack/e2e.go
|
||||||
--test
|
--test
|
||||||
-test_args="-host=https://{{ ansible_default_ipv4.address }}:6443
|
-test_args="-host=https://{{ ansible_default_ipv4.address }}:6443
|
||||||
--ginkgo.focus=\[Conformance\]
|
--ginkgo.focus=\[Conformance\]
|
||||||
|
|
|
@ -1,22 +1,30 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: set up GOPATH if it is not already set
|
- name: fetch Golang
|
||||||
lineinfile:
|
unarchive:
|
||||||
dest: /etc/environment
|
remote_src: yes
|
||||||
line: 'GOPATH={{ ansible_env.HOME }}/go'
|
src: https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
|
||||||
regexp: 'GOPATH='
|
dest: /usr/local
|
||||||
state: present
|
|
||||||
when: ansible_env.GOPATH is not defined
|
- name: link go toolchain
|
||||||
|
file:
|
||||||
|
src: "/usr/local/go/bin/{{ item }}"
|
||||||
|
dest: "/usr/bin/{{ item }}"
|
||||||
|
state: link
|
||||||
|
with_items:
|
||||||
|
- go
|
||||||
|
- gofmt
|
||||||
|
- godoc
|
||||||
|
|
||||||
- name: ensure user profile exists
|
- name: ensure user profile exists
|
||||||
file:
|
file:
|
||||||
path: "{{ ansible_user_dir }}/.profile"
|
path: "{{ ansible_user_dir }}/.profile"
|
||||||
state: touch
|
state: touch
|
||||||
|
|
||||||
- name: set up PATH for Go binaries
|
- name: set up PATH for Go toolchain and built binaries
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: "{{ ansible_user_dir }}/.profile"
|
dest: "{{ ansible_user_dir }}/.profile"
|
||||||
line: 'PATH={{ ansible_env.PATH }}:{{ ansible_env.GOPATH }}/bin'
|
line: 'PATH={{ ansible_env.PATH }}:{{ ansible_env.GOPATH }}/bin:/usr/local/go/bin'
|
||||||
regexp: '^PATH='
|
regexp: '^PATH='
|
||||||
state: present
|
state: present
|
||||||
|
|
||||||
|
@ -39,3 +47,5 @@
|
||||||
- onsi/gomega
|
- onsi/gomega
|
||||||
- cloudflare/cfssl/cmd/...
|
- cloudflare/cfssl/cmd/...
|
||||||
- jteeuwen/go-bindata/go-bindata
|
- jteeuwen/go-bindata/go-bindata
|
||||||
|
- vbatts/git-validation
|
||||||
|
- cpuguy83/go-md2man
|
||||||
|
|
|
@ -1,21 +1,59 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
- name: register a repo for Golang
|
|
||||||
yum_repository:
|
|
||||||
name: 'centos-paas-sig-openshift-origin37-rpms'
|
|
||||||
state: present
|
|
||||||
description: 'CentOS PaaS SIG Origin 3.7 Repository'
|
|
||||||
baseurl: 'https://cbs.centos.org/repos/paas7-openshift-origin37-candidate/x86_64/os/'
|
|
||||||
includepkgs: 'golang'
|
|
||||||
gpgcheck: no
|
|
||||||
sslverify: no
|
|
||||||
when: ansible_distribution in ['RedHat', 'CentOS']
|
|
||||||
|
|
||||||
- name: Make sure we have all required packages
|
- name: Make sure we have all required packages
|
||||||
package:
|
package:
|
||||||
name: "{{ item }}"
|
name: "{{ item }}"
|
||||||
state: present
|
state: present
|
||||||
with_items: "{{ rpm_pkgs }}"
|
with_items:
|
||||||
|
- container-selinux
|
||||||
|
- curl
|
||||||
|
- device-mapper-devel
|
||||||
|
- expect
|
||||||
|
- findutils
|
||||||
|
- gcc
|
||||||
|
- git
|
||||||
|
- glib2-devel
|
||||||
|
- glibc-devel
|
||||||
|
- glibc-static
|
||||||
|
- 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
|
||||||
|
- oci-register-machine
|
||||||
|
- oci-systemd-hook
|
||||||
|
- oci-umount
|
||||||
|
- openssl
|
||||||
|
- openssl-devel
|
||||||
|
- ostree-devel
|
||||||
|
- pkgconfig
|
||||||
|
- python
|
||||||
|
- python2-boto
|
||||||
|
- python2-crypto
|
||||||
|
- python-devel
|
||||||
|
- python-virtualenv
|
||||||
|
- PyYAML
|
||||||
|
- redhat-rpm-config
|
||||||
|
- rpcbind
|
||||||
|
- rsync
|
||||||
|
- sed
|
||||||
|
- skopeo-containers
|
||||||
|
- socat
|
||||||
|
- tar
|
||||||
|
- wget
|
||||||
async: 600
|
async: 600
|
||||||
poll: 10
|
poll: 10
|
||||||
|
|
||||||
|
@ -57,11 +95,6 @@
|
||||||
value: 1
|
value: 1
|
||||||
when: ansible_distribution == 'CentOS'
|
when: ansible_distribution == 'CentOS'
|
||||||
|
|
||||||
- name: disable selinux see https://github.com/kubernetes-incubator/cri-o/issues/528
|
|
||||||
selinux:
|
|
||||||
policy: targeted
|
|
||||||
state: permissive
|
|
||||||
|
|
||||||
- name: inject hostname into /etc/hosts
|
- name: inject hostname into /etc/hosts
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: /etc/hosts
|
dest: /etc/hosts
|
||||||
|
@ -75,3 +108,4 @@
|
||||||
|
|
||||||
- name: Update the kernel cmdline to include quota support
|
- name: Update the kernel cmdline to include quota support
|
||||||
command: grubby --update-kernel=ALL --args="rootflags=pquota"
|
command: grubby --update-kernel=ALL --args="rootflags=pquota"
|
||||||
|
when: ansible_distribution in ['RedHat', 'CentOS']
|
|
@ -1,13 +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"
|
|
||||||
line: 'execute time bats --tap --junit $TESTS'
|
|
||||||
regexp: 'execute time bats --tap \$TESTS'
|
|
||||||
state: present
|
|
||||||
when: xunit
|
|
||||||
|
|
||||||
- name: Make testing output verbose so it can be converted to xunit
|
- name: Make testing output verbose so it can be converted to xunit
|
||||||
lineinfile:
|
lineinfile:
|
||||||
dest: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/hack/make-rules/test.sh"
|
dest: "{{ ansible_env.GOPATH }}/src/k8s.io/kubernetes/hack/make-rules/test.sh"
|
||||||
|
@ -20,32 +12,14 @@
|
||||||
extra_storage_opts: " --storage-opt overlay.override_kernel_check=1"
|
extra_storage_opts: " --storage-opt overlay.override_kernel_check=1"
|
||||||
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'
|
when: ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS'
|
||||||
|
|
||||||
- name: set extra shell for non-xunit tests
|
- name: ensure directory exists for e2e reports
|
||||||
set_fact:
|
|
||||||
extra_shell_suffix: " &> {{ artifacts }}/testout.txt"
|
|
||||||
when: not xunit
|
|
||||||
|
|
||||||
- name: run integration tests
|
|
||||||
shell: "CGROUP_MANAGER=cgroupfs STORAGE_OPTS='--storage-driver=overlay{{ extra_storage_opts | default('') }}' make localintegration{{ extra_shell_suffix }}"
|
|
||||||
args:
|
|
||||||
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
|
|
||||||
ignore_errors: yes
|
|
||||||
register: integration_test
|
|
||||||
async: 5400
|
|
||||||
poll: 30
|
|
||||||
|
|
||||||
- name: Make testing output directory
|
|
||||||
file:
|
file:
|
||||||
path: "{{ artifacts }}"
|
path: "{{ artifacts }}"
|
||||||
state: directory
|
state: directory
|
||||||
ignore_errors: yes
|
|
||||||
when: xunit
|
|
||||||
|
|
||||||
- name: Move all xunit files into one dir to scp
|
- name: run integration tests
|
||||||
shell: "mv {{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o/test/TestReport-bats*.xml {{ artifacts }}"
|
shell: "CGROUP_MANAGER=cgroupfs STORAGE_OPTS='--storage-driver=overlay{{ extra_storage_opts | default('') }}' make localintegration >& {{ artifacts }}/testout.txt"
|
||||||
when: xunit
|
args:
|
||||||
|
chdir: "{{ ansible_env.GOPATH }}/src/github.com/kubernetes-incubator/cri-o"
|
||||||
- name: ensure we fail on bad tests
|
async: 5400
|
||||||
fail:
|
poll: 30
|
||||||
msg: Integration tests failed!
|
|
||||||
when: "'not ok' in integration_test.stdout"
|
|
||||||
|
|
|
@ -1,63 +1,5 @@
|
||||||
---
|
---
|
||||||
|
|
||||||
# Enable using BATS to output integration-test xunit output (FIXME: broken? Kill it?)
|
|
||||||
xunit: false
|
|
||||||
|
|
||||||
rpm_pkgs:
|
|
||||||
- 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
|
# For results.yml Paths use rsync 'source' conventions
|
||||||
artifacts: "/tmp/artifacts" # Base-directory for collection
|
artifacts: "/tmp/artifacts" # Base-directory for collection
|
||||||
crio_integration_filepath: "{{ artifacts }}/testout.txt"
|
crio_integration_filepath: "{{ artifacts }}/testout.txt"
|
||||||
|
|
Loading…
Reference in a new issue