Merge lp:~ricardokirkner/locolander/a-tree-full-of-scripts into lp:locolander

Proposed by Loco Lander
Status: Merged
Approved by: Ricardo Kirkner
Approved revision: 16
Merged at revision: 7
Proposed branch: lp:~ricardokirkner/locolander/a-tree-full-of-scripts
Merge into: lp:locolander
Diff against target: 158 lines (+109/-0)
9 files modified
.bzrignore (+1/-0)
docker/Dockerfile (+42/-0)
docker/files/95proxies (+3/-0)
docker/files/bazaar/authentication.conf (+4/-0)
docker/files/bazaar/bazaar.conf (+3/-0)
docker/files/environment (+10/-0)
docker/scripts/build.sh (+6/-0)
docker/scripts/run_project.sh (+9/-0)
docker/scripts/run_tests.sh (+31/-0)
To merge this branch: bzr merge lp:~ricardokirkner/locolander/a-tree-full-of-scripts
Reviewer Review Type Date Requested Status
Ricardo Kirkner (by nessita) Approve
Review via email: mp+170912@code.launchpad.net

Commit message

initial set of scripts to run tests and merge branches

Description of the change

This branch adds:

- set of scripts:
  - run_project.sh: runs a container using docker and calls run_tests.sh for the source and target branches inside of that container
  - run_tests.sh: merges source into target branch and runs tests before pushing
  - build.sh: builds an image for a project, using a project specific Dockerfile

- Dockerfile for building the locolander:base image

To post a comment you must log in.
14. By Ricardo Kirkner

added support for passing commit message to run_tests.sh

15. By Ricardo Kirkner

handle arguments with spaces

16. By Ricardo Kirkner

commit after running tests

Revision history for this message
Ricardo Kirkner (ricardokirkner) wrote :

Looks good!

review: Approve ((by nessita))

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2013-06-21 20:26:50 +0000
3+++ .bzrignore 2013-06-22 01:39:24 +0000
4@@ -1,1 +1,2 @@
5+docker/files/ssh
6 locolander.db
7
8=== added directory 'docker'
9=== added file 'docker/Dockerfile'
10--- docker/Dockerfile 1970-01-01 00:00:00 +0000
11+++ docker/Dockerfile 2013-06-22 01:39:24 +0000
12@@ -0,0 +1,42 @@
13+from ubuntu:precise
14+env http_proxy http://172.16.42.1:3128
15+
16+# enable universe repo
17+run apt-get -y update
18+run apt-get -y install python-software-properties
19+run add-apt-repository "deb http://archive.ubuntu.com/ubuntu precise main universe"
20+run apt-get -y update
21+
22+# install base tools
23+run apt-get -y install python-pip
24+run apt-get -y install bzr
25+
26+# upgrade system
27+run apt-get -y upgrade
28+
29+# add pip cache
30+run mkdir -p /var/cache/locolander/pip
31+
32+# configure proxy
33+add ./files/environment /etc/environment
34+add ./files/95proxies /etc/apt/apt.conf.d/95proxies
35+
36+# add locolander user
37+run adduser locolander
38+
39+# install main locolander script
40+add ./scripts/run_tests.sh /usr/local/bin/run_tests.sh
41+run chown locolander.locolander /usr/local/bin/run_tests.sh
42+
43+# configure ssh
44+run mkdir /home/locolander/.ssh
45+add ./files/ssh/id_rsa /home/locolander/.ssh/id_rsa
46+add ./files/ssh/id_rsa.pub /home/locolander/.ssh/id_rsa.pub
47+
48+# configure bazaar
49+run mkdir /home/locolander/.bazaar
50+add ./files/bazaar/bazaar.conf /home/locolander/.bazaar/bazaar.conf
51+add ./files/bazaar/authentication.conf /home/locolander/.bazaar/authentication.conf
52+
53+# ensure proper ownership
54+run chown -R locolander.locolander /home/locolander/
55
56=== added directory 'docker/files'
57=== added file 'docker/files/95proxies'
58--- docker/files/95proxies 1970-01-01 00:00:00 +0000
59+++ docker/files/95proxies 2013-06-22 01:39:24 +0000
60@@ -0,0 +1,3 @@
61+Acquire::http::proxy "http://172.16.42.1:3128/";
62+Acquire::ftp::proxy "ftp://172.16.42.1:3128/";
63+Acquire::https::proxy "https://172.16.42.1:3128/";
64
65=== added directory 'docker/files/bazaar'
66=== added file 'docker/files/bazaar/authentication.conf'
67--- docker/files/bazaar/authentication.conf 1970-01-01 00:00:00 +0000
68+++ docker/files/bazaar/authentication.conf 2013-06-22 01:39:24 +0000
69@@ -0,0 +1,4 @@
70+[Launchpad]
71+host = .launchpad.net
72+scheme = ssh
73+user = locolander
74
75=== added file 'docker/files/bazaar/bazaar.conf'
76--- docker/files/bazaar/bazaar.conf 1970-01-01 00:00:00 +0000
77+++ docker/files/bazaar/bazaar.conf 2013-06-22 01:39:24 +0000
78@@ -0,0 +1,3 @@
79+[DEFAULT]
80+email = "Loco Lander"
81+launchpad_username = locolander
82
83=== added file 'docker/files/environment'
84--- docker/files/environment 1970-01-01 00:00:00 +0000
85+++ docker/files/environment 2013-06-22 01:39:24 +0000
86@@ -0,0 +1,10 @@
87+PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
88+
89+http_proxy=http://172.16.42.1:3128/
90+https_proxy=http://172.16.42.1:3128/
91+ftp_proxy=http://172.16.42.1:3128/
92+no_proxy="localhost,127.0.0.1,localaddress,.localdomain.com"
93+HTTP_PROXY=http://172.16.42.1:3128/
94+HTTPS_PROXY=http://172.16.42.1:3128/
95+FTP_PROXY=http://172.16.42.1:3128/
96+NO_PROXY="localhost,127.0.0.1,localaddress,.localdomain.com"
97
98=== added directory 'docker/scripts'
99=== added file 'docker/scripts/build.sh'
100--- docker/scripts/build.sh 1970-01-01 00:00:00 +0000
101+++ docker/scripts/build.sh 2013-06-22 01:39:24 +0000
102@@ -0,0 +1,6 @@
103+#!/bin/sh
104+
105+PROJECT=$1
106+DOCKERFILE=$2
107+
108+docker build -t $PROJECT - < $DOCKERFILE
109
110=== added file 'docker/scripts/run_project.sh'
111--- docker/scripts/run_project.sh 1970-01-01 00:00:00 +0000
112+++ docker/scripts/run_project.sh 2013-06-22 01:39:24 +0000
113@@ -0,0 +1,9 @@
114+#!/bin/bash
115+
116+PROJECT="$1"
117+SOURCE="$2"
118+TARGET="$3"
119+CMD="$4"
120+COMMIT_MSG="$5"
121+
122+OUTPUT=$(docker run -u locolander -e HOME=/home/locolander $PROJECT /usr/local/bin/run_tests.sh "$SOURCE" "$TARGET" "$CMD" "$COMMIT_MSG")
123
124=== added file 'docker/scripts/run_tests.sh'
125--- docker/scripts/run_tests.sh 1970-01-01 00:00:00 +0000
126+++ docker/scripts/run_tests.sh 2013-06-22 01:39:24 +0000
127@@ -0,0 +1,31 @@
128+#!/bin/bash -e
129+
130+SOURCE="$1"
131+TARGET="$2"
132+CMD="$3"
133+COMMIT_MSG="$4"
134+
135+TMPFOLDER=`mktemp -d`
136+
137+cd $TMPFOLDER
138+echo "Getting target branch ($TARGET)..."
139+bzr branch $TARGET target
140+
141+# merge
142+echo "Merging source branch ($SOURCE) into target..."
143+cd target
144+bzr merge $SOURCE
145+
146+# run tests
147+echo "Running tests..."
148+$CMD
149+
150+# commit
151+echo "Committing merge..."
152+bzr commit -m "$COMMIT_MSG"
153+
154+# push merge
155+echo "Pushing merge..."
156+bzr push $TARGET
157+
158+echo "SUCCESS"

Subscribers

People subscribed via source and target branches

to all changes: