docker/pool/builder/lib/builder.rb
def up
      begin
        lock = File.open(lockfile, 'w')
        if lock.flock(File::LOCK_EX | File::LOCK_NB )
          image_id = build
          container = run(image_id)
          confirm_running(container)
        else
          @logger.info("Locked! Other environment is under building process")
          @logger.info("Please wait for finishing another building process...")
          raise BuildLockedError
        end
      rescue BuildLockedError
        Timeout::timeout(BUILD_LOCK_TIMEOUT) do
          lock.flock(File::LOCK_EX)
        end
      rescue Timeout::Error
        @logger.error("No response after #{BUILD_LOCK_TIMEOUT}. Please reload the page.")
      rescue => ex
        @logger.error ex
        raise
      ensure
        @logger.close
        @log_device_pool.delete_device(@git_commit_id)
        lock.flock(File::LOCK_UN)
      end
    end
# Build Docker image and run it as a container.
Build Docker image and run it as a container.
Build Docker image and run it as a container .
def up
      begin
        lock = File.open(lockfile, 'w')
        if lock.flock(File::LOCK_EX | File::LOCK_NB )
          image_id = build
          container = run(image_id)
          confirm_running(container)
        else
          @logger.info("Locked! Other environment is under building process")
          @logger.info("Please wait for finishing another building process...")
          raise BuildLockedError
        end
      rescue BuildLockedError
        Timeout::timeout(BUILD_LOCK_TIMEOUT) do
          lock.flock(File::LOCK_EX)
        end
      rescue Timeout::Error
        @logger.error("No response after #{BUILD_LOCK_TIMEOUT}. Please reload the page.")
      rescue => ex
        @logger.error ex
        raise
      ensure
        @logger.close
        @log_device_pool.delete_device(@git_commit_id)
        lock.flock(File::LOCK_UN)
      end
    end
def up begin lock = File . open ( lockfile , 'w' ) if lock . flock ( File :: LOCK_EX | File :: LOCK_NB ) image_id = build container = run ( image_id ) confirm_running ( container ) else @logger . info ( "Locked! Other environment is under building process" ) @logger . info ( "Please wait for finishing another building process..." ) raise BuildLockedError end rescue BuildLockedError Timeout :: timeout ( BUILD_LOCK_TIMEOUT ) do lock . flock ( File :: LOCK_EX ) end rescue Timeout :: Error @logger . error ( "No response after #{BUILD_LOCK_TIMEOUT}. Please reload the page." ) rescue => ex @logger . error ex raise ensure @logger . close @log_device_pool . delete_device ( @git_commit_id ) lock . flock ( File :: LOCK_UN ) end end
Build Docker image and run it as a container.
Build Docker image and run it as a container .