]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
trigger kernel builds from oot-jobs
authorHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 16:52:35 +0000 (17:52 +0100)
committerHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 16:52:35 +0000 (17:52 +0100)
debian_build.py

index 930e09949a76d271063a12abee7d74504c0350f5..5f404891b7849e1442abd06344d96972d96fb8d4 100755 (executable)
@@ -16,6 +16,7 @@ import datetime
 import platform
 import subprocess
 import time
+import urllib
 from glob import glob
 from ftplib import FTP
 from lib import git_helper
@@ -24,6 +25,9 @@ from lib import git_buildpackage
 from multiprocessing import cpu_count
 from ConfigParser import SafeConfigParser
 
+JOB_URL = 'http://rwittler:MiMaMopel@jenkins:80/job/%(repo_path)s/buildWithParameters?'
+JOB_DELAY = '0sec'
+
 GIT = '/usr/bin/git'
 BIN_RM = '/bin/rm'
 BIN_SUDO = '/usr/bin/sudo'
@@ -487,25 +491,33 @@ if __name__ == '__main__':
 
         # build out-of-tree kernel module binary packages for all defined 
         # flavours (if the package is a oot-source package)
-        #FLAVOURS_FILE=os.path.join(GIT_TARGET_WORKSPACE, GIT_REPO_NAME, "debian/pb_flavours")
-        #if os.path.exists(FLAVOURS_FILE):
-        #    logger.info('Sleeping for 60 sec. so reprepro can process upload....')
-        #    time.sleep(60) # give reprepro time to process
-        #    FLAVOURS_FILE=os.path.join(GIT_TARGET_WORKSPACE, GIT_REPO_NAME, "debian/pb_flavours")
-        #    fh = open(FLAVOURS_FILE, 'r')
-        #    for flavour in fh.readlines():
-        #        cmd = ['%s' % os.path.join(CWD, "build-oot.sh"),
-        #               '%s' % JOB_NAME,
-        #               '%s' % flavour.rstrip('\n'),
-        #               '%s' % os.environ.get('DIST'),
-        #               '%s' % pb_suite ]
-        #        logger.info('calling "%s" ...', ' '.join(cmd))
-        #        ret = os.system('%s' %(' '.join(cmd)))
-        #        if ret:
-        #            logger_loud_error('"%s" returned non-zero (exitcode was: %s).' % (' '.join(cmd), ret))
-        #            logger.exception(ret)
-        #            exit_error()
-        #    fh.close()
+        FLAVOURS_FILE=os.path.join(GIT_TARGET_WORKSPACE, GIT_REPO_NAME, "debian/pb_flavours")
+        if os.path.exists(FLAVOURS_FILE):
+            FLAVOURS_FILE=os.path.join(GIT_TARGET_WORKSPACE, GIT_REPO_NAME, "debian/pb_flavours")
+            fh = open(FLAVOURS_FILE, 'r')
+
+
+            for flavour in fh.readlines():
+                LINUX_FLAVOUR_REPO_PATH = '/srv/git/r+i/linux-%s.git' % flavour
+                data = urllib.urlencode(
+                    (
+                        ('GIT_REPO_PATH', LINUX_FLAVOUR_REPO_PATH),
+                        ('DISTRIBUTION', pb_suite),
+                        ('delay', JOB_DELAY)
+                    )
+                )
+                ret = url.open(JOB_URL %(urlencode_expansion_dict) + '%s' %(data))
+
+                if ret.code == 200:
+                    logger.info('jenkins url called successfully.')
+                elif ret.code == 404:
+                    logger.info('jenkins has no such job configured yet.')
+                else:
+                    logger.info('URL was %s' % JOB_URL %(urlencode_expansion_dict) + '%s' %(data))
+                    logger.info('jenkins sends the following: %s' %(ret.read())
+                    )
+                    exit_error()
+            fh.close()
 
         exit_ok()