[SCM] ci-tooling packaging branch, master, updated. f7bbd77e956a8cfaf2441443ecda50bec9e1f50c

Rohan Garg rohangarg-guest at moszumanska.debian.org
Thu Dec 11 14:17:23 UTC 2014


Gitweb-URL: http://git.debian.org/?p=pkg-kde/ci-tooling.git;a=commitdiff;h=f7bbd77

The following commit has been merged in the master branch:
commit f7bbd77e956a8cfaf2441443ecda50bec9e1f50c
Author: Rohan Garg <rohan at kde.org>
Date:   Thu Dec 11 15:17:07 2014 +0100

    Add the ability to specify custom git repos for CI'ing
---
 data/projects.json | 10 +++++++++-
 lib/projects.rb    | 33 ++++++++++++++++++++++++++++-----
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/data/projects.json b/data/projects.json
index d2a27b0..4e88063 100644
--- a/data/projects.json
+++ b/data/projects.json
@@ -23,6 +23,14 @@
             "signon-kwallet-extension"
         ],
         "kde-req" : [ "qca2" ]
-    }
+    },
+    "custom_ci" : [
+        {
+            "type" : "github",
+            "git_host" : "http://github.com/",
+            "org" : "maui-debian",
+            "repos" : [ "all" ]
+        }
+    ]
 }
 
diff --git a/lib/projects.rb b/lib/projects.rb
index 2de7262..104e09e 100644
--- a/lib/projects.rb
+++ b/lib/projects.rb
@@ -16,7 +16,7 @@ class Project
 
     attr_reader :autopkgtest
 
-    def initialize(name, component)
+    def initialize(name, component, host='debian')
         @name = name
         @component = component
         @upstream_scm = nil
@@ -32,7 +32,7 @@ class Project
             unless File.exist?(name)
                 i = 0
                 while true and (i+=1) < 5
-                    break if system("git clone debian:#{component}/#{name}")
+                    break if system("git clone #{host}:#{component}/#{name}")
                 end
             end
             Dir.chdir(name) do
@@ -79,9 +79,8 @@ class Project
 end
 
 class Projects < Array
-    def initialize()
-        super
-
+    def initialize(allow_custom_ci: false)
+        super()
         config_file_path = File.expand_path(File.dirname(File.dirname(__FILE__))) + '/data/projects.json'
         config = JSON::parse(File.read(config_file_path))
 
@@ -100,6 +99,30 @@ class Projects < Array
             end
         end
 
+        # Custom CI jobs
+        if allow_custom_ci
+            repos = []
+            config['custom_ci'].each do |custom_ci|
+                if custom_ci['type'] == 'github'
+                    require 'octokit'
+                    if custom_ci['repos'] == ['all']
+                        Octokit.organization_repositories(custom_ci['org']).each do |octo_repo|
+                            repos << octo_repo[:name]
+                        end
+                    end
+                elsif custom_ci['repos'] == ['all'] && custom_ci['type'] != 'github'
+                    repos = %x[ssh #{custom_ci['git_host']} ls /].chop!.gsub!('.git', '').split(' ')
+                else
+                     repos = custom_ci['repos']
+                end
+
+                puts repos
+                repos.each do |repo|
+                    self << Project.new(repo, custom_ci['org'], custom_ci['type'])
+                end
+            end
+        end
+
         # Build a hash for quick lookup of which source provides which binary.
         provided_by = {}
         self.each do |project|

-- 
ci-tooling packaging



More information about the pkg-kde-commits mailing list