Exemplo n.º 1
0
def bootstrap_gcs(storage_path):
    """Bootstrap GCS."""
    local_gcs_buckets_path = os.path.join(storage_path, 'local_gcs')
    if not os.path.exists(local_gcs_buckets_path):
        os.mkdir(local_gcs_buckets_path)

    config = local_config.ProjectConfig()
    test_blobs_bucket = os.environ.get('TEST_BLOBS_BUCKET')
    if test_blobs_bucket:
        create_local_bucket(local_gcs_buckets_path, test_blobs_bucket)
    else:
        create_local_bucket(local_gcs_buckets_path, config.get('blobs.bucket'))

    create_local_bucket(local_gcs_buckets_path,
                        config.get('deployment.bucket'))
    create_local_bucket(local_gcs_buckets_path, config.get('bigquery.bucket'))
    create_local_bucket(local_gcs_buckets_path, config.get('backup.bucket'))
    create_local_bucket(local_gcs_buckets_path,
                        config.get('logs.fuzzer.bucket'))
    create_local_bucket(local_gcs_buckets_path,
                        config.get('env.CORPUS_BUCKET'))
    create_local_bucket(local_gcs_buckets_path,
                        config.get('env.QUARANTINE_BUCKET'))
    create_local_bucket(local_gcs_buckets_path,
                        config.get('env.SHARED_CORPUS_BUCKET'))
    create_local_bucket(local_gcs_buckets_path,
                        config.get('env.FUZZ_LOGS_BUCKET'))
    create_local_bucket(local_gcs_buckets_path,
                        config.get('env.MUTATOR_PLUGINS_BUCKET'))

    # Symlink local GCS bucket path to appengine src dir to bypass sandboxing
    # issues.
    common.symlink(src=local_gcs_buckets_path,
                   target=os.path.join(appengine.SRC_DIR_PY, 'local_gcs'))
Exemplo n.º 2
0
def symlink_dirs():
  """Symlink folders for use on appengine."""
  symlink_config_dir()

  common.symlink(
      src=os.path.join('src', 'protos'),
      target=os.path.join(SRC_DIR_PY, 'protos'))
  common.symlink(
      src=os.path.join('src', 'python'),
      target=os.path.join(SRC_DIR_PY, 'python'))
  # While importing third party modules, we may call pkg_resources.
  # pkg_resources normalizes paths by calling os.path.realpath on them, which is
  # incompatible with the App Engine sandbox since the resulting path will no
  # longer be under appengine/.
  common.copy_dir(
      src=os.path.join('src', 'third_party'),
      target=os.path.join(SRC_DIR_PY, 'third_party'))

  # Remove existing local_gcs symlink (if any). This is important, as otherwise
  # we will try deploying the directory in production. This is only needed for
  # local development in run_server.
  local_gcs_symlink_path = os.path.join(SRC_DIR_PY, 'local_gcs')
  if os.path.exists(local_gcs_symlink_path):
    os.remove(local_gcs_symlink_path)

  _, output = common.execute('bazel run //local:create_gopath', cwd='src')
  os.environ['GOPATH'] = output.splitlines()[-1]
Exemplo n.º 3
0
def symlink_dirs():
    """Symlink folders for use on appengine."""
    symlink_config_dir()

    common.symlink(src=os.path.join('src', 'clusterfuzz'),
                   target=os.path.join(SRC_DIR_PY, 'clusterfuzz'))

    # Remove existing local_gcs symlink (if any). This is important, as otherwise
    # we will try deploying the directory in production. This is only needed for
    # local development in run_server.
    local_gcs_symlink_path = os.path.join(SRC_DIR_PY, 'local_gcs')
    common.remove_symlink(local_gcs_symlink_path)
Exemplo n.º 4
0
def symlink_dirs():
    """Symlink folders for use on appengine."""
    symlink_config_dir()

    common.symlink(src=os.path.join('src', 'protos'),
                   target=os.path.join(SRC_DIR_PY, 'protos'))
    common.symlink(src=os.path.join('src', 'python'),
                   target=os.path.join(SRC_DIR_PY, 'python'))
    common.symlink(src=os.path.join('src', 'third_party'),
                   target=os.path.join(SRC_DIR_PY, 'third_party'))

    # Remove existing local_gcs symlink (if any). This is important, as otherwise
    # we will try deploying the directory in production. This is only needed for
    # local development in run_server.
    local_gcs_symlink_path = os.path.join(SRC_DIR_PY, 'local_gcs')
    if os.path.exists(local_gcs_symlink_path):
        os.remove(local_gcs_symlink_path)

    _, output = common.execute('bazel run //local:create_gopath', cwd='src')
    os.environ['GOPATH'] = output.splitlines()[-1]
Exemplo n.º 5
0
def symlink_config_dir():
    """Symlink config directory in appengine directory."""
    config_dir = os.getenv('CONFIG_DIR_OVERRIDE', constants.TEST_CONFIG_DIR)
    common.symlink(src=config_dir, target=os.path.join(SRC_DIR_PY, 'config'))