]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
remove jenkins build specific variable assignments from common_code
authorMathias Klette <mathias.klette@profitbricks.com>
Thu, 2 May 2013 08:25:20 +0000 (10:25 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Thu, 2 May 2013 08:34:16 +0000 (10:34 +0200)
- debian_repos2db.sh would fail otherwise
- debian_build.py now uses the same variables from ENV-dict

common_code.py
debian_build.py

index dc4e7d33e6979930c54abc342623e33a1f389e11..fc58765580f57fe727dbf2375c1df8db18882b62 100755 (executable)
@@ -54,11 +54,6 @@ BUILD_ARCH_MAP = {
     }
 BUILD_ARCH = BUILD_ARCH_MAP.get(platform.machine(), '686')
 BUILD_AREA = os.path.abspath(os.path.join(os.curdir,'../build-area'))
-BUILD_ID = ENV['BUILD_ID']
-BUILD_JOBNAME = ENV['JOB_NAME']
-BUILD_NUMBER = ENV['BUILD_NUMBER']
-BUILD_START = datetime.datetime.now()
-BUILD_URL = ENV['BUILD_URL']
 
 CWD = ENV['WORKSPACE']
 
index b3fa078e76e4f2055166e6993b856e743e2aab4c..0d9c206a76914d930d7dd640b8af3e04e12416db 100755 (executable)
@@ -54,10 +54,12 @@ GIT_COMMITTER_EMAIL = ENV['GIT_COMMITTER_EMAIL']
 ENV.setdefault('NO_UPLOAD','')
 NO_UPLOAD = ENV['NO_UPLOAD']
 
+BUILD_START = datetime.datetime.now()
+
 #unused: (except in in-active code)
 GIT_TARGET_WORKSPACE = os.path.join(
     CWD,
-    ('%s-build%s' %(BUILD_ID, BUILD_NUMBER)),
+    ('%s-build%s' %(ENV['BUILD_ID'], ENV['BUILD_NUMBER'])),
     )
 #unused: (except in in-active code)
 GIT_TARGET_DIR = os.path.join(
@@ -293,7 +295,7 @@ if __name__ == '__main__':
     else:
         logger.debug('Status is now:\n%s' %( gitcmd.status().strip() ))
 
-    if GIT_BRANCH_NAME == 'master' and BUILD_JOBNAME in AUTO_CHANGELOG_JOBS:
+    if GIT_BRANCH_NAME == 'master' and ENV['BUILD_JOBNAME'] in AUTO_CHANGELOG_JOBS:
         cmd = ['/usr/bin/dch', '-i', 'Released by jenkins.']
         subprocess.check_call(cmd)
         cmd = ['/usr/bin/git-dch', '-R', '-a', '--spawn-editor=none']
@@ -422,10 +424,10 @@ if __name__ == '__main__':
             changelog_distro = 'staging'
             # use shorter date because we can
             daily_date = datetime.datetime.now().strftime('%Y%m%d')
-            version = '%s~rc%s+%s+%s' %(version, daily_date, BUILD_NUMBER, current_commit[0:7])
+            version = '%s~rc%s+%s+%s' %(version, daily_date, ENV['BUILD_NUMBER'], current_commit[0:7])
         elif GIT_BRANCH_NAME.startswith('feature/') or GIT_BRANCH_NAME.startswith('poc/') or GIT_BRANCH_NAME.startswith('bugfix/'):
             changelog_distro ='dev-'+ GIT_BRANCH_NAME.replace("/","-")
-            version = '%s~experimental%s+%s+%s' %(version, daily_date, BUILD_NUMBER, current_commit[0:7])
+            version = '%s~experimental%s+%s+%s' %(version, daily_date, ENV['BUILD_NUMBER'], current_commit[0:7])
             # these uploads should go to a different repo:
             DPUT_OPTIONS = DPUT_OPTIONS_DEV
         else:
@@ -440,7 +442,7 @@ if __name__ == '__main__':
             #        version = '%s~alpha%s+%s+%s' %(version, daily_date, BUILD_NUMBER, current_commit[0:7])
             #        changelog_distro = 'unstable'
             #else:
-            version = '%s~develop%s+%s+%s' %(version, daily_date, BUILD_NUMBER, current_commit[0:7])
+            version = '%s~develop%s+%s+%s' %(version, daily_date, ENV['BUILD_NUMBER'], current_commit[0:7])
             changelog_distro = 'pre-staging'
 
         new_log = 'Generated by jenkins build of %s' % current_commit
@@ -628,7 +630,7 @@ if __name__ == '__main__':
     package_instances=[]
     if GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME == 'develop' or GIT_BRANCH_NAME.startswith('hotfix/'):
         try:
-            package_instances = add_package_instances("profitbricks", BUILD_JOBNAME, BUILD_NUMBER, changes_file, version, BUILD_START, BUILD_END)
+            package_instances = add_package_instances("profitbricks", ENV['BUILD_JOBNAME'], ENV['BUILD_NUMBER'], changes_file, version, BUILD_START, BUILD_END)
         except Exception, error:
             cmd = ['figlet-figlet', '-t', 'CIDB problem:']
             subprocess.check_call(cmd)