Skip to content

Commit 03d2186

Browse files
author
paas-bot
authored
Merge pull request #480 from samvarankashyap/master
2 parents d313ce1 + 0650e07 commit 03d2186

File tree

23 files changed

+134
-85
lines changed

23 files changed

+134
-85
lines changed

Jenkinsfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ properties(
7171
string(defaultValue: 'stable', description: 'Tag for ostree-compose image', name: 'OSTREE_COMPOSE_TAG'),
7272
string(defaultValue: 'stable', description: 'Tag for ostree-image-compose image', name: 'OSTREE_IMAGE_COMPOSE_TAG'),
7373
string(defaultValue: 'stable', description: 'Tag for singlehost test image', name: 'SINGLEHOST_TEST_TAG'),
74+
string(defaultValue: 'stable', description: 'Tag for linchpin-libvirt image', name: 'LINCHPIN_LIBVIRT_TAG'),
7475
string(defaultValue: '172.30.254.79:5000', description: 'Docker repo url for Openshift instance', name: 'DOCKER_REPO_URL'),
7576
string(defaultValue: 'continuous-infra', description: 'Project namespace for Openshift operations', name: 'OPENSHIFT_NAMESPACE'),
7677
string(defaultValue: 'jenkins', description: 'Service Account for Openshift operations', name: 'OPENSHIFT_SERVICE_ACCOUNT'),
@@ -452,7 +453,7 @@ podTemplate(name: podName,
452453
pipelineUtils.setStageEnvVars(currentStage)
453454

454455
// run linchpin workspace for e2e tests
455-
//pipelineUtils.executeInContainer(currentStage, "linchpin-libvirt", "/root/linchpin_workspace/run_e2e_tests.sh")
456+
pipelineUtils.executeInContainer(currentStage, "linchpin-libvirt", "/root/linchpin_workspace/run_e2e_tests.sh")
456457
}
457458

458459
} catch (e) {

config/Dockerfiles/linchpin-libvirt/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ RUN yum install -y python34 --nogpgcheck
3838
RUN pip install pip --upgrade && pip install setuptools --upgrade
3939
RUN ssh-keygen -f /root/.ssh/id_rsa -t rsa -N ''
4040
RUN printf "Host *\n StrictHostKeyChecking no" > /root/.ssh/config
41-
ADD linchpin_workspace /root/linchpin_workspace
41+
ADD linchpin_workspace15 /root/linchpin_workspace
4242
WORKDIR "/root/linchpin_workspace/hooks/ansible/"
4343
RUN git clone -b release-3.6 https://github.com/openshift/openshift-ansible
4444
RUN git clone -b v1.1 https://github.com/samvarankashyap/paas-sig-ci
4545
WORKDIR "/tmp/"
46-
RUN git clone -b libvirt_cloudconfig7 https://github.com/samvarankashyap/linchpin
46+
#RUN git clone -b file_module_patch https://github.com/samvarankashyap/linchpin
47+
RUN git clone -b develop https://github.com/samvarankashyap/linchpin
4748
WORKDIR "/tmp/linchpin"
4849
RUN "$PWD/install.sh"
4950
RUN cd /tmp/linchpin && python /tmp/linchpin/setup.py install
5051
WORKDIR "/root/linchpin_workspace/"
51-
5252
#END: Linchpin specific workspace installations
5353

5454
#START: Install origin-tests rpms

config/Dockerfiles/linchpin-libvirt/linchpin_workspace/PinFile

-24
This file was deleted.

config/Dockerfiles/linchpin-libvirt/linchpin_workspace/run_e2e_tests.sh

-11
This file was deleted.

config/Dockerfiles/linchpin-libvirt/linchpin_workspace/topologies/example-topology.yml

-31
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
libvirt_one:
2+
topology: example-topology.yml
3+
layout: example-layout.yml
4+
hooks:
5+
postup:
6+
- name: generate_openshift_inv
7+
type: ansible
8+
actions:
9+
- playbook: generate_openshift_inv.yml
10+
- name: install_openshift
11+
type: ansible
12+
context: false
13+
actions:
14+
- playbook: main.yml
15+
- name: run_e2e_tests
16+
type: ansible
17+
context: false
18+
actions:
19+
- playbook: main.yml
20+
- name: display_results
21+
type: shell
22+
context: false
23+
actions:
24+
- tail /tmp/e2e.log
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python
2+
import os
3+
import sys
4+
import glob
5+
6+
def get_inv_file(filepath):
7+
list_of_files = glob.glob(filepath+'*')
8+
print list_of_files
9+
latest_file = max(list_of_files, key=os.path.getctime)
10+
return latest_file
11+
12+
class FilterModule(object):
13+
''' A filter to fetch latest file '''
14+
def filters(self):
15+
return {
16+
'get_inv_file': get_inv_file
17+
}

config/Dockerfiles/linchpin-libvirt/linchpin_workspace/hooks/ansible/generate_openshift_inv/generate_openshift_inv.yml config/Dockerfiles/linchpin-libvirt/linchpin_workspace15/hooks/ansible/generate_openshift_inv/generate_openshift_inv.yml

+37-15
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,54 @@
66
tasks:
77
- name: "Pause for a while for dhcp to catch up"
88
pause:
9-
minutes: 2
9+
minutes: 5
10+
- name: "Get inventory file"
11+
set_fact:
12+
inv_file: "{{ playbook_dir }}/../../../inventories/"
1013
- name: "cat inventory out generated inventory"
11-
shell: "cat /root/linchpin_workspace/inventories/libvirt.inventory"
14+
shell: "cat {{ inv_file | get_inv_file }}"
1215
register: inventory_output
1316
- name: "debug: inventory get first ip address in inventory"
1417
debug:
1518
msg: "{{ inventory_output.stdout | get_first_ip }}"
1619
- name: "Set fact for ip_address"
1720
set_fact:
1821
ipaddr: "{{ inventory_output.stdout | get_first_ip }}"
22+
- name: "Generate single node deployment inventory"
23+
template:
24+
src: singlenode.j2
25+
dest: /tmp/singlenode.inv
26+
- name: "List out running vms"
27+
virt:
28+
command: list_vms
29+
register: out
30+
- debug:
31+
msg: "{{ out }}"
32+
- name: "destroy the vm domains"
33+
virt:
34+
command: destroy
35+
name: "{{ item }}"
36+
with_items:
37+
- "{{ out['list_vms'] }}"
38+
- name: "Pause a min for stablizing dhcp"
39+
pause:
40+
minutes: 1
41+
- name: "restart the vm domains"
42+
virt:
43+
command: start
44+
name: "{{ item }}"
45+
with_items:
46+
- "{{ out['list_vms'] }}"
1947
- name: "enable the network service"
20-
shell: "ansible -i /root/linchpin_workspace/inventories/libvirt.inventory all -u admin --become --private-key ~/.ssh/ex -a\"systemctl enable network\""
48+
shell: "ansible -i {{ inv_file | get_inv_file }} all -u admin --become --private-key ~/.ssh/ex -a\"systemctl enable network\""
2149
environment:
2250
ANSIBLE_HOST_KEY_CHECKING: False
51+
ignore_errors: yes
2352
- name: "Start the network service"
24-
shell: "ansible -i /root/linchpin_workspace/inventories/libvirt.inventory all -u admin --become --private-key ~/.ssh/ex -a\"systemctl start network\""
53+
shell: "ansible -i {{ inv_file | get_inv_file }} all -u admin --become --private-key ~/.ssh/ex -a\"systemctl start network\""
2554
environment:
2655
ANSIBLE_HOST_KEY_CHECKING: False
27-
#- name: "Add ip to /etc/hosts file "
28-
# shell: ansible -i localhost localhost -m lineinfile -a"line='{{ ipaddr }} atomic01 atomic01.example.com' destfile='/etc/hosts' state='present'"
29-
# environment:
30-
# ANSIBLE_HOST_KEY_CHECKING: False
56+
ignore_errors: yes
3157
- name: "Copy hosts file to tmp"
3258
copy:
3359
src: /etc/hosts
@@ -39,16 +65,12 @@
3965
destfile: "/tmp/hosts"
4066
state: "present"
4167
- name: "Copy hosts file to /etc/"
42-
shell: "cat /tmp/hosts > /etc/hosts"
68+
shell: "cat /tmp/hosts > /etc/hosts"
4369
- name: "Add ip to /etc/hosts file"
44-
shell: ansible -i /root/linchpin_workspace/inventories/libvirt.inventory all -u admin --become --private-key ~/.ssh/ex -m lineinfile -a"line='{{ ipaddr }} atomic01 atomic01.example.com' destfile='/etc/hosts' state='present'"
70+
shell: ansible -i {{ inv_file | get_inv_file }} all -u admin --become --private-key ~/.ssh/ex -m lineinfile -a"line='{{ ipaddr }} atomic01 atomic01.example.com' destfile='/etc/hosts' state='present'"
4571
environment:
4672
ANSIBLE_HOST_KEY_CHECKING: False
4773
- name: "Use ansible adhoc command to hostnamectl set-hostname to atomic01.example.com"
48-
shell: "ansible -i /root/linchpin_workspace/inventories/libvirt.inventory all -u admin --become --private-key ~/.ssh/ex -a \"hostnamectl set-hostname atomic01.example.com\""
74+
shell: "ansible -i {{ inv_file | get_inv_file }} all -u admin --become --private-key ~/.ssh/ex -a \"hostnamectl set-hostname atomic01.example.com\""
4975
environment:
5076
ANSIBLE_HOST_KEY_CHECKING: False
51-
- name: "Generate single node deployment inventory"
52-
template:
53-
src: singlenode.j2
54-
dest: /tmp/singlenode.inv

config/Dockerfiles/linchpin-libvirt/linchpin_workspace/hooks/ansible/install_openshift/main.yml config/Dockerfiles/linchpin-libvirt/linchpin_workspace15/hooks/ansible/install_openshift/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
- hosts: localhost
33
connection: local
44
tasks:
5+
- name: "Pause for a while to debug the state"
6+
pause:
7+
minutes: 15
58
- name: "Install openshift"
69
shell: ansible-playbook -i /tmp/singlenode.inv --private-key /root/.ssh/ex /root/linchpin_workspace/hooks/ansible/openshift-ansible/playbooks/byo/config.yml -e'openshift_disable_check=disk_availability,docker_storage,memory_availability' -e 'ansible_python_interpreter=/usr/bin/python3'
710
register: openshift_out

config/Dockerfiles/linchpin-libvirt/linchpin_workspace15/inventories/.empty

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh -x
2+
3+
su - -c "echo Running as Username $USER"
4+
echo "Inserting img_src"
5+
img_src=$(find /workDir/workspace -name "untested-atomic.qcow2" | tail -n 1)
6+
sed -i "s| image_src\:.*| image_src\: \"file\:\/\/$img_src\"|" /root/linchpin_workspace/topologies/example-topology.yml
7+
su - -c "mkdir ~/.ssh"
8+
9+
retries=3
10+
11+
for ((i=0; i<retries; i++)); do
12+
echo "Running linchpin up inside libvirt container"
13+
su - -c "linchpin -v -w /root/linchpin_workspace up" && su - -c "linchpin -v -w /root/linchpin_workspace drop"
14+
[[ $? -eq 0 ]] && break
15+
16+
echo "something went wrong, let's wait 20 seconds and retry"
17+
sleep 20
18+
done
19+
20+
[[ $retries -eq i ]] && { echo "Failed!"; exit 1; }
21+
22+
cat /tmp/e2e.log
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
topology_name: "libvirt"
3+
resource_groups:
4+
- resource_group_name: "ex"
5+
res_group_type: "libvirt"
6+
res_defs:
7+
- res_name: "f27test"
8+
res_type: "libvirt_node"
9+
uri: 'qemu:///system'
10+
count: 1
11+
image_src: "file:///home/output/images/untested-atomic.qcow2"
12+
memory: 3096
13+
vcpus: 2
14+
arch: x86_64
15+
network_bridge: 'virbr3'
16+
networks:
17+
- name: default
18+
additional_storage: 10G
19+
cloud_config:
20+
users:
21+
- name: admin
22+
gecos: Admin User
23+
groups: wheel
24+
sudo: ALL=(ALL) NOPASSWD:ALL
25+
ssh-import-id: None
26+
lock_passwd: true

0 commit comments

Comments
 (0)