Skip to content

Commit 123b0ef

Browse files
committed
Switch to use upstream repos from Juniper
- move cloned repositories do vars dir in checkout_repos role - clone all repositories contrail-dev-env depends on in checkout_repos target - use Zuulv3 like directory layout for source code - change Vagrantfile to mirror contrail-dev-env playbooks changes
1 parent 2eeae41 commit 123b0ef

File tree

12 files changed

+82
-48
lines changed

12 files changed

+82
-48
lines changed

Makefile

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
11
sandbox_path=$(HOME)/contrail-5.0
2+
repos_dir=$(HOME)/src/review.opencontrail.org/Juniper/
23
ansible_playbook=ansible-playbook -i inventory --extra-vars @vars.yaml --extra-vars @dev_config.yaml
34

45
.PHONY: presetup checkout_vnc setup build rpm containers deploy unittest sanity all
56

67
# this is the first bootstrap of the packages for the tool itself
78
# not a part of the "all" target, should be invoked manually
89
presetup:
9-
yum install -y epel-release ansible vim
10+
yum install -y epel-release ansible git vim
1011

1112
# optional step, used when the sandbox is not mounted from host system
12-
checkout_vnc: setup
13+
checkout_repos:
14+
$(ansible_playbook) provisioning/checkout_repos.yaml
1315
scripts/checkout_vnc.sh $(sandbox_path)
1416

1517
# install all the primary build deps, docker engine etc.
16-
setup:
17-
$(ansible_playbook) provisioning/setup1.yaml
18-
sudo ansible-playbook -e '{"CREATE_CONTAINERS":false, "CONTAINER_VM_CONFIG": {"network": {"ntpserver":"127.0.0.1"}}, "CONTAINER_REGISTRY": "172.17.0.1:6666", "REGISTRY_PRIVATE_INSECURE": true, "CONFIGURE_VMS":true, "roles": {"localhost":[]}}' -i inventory -c local code/contrail-ansible-deployer/playbooks/deploy.yml
19-
$(ansible_playbook) provisioning/setup2.yaml
18+
setup: checkout_repos
19+
$(ansible_playbook) provisioning/setup_vm.yaml
20+
sudo ansible-playbook -e '{"CREATE_CONTAINERS":false, "CONTAINER_VM_CONFIG": {"network": {"ntpserver":"127.0.0.1"}}, "contrail_configuration": {"CONTAINER_REGISTRY": "172.17.0.1:6666"}, "REGISTRY_PRIVATE_INSECURE": true, "CONFIGURE_VMS":true, "roles": {"localhost":[]}}' -i inventory -c local $(repos_dir)/contrail-ansible-deployer/playbooks/deploy.yml
21+
$(ansible_playbook) provisioning/complete_vm_config.yaml
2022

2123
build:
2224
echo "Not implemented yet"
2325

2426
rpm: setup
25-
scripts/setup_build_logging.sh
26-
$(ansible_playbook) code/contrail-project-config/playbooks/packaging/contrail-vnc-el.yaml
27+
scripts/setup_build_logging.sh $(repos_dir)
28+
$(ansible_playbook) $(repos_dir)/contrail-project-config/playbooks/packaging/contrail-vnc-el.yaml
2729
createrepo $(HOME)/rpmbuild/RPMS/
2830

2931
containers: rpm
30-
$(ansible_playbook) code/contrail-project-config/playbooks/docker/centos74.yaml
32+
$(ansible_playbook) $(repos_dir)/contrail-project-config/playbooks/docker/centos74.yaml
3133

3234
deploy_contrail_kolla: containers
33-
$(ansible_playbook) code/contrail-project-config/playbooks/kolla/centos74-provision-kolla.yaml
35+
$(ansible_playbook) $(repos_dir)/contrail-project-config/playbooks/kolla/centos74-provision-kolla.yaml
3436

3537
deploy_contrail_k8s: containers
36-
$(ansible_playbook) code/contrail-project-config/playbooks/docker/centos74-systest-kubernetes.yaml
38+
$(ansible_playbook) $(repos_dir)/contrail-project-config/playbooks/docker/centos74-systest-kubernetes.yaml
3739

3840
unittests: build
3941
echo "Not implemented yet"

Vagrantfile

+11-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22
# vi: set ft=ruby :
33

44
VAGRANTFILE_API_VERSION = "2"
5-
DEV_ENV_DIR="/root/contrail-dev-env"
5+
USER = "root"
6+
GROUP = "root"
7+
HOME_DIR = "/root"
8+
DEV_ENV_DIR = "#{HOME_DIR}/contrail-dev-env"
9+
REPOS_DIR = "#{HOME_DIR}/src/review.opencontrail.org/Juniper/"
610

711
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
812

913
config.vm.define :contrail_sandbox do |contrail_sandbox_config|
1014
contrail_sandbox_config.vm.box = "geerlingguy/centos7"
1115
contrail_sandbox_config.vm.hostname = "contrail-sandbox"
1216
contrail_sandbox_config.vm.network "private_network", ip: "192.168.60.200"
13-
contrail_sandbox_config.vm.synced_folder ".", DEV_ENV_DIR
17+
contrail_sandbox_config.vm.synced_folder "./code", "#{REPOS_DIR}",
18+
owner: "#{USER}", group: "#{GROUP}"
19+
contrail_sandbox_config.vm.synced_folder ".", "#{DEV_ENV_DIR}", owner: "#{USER}", group: "#{GROUP}"
1420
contrail_sandbox_config.ssh.forward_agent = true
15-
contrail_sandbox_config.ssh.insert_key = 'true'
16-
contrail_sandbox_config.ssh.username = 'root'
21+
contrail_sandbox_config.ssh.insert_key = true
22+
contrail_sandbox_config.ssh.username = "#{USER}"
1723
contrail_sandbox_config.ssh.password = 'vagrant'
1824

1925
contrail_sandbox_config.vm.provider "virtualbox" do |vb|
@@ -22,7 +28,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
2228
end
2329
contrail_sandbox_config.vm.provision "shell", name: "run presetup" do |presetup|
2430
presetup.inline = "make -f $1/Makefile presetup"
25-
presetup.args = DEV_ENV_DIR
31+
presetup.args = "#{DEV_ENV_DIR}"
2632
end
2733
end
2834
end

provisioning/checkout_repos.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- hosts: all
2+
roles:
3+
- role: checkout_repos
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
1+
- name: Download Android repo tool
2+
get_url:
3+
url: "https://storage.googleapis.com/git-repo-downloads/repo"
4+
dest: "/usr/bin/repo"
5+
mode: 0655
6+
become: yes
7+
become_user: root
8+
9+
- name: Prepare Zuulv3 like dir hierarchy for code
10+
file:
11+
path: "{{ workdir }}/src/review.opencontrail.org/Juniper/"
12+
state: directory
13+
owner: "{{ sandbox_owner }}"
14+
group: "{{ sandbox_group }}"
15+
register: repos_dir
16+
117
- name: Checkout CI jobs repos
218
git:
3-
repo: "https://github.com/{{ item.user }}/{{ item.reponame }}"
4-
dest: "{{ workdir }}/contrail-dev-env/code/{{ item.reponame }}"
19+
repo: "https://github.com/{{ item.repouser }}/{{ item.reponame }}"
20+
dest: "{{ repos_dir.path }}//{{ item.reponame }}"
521
version: "{{ branch | default('master') }}"
622
update: "{{ update_repos | default('no') }}"
723
force: "{{ override_repos | default('no') }}"
8-
with_items:
9-
- { user: 'codilime', reponame: 'contrail-project-config' }
10-
- { user: 'codilime', reponame: 'zuul-jobs' }
11-
- { user: 'Juniper', reponame: 'contrail-ansible-deployer' }
12-
24+
with_items: "{{ cloned_repos }}"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
cloned_repos:
2+
- reponame: 'contrail-project-config'
3+
repouser: 'Juniper'
4+
- reponame: 'zuul-jobs'
5+
repouser: 'Juniper'
6+
- reponame: 'contrail-ansible-deployer'
7+
repouser: 'Juniper'
8+
- reponame: 'contrail-container-builder'
9+
repouser: 'Juniper'

provisioning/roles/generic_dependencies/tasks/main.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,10 @@
33
name: "{{ item }}"
44
state: present
55
with_items:
6-
- epel-release
7-
- ansible
8-
- git
96
- createrepo
107
- tree
118
- lynx
129
- docker-python
1310
become: yes
1411
become_user: root
1512

16-
- name: Download Android repo tool
17-
get_url:
18-
url: "https://storage.googleapis.com/git-repo-downloads/repo"
19-
dest: "/usr/bin/repo"
20-
mode: 0655
21-
become: yes
22-
become_user: root
23-

provisioning/roles/setup_sandbox/templates/ansible.cfg.j2

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[defaults]
2-
{% set repodir = workdir + '/contrail-dev-env/code' %}
2+
{% set repodir = workdir + '/src/review.opencontrail.org/Juniper' %}
33
roles_path = {{ repodir }}/contrail-project-config/roles/:{{ repodir }}/zuul-jobs/roles/
44
nocows = 1
55
retry_files_enabled = False

provisioning/setup1.yaml renamed to provisioning/setup_vm.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,3 @@
33
- role: generic_dependencies
44
- role: build_dependencies
55
- role: setup_sandbox
6-
- role: checkout_repos
7-

scripts/build_package.patch

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- build_package.yaml.orig 2018-02-12 13:42:54.150293579 +0000
2+
+++ build_package.yaml 2018-02-12 13:48:42.860086032 +0000
3+
@@ -6,7 +6,8 @@
4+
--define "_srcVer {{ packaging.version.upstream }}" \
5+
--define "_skuTag mitaka" \
6+
{{ item.extra|default('') }} \
7+
- -bb {{ ansible_env.HOME }}/{{ packaging.target_dir }}/tools/packaging/common/rpm/{{ item.name }}.spec
8+
+ -bb {{ ansible_env.HOME }}/{{ packaging.target_dir }}/tools/packaging/common/rpm/{{ item.name }}.spec \
9+
+ |& tee {{ ansible_env.HOME }}/contrail-build-logs/contrail-logs/{{ item.name }}_$(date "+%Y%m%d_%H%M%S").log
10+
args:
11+
chdir: "{{ ansible_env.HOME }}/{{ packaging.target_dir }}/{{ item.workdir|default('') }}"

scripts/packaging-build-el-tasks.patch

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
--- code/contrail-project-config/roles/packaging-build-el/tasks/main.yaml 2018-02-01 08:28:29.997194231 +0000
2-
+++ main.yaml.new 2018-02-01 08:28:16.613354996 +0000
1+
--- main.yaml.orig 2018-02-12 13:42:46.830173553 +0000
2+
+++ main.yaml 2018-02-12 13:47:38.719011505 +0000
33
@@ -22,7 +22,8 @@
44
--define "_kVers {{ kver.stdout }}" \
5-
--define "_buildTag {{ zuul.change }}.{{ zuul.patchset }}" \
5+
--define "_buildTag {{ packaging.version.distrib }}" \
66
--define "_srcVer {{ packaging.version.upstream }}" \
77
- -ba tools/packages/rpm/contrail/contrail.spec
88
+ -ba tools/packages/rpm/contrail/contrail.spec \
@@ -12,7 +12,7 @@
1212
environment:
1313
@@ -35,7 +36,8 @@
1414
--define '_builddir {{ ansible_env.HOME }}/{{ packaging.target_dir }}/controller' \
15-
--define "_buildTag {{ zuul.change }}.{{ zuul.patchset }}" \
15+
--define "_buildTag {{ packaging.version.distrib }}" \
1616
--define "_srcVer {{ packaging.version.upstream }}" \
1717
- -ba {{ ansible_env.HOME }}/{{ packaging.target_dir }}/tools/packaging/common/rpm/contrail-nodemgr.spec
1818
+ -ba {{ ansible_env.HOME }}/{{ packaging.target_dir }}/tools/packaging/common/rpm/contrail-nodemgr.spec \
@@ -32,11 +32,11 @@
3232

3333
@@ -78,7 +81,8 @@
3434
--define "_builddir {{ ansible_env.HOME }}/{{ packaging.target_dir }}/BUILD" \
35-
--define "_buildTag {{ zuul.change }}.{{ zuul.patchset }}" \
35+
--define "_buildTag {{ packaging.version.distrib }}" \
3636
--define "_srcVer {{ packaging.version.upstream }}" \
37-
- --bb {{ ansible_env.HOME }}/{{ packaging.target_dir }}/tools/packaging/common/rpm/{{ item }}.spec
38-
+ --bb {{ ansible_env.HOME }}/{{ packaging.target_dir }}/tools/packaging/common/rpm/{{ item }}.spec \
39-
+ |& tee {{ ansible_env.HOME }}/contrail-build-logs/contrail-logs/{{ item }}_$(date "+%Y%m%d_%H%M%S").log
37+
- --bb {{ ansible_env.HOME }}/{{ packaging.target_dir }}/tools/packaging/common/rpm/{{ item.name }}.spec
38+
+ --bb {{ ansible_env.HOME }}/{{ packaging.target_dir }}/tools/packaging/common/rpm/{{ item.name }}.spec \
39+
+ |& tee {{ ansible_env.HOME }}/contrail-build-logs/contrail-logs/{{ item.name }}_$(date "+%Y%m%d_%H%M%S").log
4040
args:
4141
chdir: "{{ ansible_env.HOME }}/{{ packaging.target_dir }}/contrail-web-core"
4242
with_items:

scripts/setup_build_logging.sh

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
#!/bin/env bash
22
set -u
33

4-
if [ ! -d $HOME/contrail-build-logs ]; then
5-
mkdir -p $HOME/contrail-build-logs/contrail-logs
4+
if [ ! -d ${HOME}/contrail-build-logs ]; then
5+
mkdir -p ${HOME}/contrail-build-logs/contrail-logs
66
fi
77

8-
task_dir=$(pwd)/code/contrail-project-config/roles/packaging-build-el/tasks
8+
task_dir=${1}/contrail-project-config/roles/packaging-build-el/tasks
99
patch_dir=$(pwd)/scripts
1010

1111
if ! patch -R -p0 -s -f --dry-run ${task_dir}/main.yaml < ${patch_dir}/packaging-build-el-tasks.patch; then
1212
patch -p0 ${task_dir}/main.yaml < ${patch_dir}/packaging-build-el-tasks.patch
1313
fi
14+
15+
if ! patch -R -p0 -s -f --dry-run ${task_dir}/build_package.yaml < ${patch_dir}/build_package.patch; then
16+
patch -p0 ${task_dir}/build_package.yaml < ${patch_dir}/build_package.patch
17+
fi

0 commit comments

Comments
 (0)