]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
modify
authorRobin Wittler <robin.wittler@profitbricks.com>
Tue, 2 Aug 2011 14:21:20 +0000 (16:21 +0200)
committerRobin Wittler <robin.wittler@profitbricks.com>
Tue, 2 Aug 2011 14:21:20 +0000 (16:21 +0200)
testgit_build.py

index 22f4731f85ac1b6777370887018e739f9ada8d12..df92a416756e4f057c593ede374a4adeedc61f6e 100755 (executable)
@@ -37,8 +37,9 @@ GIT_REPO_PATH = os.environ.get('GIT_REPO_PATH')
 GIT_REPO_NAME = os.path.basename(GIT_REPO_PATH)
 GIT_OLD_ID = os.environ.get('GIT_OLD_ID')
 GIT_NEW_ID = os.environ.get('GIT_NEW_ID')
-GIT_BRANCH_NAME = os.environ.get('GIT_UPSTREAM_BRANCH')
-GIT_REMOTE_BRANCH_NAME = os.path.join('origin', '%s' %(GIT_BRANCH_NAME))
+GIT_UPSTREAM_BRANCH = os.environ.get('GIT_UPSTREAM_BRANCH')
+GIT_DEBIAN_BRANCH = os.environ.get('GIT_DEBIAN_BRANCH')
+GIT_DEBIAN_REMOTE_BRANCH = os.path.join('origin', '%s' %(GIT_DEBIAN_BRANCH))
 GIT_TARGET_WORKSPACE = os.path.join(
         CWD,
         '%s-build%s' %(BUILD_ID, BUILD_NUMBER)
@@ -73,9 +74,9 @@ def send_email(result):
     msg = (
             'From: %s\n' %(SMTP_FROM) +
             'To: %s\n' %(GIT_COMMITTER_EMAIL) +
-            'Subject: %s\n' %(SMTP_SUBJECT %(GIT_BRANCH_NAME, BUILD_NUMBER,
+            'Subject: %s\n' %(SMTP_SUBJECT %(GIT_UPSTREAM_BRANCH, BUILD_NUMBER,
                 result)) +
-            '%s\n' %(SMTP_TEXT %(GIT_BRANCH_NAME, BUILD_NUMBER, result))
+            '%s\n' %(SMTP_TEXT %(GIT_UPSTREAM_BRANCH, BUILD_NUMBER, result))
     )
     smtp.sendmail(SMTP_FROM, GIT_COMMITTER_EMAIL, msg)
     smtp.quit()
@@ -113,13 +114,9 @@ def git_clone_remote_repository(url, destination):
     logger.debug('repository %s checked out into %s' %(url, destination))
     return True
 
-def git_checkout_branch():
-    cmd = [GIT, 'checkout', '-b', GIT_BRANCH_NAME, GIT_REMOTE_BRANCH_NAME]
-    
-    logger.debug('This is GIT_TARGET_DIR: %s' %(GIT_TARGET_DIR))
-    logger.debug('This is GIT_BRANCH_NAME: %s' %(GIT_BRANCH_NAME))
-    logger.debug('This is GIT_REMOTE_BRANCH_NAME: %s'
-            %(GIT_REMOTE_BRANCH_NAME))
+def git_checkout_debian_branch():
+    cmd = [GIT, 'checkout', '-b', GIT_DEBIAN_BRANCH, GIT_DEBIAN_REMOTE_BRANCH]
+
     cmdobj = subprocess.Popen(
             cmd,
             shell=False,
@@ -136,7 +133,7 @@ def git_checkout_branch():
     )
 
     logger.debug(
-            'calling »%s« for checkout' %(' '.join(cmd))
+            'calling "%s" for checkout' %(' '.join(cmd))
     )
 
     ret = cmdobj.wait()
@@ -145,7 +142,7 @@ def git_checkout_branch():
         logger.error('Error was: %s' %(cmdobj.stderr.readlines()))
         return False
     logger.info(
-            'local branch %s successfully checked out.' %(GIT_BRANCH_NAME)
+            'local branch %s successfully checked out.' %(GIT_DEBIAN_BRANCH)
     )
     return True
 
@@ -184,10 +181,8 @@ if __name__ == '__main__':
         logger.info('git clone was not successfull')
         exit_error()
     atexit.register(remove_git_target_workspace)
-    if not git_checkout_branch():
-        sys.exit(1)
-    logger.debug('changing dir to %s' %(GIT_TARGET_DIR))
     os.chdir(GIT_TARGET_DIR)
+    logger.info('Directory Listing: %s' %(os.listdir(GIT_TARGET_DIR)))
 
         #ftp = FTP(
         #        'alexandria.profitbricks.localdomain',