]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
debian_build: do not let a jenkins user start job builds from inapproriate branches
authorMathias Klette <mathias.klette@profitbricks.com>
Sun, 26 May 2013 00:05:27 +0000 (02:05 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Sun, 26 May 2013 00:05:27 +0000 (02:05 +0200)
debian_build.py

index a2909042f7ee171e2034db00527ad5e6a60f983a..fb8103d1b42065cd2a897313eafc923ff1a87bd6 100755 (executable)
@@ -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,