From: Mathias Klette Date: Sun, 26 May 2013 00:05:27 +0000 (+0200) Subject: debian_build: do not let a jenkins user start job builds from inapproriate branches X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=e17d0c02809f868bd49edeab0783a0cef26450b1;p=profitbricks%2Fjenkins-build-scripts.git debian_build: do not let a jenkins user start job builds from inapproriate branches --- diff --git a/debian_build.py b/debian_build.py index a290904..fb8103d 100755 --- a/debian_build.py +++ b/debian_build.py @@ -171,10 +171,13 @@ if __name__ == '__main__': do_triggers = True if re.match(STABLE_BRANCHES_RE, ENV['GIT_BRANCH']): + if re.match('^(ps_|dev_).*$', ENV['JOB_NAME']): + logger.error('Use the appropriate job to build for branch "%s"!' %( + ENV['GIT_BRANCH'] + )) + exit_error() new_dist = 'stable' - new_version = '{version}'.format( - version = curr_version, - ) + new_version = '{version}'.format(version = curr_version) pb_suite = 'master-' + ENV['DISTRIBUTION'] # replace valid debian version chars that are invalid for git tagging new_tag = curr_version.replace('~','_') @@ -207,6 +210,11 @@ if __name__ == '__main__': }) elif re.match(UNSTABLE_BRANCHES_RE, ENV['GIT_BRANCH']): + if not re.match('^ps_.*$', ENV['JOB_NAME']): + logger.error('Use the appropriate job to build for branch "%s"!' %( + ENV['GIT_BRANCH'] + )) + exit_error() new_dist = 'unstable' new_version = '{version}~develop{date}+{build}+{commit}'.format( version = curr_version, @@ -225,6 +233,11 @@ if __name__ == '__main__': }) elif re.match(EXPERIMENTAL_BRANCHES_RE, ENV['GIT_BRANCH']): + if not re.match('^dev_.*$', ENV['JOB_NAME']): + logger.error('Use the appropriate job to build for branch "%s"!' %( + ENV['GIT_BRANCH'] + )) + exit_error() new_dist = 'dev-' + ENV['GIT_BRANCH'].replace("/","-") new_version = '{version}~experimental{date}+{build}+{commit}'.format( version = curr_version,