Exemplo n.º 1
0
    def test(self, worker_names, user_test_args):
        user_args = " ".join(user_test_args)

        workers = self.push(worker_names)
        if workers == None:
            return False

        host_list = [name for name in workers]
        is_parallel = len(host_list) > 1

        if (is_parallel):
            #fabric by default treats hosts as unique, and if you have multiple jobs
            #that use the same hostname they are all passed to that fabric worker.
            #what we do is inject our own fabric_execut that pulls in more env
            #settings to create a 2 way mapping from worker names to fabric connections
            with fabric_settings(parallel=True):
                cf_execute.execute(self.__test,
                                   hosts=host_list,
                                   workers=workers,
                                   user_args=user_args)
        else:
            w = workers[host_list[0]]
            cf_execute.execute(self.__test,
                               hosts=w.connection_name,
                               worker=w,
                               user_args=user_args)
        return True
Exemplo n.º 2
0
    def setup(self, worker_names, user_setup_args):
        if len(user_setup_args) > 0:
            print 'unable to support user defined args for setup currently'
            return

        for worker_name in worker_names:
            #take the worker from the farm that matches the name passed in
            # if no worker found, send nice error stating so
            if worker_name not in self.__workers:
                print 'no worker found with that name'
                continue

            print 'setting up worker: ', worker_name
            worker = self.__workers[worker_name]
            #
            #create a git directory under the source directory
            #setup a post-receive hook to set the working directory
            #to be equal to the source directory
            worker_repo = cf_git.RemoteRepo(worker, self.lfs_dict)
            worker_repo.create()
            worker_repo.install_hooks()

            #
            #now we have to add the worker as a git remote
            #remote url looks like username@host:path/to/repository.git
            #
            worker_host_name = worker.connection_name
            worker_path = worker_repo.git_location  #need the git repo not src dir

            #construct the full remote url
            remote_url = worker_host_name + ":" + worker_path

            #first remove the remote in case it already exists and we need
            #to change the url, and than add it
            self.repo().add_remote(worker_name, remote_url)

            #setup lfs endpoint for the remote
            self.repo().add_lfs_endpoint(worker_name, self.lfs_dict)

            #push current head as a starting point
            self.repo().push(worker_name, '+HEAD:refs/heads/master')

            #now get cfarm to remote into the build
            #directory and run ccmake
            cf_execute.execute(self.__setup,
                               worker=worker,
                               host=worker_host_name)
        return True
Exemplo n.º 3
0
  def setup(self,worker_names, user_setup_args):
    if len(user_setup_args) > 0:
      print 'unable to support user defined args for setup currently'
      return

    for worker_name in worker_names:
      #take the worker from the farm that matches the name passed in
      # if no worker found, send nice error stating so
      if worker_name not in self.__workers:
        print 'no worker found with that name'
        continue

      print 'setting up worker: ', worker_name
      worker = self.__workers[worker_name]
      #
      #create a git directory under the source directory
      #setup a post-receive hook to set the working directory
      #to be equal to the source directory
      worker_repo = cf_git.RemoteRepo(worker, self.lfs_dict)
      worker_repo.create()
      worker_repo.install_hooks()


      #
      #now we have to add the worker as a git remote
      #remote url looks like username@host:path/to/repository.git
      #
      worker_host_name = worker.connection_name
      worker_path = worker_repo.git_location #need the git repo not src dir

      #construct the full remote url
      remote_url = worker_host_name + ":" + worker_path

      #first remove the remote in case it already exists and we need
      #to change the url, and than add it
      self.repo().add_remote(worker_name,remote_url)

      #setup lfs endpoint for the remote
      self.repo().add_lfs_endpoint(worker_name, self.lfs_dict)


      #push current head as a starting point
      self.repo().push(worker_name,'+HEAD:refs/heads/master')

      #now get cfarm to remote into the build
      #directory and run ccmake
      cf_execute.execute(self.__setup, worker = worker, host=worker_host_name)
    return True
Exemplo n.º 4
0
  def test(self, worker_names, user_test_args):
    user_args = " ".join(user_test_args)

    workers = self.push(worker_names)
    if workers == None:
      return False

    host_list = [name for name in workers]
    is_parallel = len(host_list) > 1

    if(is_parallel):
      #fabric by default treats hosts as unique, and if you have multiple jobs
      #that use the same hostname they are all passed to that fabric worker.
      #what we do is inject our own fabric_execut that pulls in more env
      #settings to create a 2 way mapping from worker names to fabric connections
      with fabric_settings(parallel=True):
        cf_execute.execute(self.__test, hosts=host_list, workers=workers, user_args=user_args)
    else:
      w = workers[host_list[0]]
      cf_execute.execute(self.__test, hosts=w.connection_name, worker=w, user_args=user_args)
    return True