]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
common_code: reset GIT_BRANCH if it differs from GIT_BRANCH_NAME
authorMathias Klette <mathias.klette@profitbricks.com>
Wed, 29 May 2013 12:11:23 +0000 (14:11 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Wed, 29 May 2013 12:11:23 +0000 (14:11 +0200)
Most jobs use GIT_BRANCH_NAME parameter to let user choose the branch to build
the package from while GIT_BRANCH contains the sha commit id of HEAD of most
recent commit (unconfirmed yet).

common_code.py

index f2ad5d8ee8fe8895f6c484ccc34034ccf1d14a51..2b01ffccd22352e7f109d9d64eccf56467c45f54 100755 (executable)
@@ -49,6 +49,8 @@ ENV = os.environ
 ENV.setdefault('ARGV',' '.join(sys.argv))
 ENV.setdefault('CWD',os.getcwd())
 ENV.setdefault('GIT_BRANCH_NAME', ENV['GIT_BRANCH'])
+if ENV['GIT_BRANCH'] != ENV['GIT_BRANCH_NAME']:
+    ENV['GIT_BRANCH'] = ENV['GIT_BRANCH_NAME']
 
 BIN_DCH = '/usr/bin/dch'
 BIN_DPUT = '/usr/bin/dput'