Merge "Don't set job var override_checkout if null" into feature/zuulv3
diff --git a/zuul/executor/server.py b/zuul/executor/server.py
index 791652f..016d0e6 100644
--- a/zuul/executor/server.py
+++ b/zuul/executor/server.py
@@ -358,8 +358,10 @@
         # there is a period of time where the user can click on the live log
         # link on the status page but the log streaming fails because the file
         # is not there yet.
-        with open(self.job_output_file, 'w'):
-            pass
+        with open(self.job_output_file, 'w') as job_output:
+            job_output.write("{now} | Job console starting...\n".format(
+                now=datetime.datetime.now()
+            ))
         self.trusted_projects = []
         self.trusted_project_index = {}
 
@@ -768,22 +770,22 @@
         branches = repo.getBranches()
         refs = [r.name for r in repo.getRefs()]
         selected_ref = None
-        if project_override_branch in branches:
-            selected_ref = project_override_branch
-            self.log.info("Checking out %s project override branch %s",
-                          project_name, selected_ref)
         if project_override_checkout in refs:
             selected_ref = project_override_checkout
             self.log.info("Checking out %s project override ref %s",
                           project_name, selected_ref)
-        elif job_override_branch in branches:
-            selected_ref = job_override_branch
-            self.log.info("Checking out %s job override branch %s",
+        elif project_override_branch in branches:
+            selected_ref = project_override_branch
+            self.log.info("Checking out %s project override branch %s",
                           project_name, selected_ref)
         elif job_override_checkout in refs:
             selected_ref = job_override_checkout
             self.log.info("Checking out %s job override ref %s",
                           project_name, selected_ref)
+        elif job_override_branch in branches:
+            selected_ref = job_override_branch
+            self.log.info("Checking out %s job override branch %s",
+                          project_name, selected_ref)
         elif ref and ref.startswith('refs/heads/'):
             selected_ref = ref[len('refs/heads/'):]
             self.log.info("Checking out %s branch ref %s",