From 223e18af4425dec7eec4a900da78e9af2db2157e Mon Sep 17 00:00:00 2001 From: Mathias Klette Date: Thu, 2 May 2013 10:25:20 +0200 Subject: [PATCH] remove jenkins build specific variable assignments from common_code - debian_repos2db.sh would fail otherwise - debian_build.py now uses the same variables from ENV-dict --- common_code.py | 5 ----- debian_build.py | 14 ++++++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/common_code.py b/common_code.py index dc4e7d3..fc58765 100755 --- a/common_code.py +++ b/common_code.py @@ -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'] diff --git a/debian_build.py b/debian_build.py index b3fa078..0d9c206 100755 --- a/debian_build.py +++ b/debian_build.py @@ -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) -- 2.39.5