File root/themes/default/doc/api.html changed (mode: 100644) (index 9caad96..ac95522) |
25 |
25 |
|
|
26 |
26 |
|
|
27 |
27 |
Example of error:<br /> |
Example of error:<br /> |
28 |
|
<div class="term"> |
|
29 |
|
$ curl --header 'Authorization: bla this_is_your_api_key' \ |
|
|
28 |
|
<div class="term">$ curl --header 'Authorization: bla this_is_your_api_key' \ |
30 |
29 |
--data '{"cmd": "invalid_cmd", "user": "bla"}' \ |
--data '{"cmd": "invalid_cmd", "user": "bla"}' \ |
31 |
30 |
@@base_url@@/op/api |
@@base_url@@/op/api |
32 |
31 |
$ ssh rocketgit@rocketgit.com api invalid_cmd |
$ ssh rocketgit@rocketgit.com api invalid_cmd |
|
... |
... |
$ ssh rocketgit@rocketgit.com api invalid_cmd |
42 |
41 |
<b>Description</b>: List information about a user<br /> |
<b>Description</b>: List information about a user<br /> |
43 |
42 |
<b>Parameters</b>: user/uid [optional]<br /> |
<b>Parameters</b>: user/uid [optional]<br /> |
44 |
43 |
Example: |
Example: |
45 |
|
<div class="term"> |
|
46 |
|
$ curl --header 'Authorization: bla this_is_your_api_key' \ |
|
|
44 |
|
<div class="term">$ curl --header 'Authorization: bla this_is_your_api_key' \ |
47 |
45 |
--data '{"cmd": "user_info", "user": "bla"}' \ |
--data '{"cmd": "user_info", "user": "bla"}' \ |
48 |
46 |
@@base_url@@/op/api |
@@base_url@@/op/api |
49 |
47 |
$ ssh rocketgit@rocketgit.com api user_info user=bla |
$ ssh rocketgit@rocketgit.com api user_info user=bla |
|
... |
... |
$ ssh rocketgit@rocketgit.com api user_info user=bla |
79 |
77 |
<b>Description</b>: Lists user defined rights<br /> |
<b>Description</b>: Lists user defined rights<br /> |
80 |
78 |
<b>Parameters</b>: user/uid [optional]<br /> |
<b>Parameters</b>: user/uid [optional]<br /> |
81 |
79 |
Example: |
Example: |
82 |
|
<div class="term"> |
|
83 |
|
$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
|
|
80 |
|
<div class="term">$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
84 |
81 |
--data '{"cmd": "user_rights_list", "user": "bla"}' \ |
--data '{"cmd": "user_rights_list", "user": "bla"}' \ |
85 |
82 |
@@base_url@@/op/api |
@@base_url@@/op/api |
86 |
83 |
$ ssh rocketgit@rocketgit.com api user_rights_list user=bla |
$ ssh rocketgit@rocketgit.com api user_rights_list user=bla |
|
... |
... |
$ ssh rocketgit@rocketgit.com api user_rights_list user=bla |
119 |
116 |
<b>Description</b>: Lists SSH keys of a user<br /> |
<b>Description</b>: Lists SSH keys of a user<br /> |
120 |
117 |
<b>Parameters</b>: user/uid [optional]<br /> |
<b>Parameters</b>: user/uid [optional]<br /> |
121 |
118 |
Example: |
Example: |
122 |
|
<div class="term"> |
|
123 |
|
$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
|
|
119 |
|
<div class="term">$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
124 |
120 |
--data '{"cmd": "user_ssh_keys_list", "user": "bla"}' \ |
--data '{"cmd": "user_ssh_keys_list", "user": "bla"}' \ |
125 |
121 |
@@base_url@@/op/api |
@@base_url@@/op/api |
126 |
122 |
$ ssh rocketgit@rocketgit.com api user_ssh_keys_list user=bla |
$ ssh rocketgit@rocketgit.com api user_ssh_keys_list user=bla |
|
... |
... |
$ ssh rocketgit@rocketgit.com api user_ssh_keys_list user=bla |
154 |
150 |
<b>Description</b>: Lists webhooks of a user<br /> |
<b>Description</b>: Lists webhooks of a user<br /> |
155 |
151 |
<b>Parameters</b>: user/uid [optional]<br /> |
<b>Parameters</b>: user/uid [optional]<br /> |
156 |
152 |
Example: |
Example: |
157 |
|
<div class="term"> |
|
158 |
|
$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
|
|
153 |
|
<div class="term">$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
159 |
154 |
--data '{"cmd": "user_wh_list", "user": "bla"}' \ |
--data '{"cmd": "user_wh_list", "user": "bla"}' \ |
160 |
155 |
@@base_url@@/op/api |
@@base_url@@/op/api |
161 |
156 |
$ ssh rocketgit@rocketgit.com api user_wh_list user=bla |
$ ssh rocketgit@rocketgit.com api user_wh_list user=bla |
|
... |
... |
$ ssh rocketgit@rocketgit.com api user_wh_list user=bla |
206 |
201 |
<a name="repo_list"><b>repo_list</b></a><br /> |
<a name="repo_list"><b>repo_list</b></a><br /> |
207 |
202 |
<b>Parameters</b>: user/uid [optional]<br /> |
<b>Parameters</b>: user/uid [optional]<br /> |
208 |
203 |
Example: |
Example: |
209 |
|
<div class="term"> |
|
210 |
|
$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
|
|
204 |
|
<div class="term">$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
211 |
205 |
--data '{"cmd": "repo_list"}' \ |
--data '{"cmd": "repo_list"}' \ |
212 |
206 |
@@base_url@@/op/api |
@@base_url@@/op/api |
213 |
207 |
$ ssh rocketgit@rocketgit.com api repo_list |
$ ssh rocketgit@rocketgit.com api repo_list |
|
... |
... |
$ ssh rocketgit@rocketgit.com api repo_list |
224 |
218 |
<b>Description</b>: Shows info about a repository<br /> |
<b>Description</b>: Shows info about a repository<br /> |
225 |
219 |
<b>Parameters</b>: user/uid [optional], repo/repo_id<br /> |
<b>Parameters</b>: user/uid [optional], repo/repo_id<br /> |
226 |
220 |
Example: |
Example: |
227 |
|
<div class="term"> |
|
228 |
|
$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
|
|
221 |
|
<div class="term">$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
229 |
222 |
--data '{"cmd": "repo_info", "repo": "repo1"}' \ |
--data '{"cmd": "repo_info", "repo": "repo1"}' \ |
230 |
223 |
@@base_url@@/op/api |
@@base_url@@/op/api |
231 |
224 |
$ ssh rocketgit@rocketgit.com api repo_info repo=repo1 |
$ ssh rocketgit@rocketgit.com api repo_info repo=repo1 |
|
... |
... |
$ ssh rocketgit@rocketgit.com api repo_info repo=repo1 |
267 |
260 |
<b>Description</b>: Lists the bugs<br /> |
<b>Description</b>: Lists the bugs<br /> |
268 |
261 |
<b>Parameters</b>: user/uid [optional], repo/repo_id<br /> |
<b>Parameters</b>: user/uid [optional], repo/repo_id<br /> |
269 |
262 |
Example: |
Example: |
270 |
|
<div class="term"> |
|
271 |
|
$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
|
|
263 |
|
<div class="term">$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
272 |
264 |
--data '{"cmd": "repo_bug_list", "repo": "repo1"}' \ |
--data '{"cmd": "repo_bug_list", "repo": "repo1"}' \ |
273 |
265 |
@@base_url@@/op/api |
@@base_url@@/op/api |
274 |
266 |
$ ssh rocketgit@rocketgit.com api repo_bug_list repo=repo1 |
$ ssh rocketgit@rocketgit.com api repo_bug_list repo=repo1 |
|
... |
... |
$ ssh rocketgit@rocketgit.com api repo_bug_list repo=repo1 |
289 |
281 |
<b>Description</b>: Shows information about a bug<br /> |
<b>Description</b>: Shows information about a bug<br /> |
290 |
282 |
<b>Parameters</b>: user/uid [optional], repo/repo_id, bug_id<br /> |
<b>Parameters</b>: user/uid [optional], repo/repo_id, bug_id<br /> |
291 |
283 |
Example: |
Example: |
292 |
|
<div class="term"> |
|
293 |
|
$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
|
|
284 |
|
<div class="term">$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
294 |
285 |
--data '{"cmd": "repo_bug_info", "repo": "repo1", "bug_id": 2}' \ |
--data '{"cmd": "repo_bug_info", "repo": "repo1", "bug_id": 2}' \ |
295 |
286 |
@@base_url@@/op/api |
@@base_url@@/op/api |
296 |
287 |
$ ssh rocketgit@rocketgit.com api repo_bug_info repo=repo1 bug_id=2 |
$ ssh rocketgit@rocketgit.com api repo_bug_info repo=repo1 bug_id=2 |
|
... |
... |
$ ssh rocketgit@rocketgit.com api repo_bug_info repo=repo1 bug_id=2 |
327 |
318 |
<b>Description</b>: Lists the merge requests<br /> |
<b>Description</b>: Lists the merge requests<br /> |
328 |
319 |
<b>Parameters</b>: user/uid [optional], repo/repo_id<br /> |
<b>Parameters</b>: user/uid [optional], repo/repo_id<br /> |
329 |
320 |
Example: |
Example: |
330 |
|
<div class="term"> |
|
331 |
|
$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
|
|
321 |
|
<div class="term">$ curl --header 'Authorization: put_here_your_username this_is_your_api_key' \ |
332 |
322 |
--data '{"cmd": "repo_mr_list", "repo": "repo1"}' \ |
--data '{"cmd": "repo_mr_list", "repo": "repo1"}' \ |
333 |
323 |
@@base_url@@/op/api |
@@base_url@@/op/api |
334 |
324 |
$ ssh rocketgit@rocketgit.com api repo_mr_list repo=repo1 |
$ ssh rocketgit@rocketgit.com api repo_mr_list repo=repo1 |
File root/themes/default/doc/demo/demos/ci-1/about/main.html changed (mode: 100644) (index 676139f..4e89e82) |
... |
... |
These steps are not covered by this tutorial.<br /> |
14 |
14 |
|
|
15 |
15 |
Now, we assume you are in the just cloned repository local folder. |
Now, we assume you are in the just cloned repository local folder. |
16 |
16 |
We can start with a simple application, stored in file 'main.sh': |
We can start with a simple application, stored in file 'main.sh': |
17 |
|
<div class="term"> |
|
18 |
|
#!/bin/bash |
|
|
17 |
|
<div class="term">#!/bin/bash |
19 |
18 |
|
|
20 |
19 |
case "${1}" in |
case "${1}" in |
21 |
20 |
a) echo "A" ;; |
a) echo "A" ;; |
|
... |
... |
esac |
28 |
27 |
|
|
29 |
28 |
As you can see, it is a simple script. Now, we will add another script, |
As you can see, it is a simple script. Now, we will add another script, |
30 |
29 |
'test.sh', that will test our main script: |
'test.sh', that will test our main script: |
31 |
|
<div class="term"> |
|
32 |
|
#!/bin/bash |
|
|
30 |
|
<div class="term">#!/bin/bash |
33 |
31 |
|
|
34 |
32 |
if [ "`./main.sh xx`" != "BAD" ]; then |
if [ "`./main.sh xx`" != "BAD" ]; then |
35 |
33 |
echo "Test 'xx' failed!" |
echo "Test 'xx' failed!" |
|
... |
... |
echo "Tests passed!" |
46 |
44 |
</div> |
</div> |
47 |
45 |
|
|
48 |
46 |
Next, we will add the deploy script, 'deploy.sh': |
Next, we will add the deploy script, 'deploy.sh': |
49 |
|
<div class="term"> |
|
50 |
|
#!/bin/bash |
|
|
47 |
|
<div class="term">#!/bin/bash |
51 |
48 |
|
|
52 |
49 |
for s in server1 server2 server3; do |
for s in server1 server2 server3; do |
53 |
50 |
rsync -a main.sh ${s}:/usr/local/bin/ |
rsync -a main.sh ${s}:/usr/local/bin/ |
File root/themes/default/doc/demo/demos/ci-1/trigger/main.html changed (mode: 100644) (index 26d0483..74e6b42) |
... |
... |
You are ready to trigger the hook and see if our first deploy will work.<br /> |
6 |
6 |
Locally, on your computer, we assume you are in the project folder, |
Locally, on your computer, we assume you are in the project folder, |
7 |
7 |
where we have the three bash scripts (main.sh, test.sh and deploy.sh). |
where we have the three bash scripts (main.sh, test.sh and deploy.sh). |
8 |
8 |
You will have to add, commit and push these files: |
You will have to add, commit and push these files: |
9 |
|
<div class="term"> |
|
10 |
|
chmod a+x *.sh |
|
|
9 |
|
<div class="term">chmod a+x *.sh |
11 |
10 |
git add *.sh |
git add *.sh |
12 |
11 |
git commit -m "First commit" |
git commit -m "First commit" |
13 |
12 |
git push origin master |
git push origin master |
|
... |
... |
the text "n/a" will appear.<br /> |
21 |
20 |
<br /> |
<br /> |
22 |
21 |
|
|
23 |
22 |
After some time, you will see the following text: |
After some time, you will see the following text: |
24 |
|
<div class="term"> |
|
25 |
|
Worker: Builder 1 |
|
|
23 |
|
<div class="term">Worker: Builder 1 |
26 |
24 |
Date (UTC): 2016-07-22 04:30 |
Date (UTC): 2016-07-22 04:30 |
27 |
25 |
Elapsed time: 133s |
Elapsed time: 133s |
28 |
26 |
|
|
|
... |
... |
and press 'Edit' button.<br /> |
51 |
49 |
Now, we are ready to push again. Because you changed nothing in the repository, |
Now, we are ready to push again. Because you changed nothing in the repository, |
52 |
50 |
the push will succeed but will not trigger the hook. So, just do a fake |
the push will succeed but will not trigger the hook. So, just do a fake |
53 |
51 |
change: |
change: |
54 |
|
<div class="term"> |
|
55 |
|
|
|
56 |
|
echo "Documentation is important" > README |
|
|
52 |
|
<div class="term">echo "Documentation is important" > README |
57 |
53 |
git add README |
git add README |
58 |
54 |
git commit -m "Added README file" |
git commit -m "Added README file" |
59 |
|
|
|
60 |
55 |
</div> |
</div> |
61 |
56 |
|
|
62 |
57 |
Now, we will push again: |
Now, we will push again: |
63 |
|
<div class="term"> |
|
64 |
|
git push origin master |
|
65 |
|
|
|
|
58 |
|
<div class="term">git push origin master |
66 |
59 |
</div> |
</div> |
67 |
60 |
|
|
68 |
61 |
Now, the "Last output" row will be: |
Now, the "Last output" row will be: |
69 |
|
<div class="term"> |
|
70 |
|
Worker: Builder 1 |
|
|
62 |
|
<div class="term">Worker: Builder 1 |
71 |
63 |
Date (UTC): 2016-07-22 04:41 |
Date (UTC): 2016-07-22 04:41 |
72 |
64 |
Elapsed time: 141s |
Elapsed time: 141s |
73 |
65 |
|
|
File root/themes/default/doc/worker.html changed (mode: 100644) (index 9fed3bd..7f9f2f7) |
5 |
5 |
<div class="island_title">Preparing a virtual machine</div> |
<div class="island_title">Preparing a virtual machine</div> |
6 |
6 |
- Install an operating system into a virtual machine.<br /> |
- Install an operating system into a virtual machine.<br /> |
7 |
7 |
- Inside the virtual machine, edit /etc/rc.d/rc.local (or /etc/rc.local) like this: |
- Inside the virtual machine, edit /etc/rc.d/rc.local (or /etc/rc.local) like this: |
8 |
|
<div class="term"> |
|
9 |
|
#!/bin/bash |
|
|
8 |
|
<div class="term">#!/bin/bash |
10 |
9 |
|
|
11 |
10 |
id build > /dev/null |
id build > /dev/null |
12 |
11 |
if [ "${?}" != "0" ]; then |
if [ "${?}" != "0" ]; then |
|
... |
... |
while [ 1 ]; do |
25 |
24 |
done 1>/dev/null 2>&1 < /dev/null & |
done 1>/dev/null 2>&1 < /dev/null & |
26 |
25 |
</div> |
</div> |
27 |
26 |
and make it executable (and, optionally, restore context): |
and make it executable (and, optionally, restore context): |
28 |
|
<div class="term"> |
|
29 |
|
chmod a+x /etc/rc.d/rc.local |
|
|
27 |
|
<div class="term">chmod a+x /etc/rc.d/rc.local |
30 |
28 |
restorecon -v /etc/rc.d/rc.local |
restorecon -v /etc/rc.d/rc.local |
31 |
29 |
</div> |
</div> |
32 |
30 |
</div> |
</div> |
|
... |
... |
restorecon -v /etc/rc.d/rc.local |
37 |
35 |
- Edit /etc/rocketgit/worker.conf (start with .sample file)<br /> |
- Edit /etc/rocketgit/worker.conf (start with .sample file)<br /> |
38 |
36 |
- Edit /etc/cron.d/rocketgit: uncomment the worker.sh line<br /> |
- Edit /etc/cron.d/rocketgit: uncomment the worker.sh line<br /> |
39 |
37 |
Sample worker.conf:<br /> |
Sample worker.conf:<br /> |
40 |
|
<div class="term"> |
|
41 |
|
type = user |
|
|
38 |
|
<div class="term">type = user |
42 |
39 |
user = my_rocketgit.com_user |
user = my_rocketgit.com_user |
43 |
40 |
name = Builder 1 |
name = Builder 1 |
44 |
41 |
master = r1.example.net |
master = r1.example.net |