Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • edbaunton/buildgrid
  • BuildGrid/buildgrid
  • bloomberg/buildgrid
  • devcurmudgeon/buildgrid
  • mhadjimichael/buildgrid
  • jmacarthur/buildgrid
  • rkothur/buildgrid
  • valentindavid/buildgrid
  • jjardon/buildgrid
  • RichKen/buildgrid
  • jbonney/buildgrid
  • onsha_alexander/buildgrid
  • santigl/buildgrid
  • mostynb/buildgrid
  • hoffbrinkle/buildgrid
  • Malinskiy/buildgrid
  • coldtom/buildgrid
  • azeemb_a/buildgrid
  • pointswaves/buildgrid
  • BenjaminSchubert/buildgrid
  • michaellee8/buildgrid
  • anil-anil/buildgrid
  • seanborg/buildgrid
  • jdelong12/buildgrid
  • jclay/buildgrid
  • bweston92/buildgrid
  • zchen723/buildgrid
  • cpratt34/buildgrid
  • armbiant/apache-buildgrid
  • armbiant/android-buildgrid
  • itsme300/buildgrid
  • sbairoliya/buildgrid
32 results
Show changes
Commits on Source (3)
......@@ -53,10 +53,16 @@ def start(context, config):
insecure_mode = server_settings['insecure-mode']
credentials = None
credentials_settings = server_settings.get('credentials')
if not insecure_mode:
server_key = server_settings['tls-server-key']
server_cert = server_settings['tls-server-cert']
client_certs = server_settings['tls-client-certs']
if not credentials_settings:
click.echo("ERROR: no TLS keys were specified and no defaults could be found.\n" +
"Set `insecure-mode: false` in order to deactivate TLS encryption.\n", err=True)
sys.exit(-1)
server_key = credentials_settings['tls-server-key']
server_cert = credentials_settings['tls-server-cert']
client_certs = credentials_settings['tls-client-certs']
credentials = context.load_server_credentials(server_key, server_cert, client_certs)
if not credentials:
......
server:
port: 50052
insecure-mode: true
tls-server-key: null
tls-server-cert: null
tls-client-certs: null
description: |
Just a CAS.
instances:
- name: main
description: |
The main server
storages:
- !disk-storage &main-storage
path: ~/cas/
services:
- !cas
storage: *main-storage
server:
port: 50051
insecure-mode: true
tls-server-key: null
tls-server-cert: null
tls-client-certs: null
insecure-mode: true
description: |
A single default instance
......
......@@ -14,7 +14,11 @@
import os
import sys
from urllib.parse import urlparse
import click
import grpc
import yaml
from buildgrid.server.controller import ExecutionController
......@@ -22,9 +26,12 @@ from buildgrid.server.actioncache.storage import ActionCache
from buildgrid.server.cas.instance import ByteStreamInstance, ContentAddressableStorageInstance
from buildgrid.server.cas.storage.disk import DiskStorage
from buildgrid.server.cas.storage.lru_memory_cache import LRUMemoryCache
from buildgrid.server.cas.storage.remote import RemoteStorage
from buildgrid.server.cas.storage.s3 import S3Storage
from buildgrid.server.cas.storage.with_cache import WithCacheStorage
from ..cli import Context
class YamlFactory(yaml.YAMLObject):
@classmethod
......@@ -58,6 +65,45 @@ class S3(YamlFactory):
return S3Storage(bucket, endpoint_url=endpoint)
class Remote(YamlFactory):
yaml_tag = u'!remote-storage'
def __new__(cls, url, credentials=None):
# TODO: Context could be passed into the parser.
context = Context()
url = urlparse(url)
remote = '{}:{}'.format(url.hostname, url.port or 50051)
channel = None
if url.scheme == 'http':
channel = grpc.insecure_channel(remote)
else:
if not credentials:
click.echo("ERROR: no TLS keys were specified and no defaults could be found.\n" +
"Set remote url scheme to `http` in order to deactivate" +
"TLS encryption.\n", err=True)
sys.exit(-1)
client_key = credentials['tls-client-key']
client_cert = credentials['tls-client-cert']
server_cert = credentials['tls-server-cert']
credentials = context.load_client_credentials(client_key,
client_cert,
server_cert)
if not credentials:
click.echo("ERROR: no TLS keys were specified and no defaults could be found.\n" +
"Set remote url scheme to `http` in order to deactivate" +
"TLS encryption.\n", err=True)
sys.exit(-1)
channel = grpc.secure_channel(remote, credentials)
return RemoteStorage(channel)
class WithCache(YamlFactory):
yaml_tag = u'!with-cache-storage'
......@@ -118,6 +164,7 @@ def get_parser():
yaml.SafeLoader.add_constructor(Disk.yaml_tag, Disk.from_yaml)
yaml.SafeLoader.add_constructor(LRU.yaml_tag, LRU.from_yaml)
yaml.SafeLoader.add_constructor(S3.yaml_tag, S3.from_yaml)
yaml.SafeLoader.add_constructor(Remote.yaml_tag, Remote.from_yaml)
yaml.SafeLoader.add_constructor(WithCache.yaml_tag, WithCache.from_yaml)
yaml.SafeLoader.add_constructor(CAS.yaml_tag, CAS.from_yaml)
yaml.SafeLoader.add_constructor(ByteStream.yaml_tag, ByteStream.from_yaml)
......
server:
port: 50051
insecure-mode: false
tls-server-key: null
tls-server-cert: null
tls-client-certs: null
description: |
A single default instance with remote storage.
instances:
- name: main
description: |
The main server
storages:
- !remote-storage &main-storage
url: "https://localhost:50052"
credentials:
tls-client-key: null
tls-client-cert: null
tls-server-cert: null
services:
- !action-cache &main-action
storage: *main-storage
max_cached_refs: 256
allow_updates: true
- !execution
storage: *main-storage
action_cache: *main-action
- !cas
storage: *main-storage
- !bytestream
storage: *main-storage