Skip to content

Commit

Permalink
PoC build system for Juniper/contrail
Browse files Browse the repository at this point in the history
Change-Id: If7ed8d221d1b9b926995bfb792b28643a1637f99
Partial-Bug: 1752726
  • Loading branch information
wurbanski committed Mar 1, 2018
1 parent b5f594b commit 3db3417
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .zuul.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- project:
name: Juniper/contrail
check:
jobs:
- contrail-go-docker

- job:
name: contrail-go-docker
description: |
Job that builds and tests Juniper/contrail project.
voting: False
parent: contrail-src-base
required-projects:
- Juniper/contrail
run: playbooks/contrail-go-docker/run.yaml
#post-run: playbooks/contrail-go-docker/post.yaml
nodeset:
nodes:
- name: contrail-go
label: centos-7-4-builder
vars:
docker:
- image: circleci/golang:1.9.2
# - image: circleci/mysql:5.7
# environment:
# MYSQL_ROOT_PASSWORD: contrail123
43 changes: 43 additions & 0 deletions playbooks/contrail-go-docker/build-setup.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
- name: "Install docker-py"
yum:
name: python-docker-py
state: present
become: yes
become_user: root

- name: Disable selinux for the build
selinux:
state: disabled
become: yes
become_user: root

- name: Pretend we're using github
file:
src: "review.opencontrail.org"
path: "{{ ansible_env.HOME}}/src/github.com"
state: link

- name: "Start runner docker container in background"
docker_container:
name: "{{ docker.0.name|default('runner') }}"
image: "{{ docker.0.image }}"
state: started
env: "{{ docker.0.environment|default(omit) }}"
network_mode: host
command: sleep infinity
volumes:
- "{{ ansible_env.HOME }}:/go"
become: yes
become_user: root

- name: "Run required additional docker containers in background"
docker_container:
name: "{{ item.name|default(item.image.split('/')[-1].split(':')[0]) }}"
image: "{{ item.image }}"
state: started
env: "{{ item.environment|default(omit) }}"
network_mode: host
with_items: "{{ docker[1:] }}"
become: yes
become_user: root

6 changes: 6 additions & 0 deletions playbooks/contrail-go-docker/build-step.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- name: "{{ item.name|default(item.command) }}"
shell: >
docker exec --user=$(id -u) {{ docker.0.name|default('runner') }} bash -ec
"cd {{ workdir }}; {{ item.command }}"
become: yes
become_user: root
23 changes: 23 additions & 0 deletions playbooks/contrail-go-docker/run.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- hosts: all
name: Build and test Juniper/contrail
roles:
- install-docker-daemon
vars:
workdir: /go/src/github.com/Juniper/contrail
tasks:
- include: build-setup.yaml

- name: run
include: build-step.yaml
loop_control:
label: "{{ item.name }}"
with_items: # Insert tasks here
- name: Install deps
command: make deps
- name: Install packaging tools
command: |
sudo apt-get install -y zip build-essential rpm rubygems ruby-dev curl;
sudo gem install --no-ri --no-rdoc fpm;
- name: Make package
command: make build binaries package

0 comments on commit 3db3417

Please sign in to comment.