summaryrefslogtreecommitdiffstats
path: root/docker/Dockerfile
blob: 99d18cade5210543d96bb272a52ff03df6a950d9 (plain)
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
########################################
#   Docker container for FUNCTEST
########################################
# Purpose: run all the tests against the POD
#          from a pre-installed docker image
#
# Maintained by Jose Lausuch
# Build:
#    $ docker build -t opnfv/functest:tag .
#
# Execution:
#    $ docker run -t -i \
#      -e "INSTALLER_TYPE=fuel/foreman" \
#      -e "INSTALLER_IP=10.20.0.2/172.30.10.73" \
#      -v $(pwd)/config_functest.yaml:/home/opnfv/functest/conf/config_functest.yaml
#      opnfv/functest /bin/bash
#
# NOTE: providing config_functest.yaml is optional. If not provided, it will
#       use the default one located in the repo


FROM ubuntu:14.04
MAINTAINER Jose Lausuch <jose.lausuch@ericsson.com>
LABEL version="0.1" description="OPNFV Functest Docker container"

ENV HOME /home/opnfv
ENV repos_dir /home/opnfv/repos
ENV creds /home/opnfv/functest/conf/openstack.creds
WORKDIR /home/opnfv

# Packaged dependencies
RUN apt-get update && apt-get install -y \
ssh \
sshpass \
curl \
git \
gcc \
wget \
python-dev \
python-pip \
bundler \
postgresql \
build-essential \
libpq-dev \
libxslt-dev \
libssl-dev \
libgmp3-dev \
libxml2-dev \
libffi-dev \
crudini \
--no-install-recommends


RUN mkdir -p ${repos_dir}
RUN mkdir -p /root/.ssh
RUN chmod 700 /root/.ssh

RUN git config --global http.sslVerify false
RUN git clone https://gerrit.opnfv.org/gerrit/functest ${repos_dir}/functest
RUN git clone https://gerrit.opnfv.org/gerrit/releng ${repos_dir}/releng
RUN git clone https://github.com/openstack/rally.git ${repos_dir}/rally
RUN git clone https://github.com/opendaylight/integration.git ${repos_dir}/odl_integration
RUN git clone -b stable https://github.com/boucherv-orange/clearwater-live-test ${repos_dir}/vims-test
RUN git clone https://github.com/openstack/networking-bgpvpn ${repos_dir}/bgpvpn

RUN pip install -r ${repos_dir}/functest/docker/requirements.pip

RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
RUN curl -L https://get.rvm.io | bash -s stable
RUN bash -c 'source /etc/profile.d/rvm.sh ; rvm autolibs enable ; rvm install 1.9.3 ; rvm use 1.9.3'
RUN bash -c 'source /etc/profile.d/rvm.sh ; cd ${repos_dir}/vims-test ; bundle install'

ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img /home/opnfv/functest/data/
n class="nv"> OPENSTACK_OSA_GIT_URL }}", dest: "{{ OPENSTACK_OSA_PATH }}", version: "{{ OPENSTACK_OSA_VERSION }}" } - hosts: opnfv remote_user: root vars_files: - ../var/opnfv.yml tasks: - name: Load distribution variables include_vars: file: ../var/{{ ansible_os_family }}.yml - name: Synchronize local development releng-xci repository to XCI paths synchronize: src: "{{ OPNFV_RELENG_DEV_PATH }}" dest: "{{ OPNFV_RELENG_PATH }}" recursive: yes delete: yes when: - OPNFV_RELENG_DEV_PATH != "" - name: Synchronize local development openstack-ansible repository to XCI paths synchronize: src: "{{ OPENSTACK_OSA_DEV_PATH }}" dest: "{{ OPENSTACK_OSA_PATH }}" recursive: yes delete: yes when: - OPENSTACK_OSA_DEV_PATH != "" - hosts: opnfv remote_user: root vars_files: - ../var/flavor-vars.yml - ../var/opnfv.yml pre_tasks: - name: Load distribution variables include_vars: file: ../var/{{ ansible_os_family }}.yml roles: - role: configure-network tasks: - name: generate SSH keys shell: ssh-keygen -b 2048 -t rsa -f /root/.ssh/id_rsa -q -N "" args: creates: /root/.ssh/id_rsa - name: ensure ssh key storage directory exists file: path: "{{ OPNFV_SSH_HOST_KEYS_PATH }}" state: directory - name: fetch public key fetch: src="/root/.ssh/id_rsa.pub" dest="{{ OPNFV_SSH_HOST_KEYS_PATH }}" - name: copy flavor inventory shell: "/bin/cp -rf {{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/inventory {{OPNFV_RELENG_PATH}}/xci/playbooks" - name: copy flavor vars shell: "/bin/cp -rf {{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/flavor-vars.yml {{OPNFV_RELENG_PATH}}/xci/var" - name: copy openstack_deploy shell: "/bin/cp -rf {{OPENSTACK_OSA_PATH}}/etc/openstack_deploy {{OPENSTACK_OSA_ETC_PATH}}" - name: copy openstack_user_config.yml shell: "/bin/cp -rf {{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/openstack_user_config.yml {{OPENSTACK_OSA_ETC_PATH}}" - name: copy all user override files shell: "/bin/cp -rf {{XCI_FLAVOR_ANSIBLE_FILE_PATH}}/user_*.yml {{OPENSTACK_OSA_ETC_PATH}}" - name: copy cinder.yml shell: "/bin/cp -rf {{OPNFV_RELENG_PATH}}/xci/file/cinder.yml {{OPENSTACK_OSA_ETC_PATH}}/env.d" # TODO: We need to get rid of this as soon as the issue is fixed upstream - name: change the haproxy state from disable to enable replace: dest: "{{OPENSTACK_OSA_PATH}}/playbooks/os-keystone-install.yml" regexp: '(\s+)haproxy_state: disabled' replace: '\1haproxy_state: enabled' - name: copy OPNFV OpenStack playbook shell: "/bin/cp -rf {{OPNFV_RELENG_PATH}}/xci/file/setup-openstack.yml {{OPENSTACK_OSA_PATH}}/playbooks" - name: copy pinned versions of OSA Roles and global requirements shell: "/bin/cp -rf {{OPNFV_RELENG_PATH}}/xci/file/{{ item }} {{OPENSTACK_OSA_PATH}}/{{ item }}" with_items: - "ansible-role-requirements.yml" - "global-requirement-pins.txt" when: - OPENSTACK_OSA_VERSION != "master" - name: copy pinned versions of OpenStack services shell: "/bin/cp -rf {{OPNFV_RELENG_PATH}}/xci/file/openstack_services.yml {{OPENSTACK_OSA_PATH}}/playbooks/defaults/repo_packages/openstack_services.yml" when: - OPENSTACK_OSA_VERSION != "master" - name: bootstrap ansible on opnfv host command: "/bin/bash ./scripts/bootstrap-ansible.sh" args: chdir: "{{OPENSTACK_OSA_PATH}}" - name: install python Crypto module package: name: "{{ python_crypto_package_name }}" - name: install PyYAML pip: name: pyyaml state: present - name: generate password token command: "python pw-token-gen.py --file {{OPENSTACK_OSA_ETC_PATH}}/user_secrets.yml" args: chdir: "{{OPENSTACK_OSA_PATH}}/scripts" - name: check if certificate directory /etc/ssl/certs exists already stat: path=/etc/ssl/certs register: check_etc_ssl_certs - name: create certificate directory /etc/ssl/certs file: path: "/etc/ssl/certs" state: directory when: check_etc_ssl_certs.stat.exists == false - name: create key directory /etc/ssl/private file: path: "/etc/ssl/private" state: directory - name: copy certificate to /etc/ssl/certs copy: src: "/etc/ssl/certs/xci.crt" dest: "/etc/ssl/certs/" - name: read remote key from /etc/ssl/private set_fact: xci_ssl_key: "{{ lookup('pipe', 'sudo cat /etc/ssl/private/xci.key' ) }}" - name: copy key to /etc/ssl/private copy: content: "{{ xci_ssl_key }}" dest: "/etc/ssl/private/xci.key" become: true - name: install opnfv required packages package: name: "{{ opnfv_required_packages }}" state: latest - name: install opnfv required pip packages pip: name: "{{ opnfv_required_pip }}" state: present - hosts: localhost remote_user: root vars_files: - ../var/opnfv.yml tasks: - name: Generate authorized_keys shell: "/bin/cat {{ OPNFV_SSH_HOST_KEYS_PATH }}/opnfv/root/.ssh/id_rsa.pub >> ../file/authorized_keys" - name: Append public keys to authorized_keys shell: "/bin/cat {{ ansible_env.HOME }}/.ssh/id_rsa.pub >> ../file/authorized_keys" - hosts: opnfv remote_user: root vars_files: - ../var/flavor-vars.yml - ../var/opnfv.yml - "{{ XCI_FLAVOR_ANSIBLE_FILE_PATH }}/user_variables.yml" pre_tasks: - name: Load distribution variables include_vars: file: ../var/{{ ansible_os_family }}.yml roles: - role: "openstack-ansible-openstack_openrc" tasks: - name: add extra insecure flag to generated openrc blockinfile: dest: "{{ ansible_env.HOME }}/openrc" block: | export OS_INSECURE=true - name: fetch generated openrc fetch: src: "{{ ansible_env.HOME }}/openrc" dest: "{{ XCI_DEVEL_ROOT }}/" flat: true