xaizek / fragile (License: AGPLv3+) (since 2018-12-07)
Simple lightweight CI, attempting to be somewhat Unix-like in its philosophy.
Commit 1eb54849a6510bb9a75bc10e86bd252f7d66114f

Add conditional builders
See INSTALL.md file changes for a short description.
Author: xaizek
Author date (UTC): 2016-03-19 17:26
Committer name: xaizek
Committer date (UTC): 2016-03-23 13:00
Parent(s): 6b6a6267424ea4b92d2155395ee2575081a29eab
Signing key:
Tree: 453835425afc288cf944cd11eade31e31019d074
File Lines added Lines deleted
.htaccess 1 1
INSTALL.md 9 0
README.md 1 1
new.php 31 12
File .htaccess changed (mode: 100644) (index fad60df..112c08f)
1 1 RewriteEngine On RewriteEngine On
2 2
3 3 RewriteRule ^$ ./dashboard.php [L] RewriteRule ^$ ./dashboard.php [L]
4 RewriteRule ^builds/([^/]+)/([^/]+)/?$ ./build.php?buildset=$1&buildername=$2 [L]
4 RewriteRule ^builds/([^/]+)/(.*[^/])/?$ ./build.php?buildset=$1&buildername=$2 [L]
File INSTALL.md changed (mode: 100644) (index 8c2fc2f..4310863)
... ... Before installing files, copy `config.php.sample` to `config.php` and fill in
15 15 all the values of according to comments there. This file holds configuration of all the values of according to comments there. This file holds configuration of
16 16 both web and daemon parts and should be kept in sync between the two parts. both web and daemon parts and should be kept in sync between the two parts.
17 17
18 See `hooks/` directory and `README` file there for instructions on using hooks.
19
18 20 ## Installation ## ## Installation ##
19 21
20 22 Run the `install` script to perform the installation: Run the `install` script to perform the installation:
 
... ... build. When script is run:
37 39 Use dummy builders from `builders/` directory during setup to check Use dummy builders from `builders/` directory during setup to check
38 40 web-interface isolated from actual build process. web-interface isolated from actual build process.
39 41
42 #### Conditional builders ####
43
44 In addition to `<web-path>/builders` directory builders from
45 `<web-path>/builders/<name>` (where `<name>` is branch name probably) are also
46 scheduled, if that directory exists. This can be used to run some builders only
47 for specific branches.
48
40 49 ### Scheduling a build ### ### Scheduling a build ###
41 50
42 51 Run `new.php` passing it refname and revision ID (in this order) to work with. Run `new.php` passing it refname and revision ID (in this order) to work with.
File README.md changed (mode: 100644) (index a135dab..882b665)
1 1 _fragile_ _fragile_
2 2 _2015 - 2016_ _2015 - 2016_
3 3
4 **Last updated**: 04 February, 2016
4 **Last updated**: 19 March, 2016
5 5
6 6 **Version**: 0.4 **Version**: 0.4
7 7
File new.php changed (mode: 100644) (index 629461d..2f4f0a0)
... ... $revision = $argv[2];
27 27
28 28 $buildset = Buildset::create($name, $revision); $buildset = Buildset::create($name, $revision);
29 29
30 $builders = [];
31
32 if ($handle = opendir(BUILDERS_PATH)) {
33 while (($entry = readdir($handle)) !== false) {
34 if ($entry != '.' && $entry != '..') {
35 Build::create($buildset, $entry);
36 array_push($builders, $entry);
37 }
38 }
39
40 closedir($handle);
41 }
30 $builders = scheduleBuilders($buildset, BUILDERS_PATH, '');
31 $builders = array_merge($builders,
32 scheduleBuilders($buildset, BUILDERS_PATH, "$name/"));
42 33
43 34 print "Buildset ID: $buildset->buildsetid\n"; print "Buildset ID: $buildset->buildsetid\n";
44 35 if (sizeof($builders) == 0) { if (sizeof($builders) == 0) {
 
... ... if (sizeof($builders) == 0) {
49 40 . ": " . join(', ', $builders) . "\n"; . ": " . join(', ', $builders) . "\n";
50 41 } }
51 42
43 /**
44 * @brief Schedules builders discovered in @p dir directory.
45 *
46 * @param buildset Parent buildset for newly created builds.
47 * @param dir Directory to look for builders.
48 * @param suffix Additional suffix for builders path (appended to @p dir).
49 *
50 * @returns Array of scheduler builder names.
51 */
52 function scheduleBuilders($buildset, $dir, $suffix)
53 {
54 $builders = [];
55 $basePath = "$dir/$suffix";
56 if (is_dir($basePath) && $handle = opendir($basePath)) {
57 while (($entry = readdir($handle)) !== false) {
58 $path = "$basePath/$entry";
59 if (!is_dir($path) && $entry != '.' && $entry != '..') {
60 $builderName = "$suffix$entry";
61 Build::create($buildset, $builderName);
62 array_push($builders, $builderName);
63 }
64 }
65
66 closedir($handle);
67 }
68 return $builders;
69 }
70
52 71 ?> ?>
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/fragile

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/fragile

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master