[Notes] [Git][BuildStream/buildstream][jmac/remote_execution_split] 2 commits: Documentation: Update to show new config options



Title: GitLab

Jim MacArthur pushed to branch jmac/remote_execution_split at BuildStream / buildstream

Commits:

2 changed files:

Changes:

  • doc/source/format_project.rst
    ... ... @@ -231,10 +231,25 @@ using the `remote-execution` option:
    231 231
       remote-execution:
    
    232 232
     
    
    233 233
         # A url defining a remote execution server
    
    234
    -    url: http://buildserver.example.com:50051
    
    234
    +    exec-server:
    
    235
    +      url: buildserver.example.com:50051
    
    236
    +    storage-server:
    
    237
    +    - url: https://foo.com/artifacts:11002
    
    238
    +      server-cert: server.crt
    
    239
    +      client-cert: client.crt
    
    240
    +      client-key: client.key
    
    241
    +
    
    242
    +For the exec-server, the protocol will always be REAPI, so no protocol
    
    243
    +is listed in the url. The exec-server part of remote execution does
    
    244
    +not support encrypted connections yet.
    
    245
    +
    
    246
    +storage-server specifies a remote CAS store and the parameters are the
    
    247
    +same as those used to specify an :ref:`artifact server <artifacts>`.
    
    235 248
     
    
    236
    -The url should contain a hostname and port separated by ':'. Only plain HTTP is
    
    237
    -currently suported (no HTTPS).
    
    249
    +The storage server may be the same server used for artifact
    
    250
    +caching. Remote execution cannot work without push access to the
    
    251
    +storage server, so you must specify a client certificate and key, and
    
    252
    +a server certificate.
    
    238 253
     
    
    239 254
     The Remote Execution API can be found via https://github.com/bazelbuild/remote-apis.
    
    240 255
     
    

  • tests/sandboxes/remote-exec-config.py
    1
    +import pytest
    
    2
    +
    
    3
    +import itertools
    
    4
    +import os
    
    5
    +
    
    6
    +from buildstream import _yaml
    
    7
    +from buildstream._exceptions import ErrorDomain, LoadErrorReason
    
    8
    +
    
    9
    +from tests.testutils.runcli import cli
    
    10
    +
    
    11
    +DATA_DIR = os.path.dirname(os.path.realpath(__file__))
    
    12
    +
    
    13
    +# Tests that we get a useful error message when supplying invalid
    
    14
    +# remote execution configurations.
    
    15
    +
    
    16
    +
    
    17
    +# Assert that if both 'url' (the old style) and 'exec-service' (the new style)
    
    18
    +# are used at once, a LoadError results.
    
    19
    +@pytest.mark.datafiles(DATA_DIR)
    
    20
    +def test_old_and_new_configs(cli, datafiles):
    
    21
    +    project = os.path.join(datafiles.dirname, datafiles.basename, 'missing-certs')
    
    22
    +
    
    23
    +    project_conf = {
    
    24
    +        'name': 'test',
    
    25
    +
    
    26
    +        'remote-execution': {
    
    27
    +            'url': 'https://cache.example.com:12345',
    
    28
    +            'exec-service': {
    
    29
    +                'url': 'http://localhost:8088'
    
    30
    +            },
    
    31
    +            'storage-service': {
    
    32
    +                'url': 'http://charactron:11001',
    
    33
    +            }
    
    34
    +        }
    
    35
    +    }
    
    36
    +    project_conf_file = os.path.join(project, 'project.conf')
    
    37
    +    _yaml.dump(project_conf, project_conf_file)
    
    38
    +
    
    39
    +    # Use `pull` here to ensure we try to initialize the remotes, triggering the error
    
    40
    +    #
    
    41
    +    # This does not happen for a simple `bst show`.
    
    42
    +    result = cli.run(project=project, args=['pull', 'element.bst'])
    
    43
    +    result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA, "specify one")
    
    44
    +
    
    45
    +
    
    46
    +# Assert that if either the client key or client cert is specified
    
    47
    +# without specifying its counterpart, we get a comprehensive LoadError
    
    48
    +# instead of an unhandled exception.
    
    49
    +@pytest.mark.datafiles(DATA_DIR)
    
    50
    +@pytest.mark.parametrize('config_key, config_value', [
    
    51
    +    ('client-cert', 'client.crt'),
    
    52
    +    ('client-key', 'client.key')
    
    53
    +])
    
    54
    +def test_missing_certs(cli, datafiles, config_key, config_value):
    
    55
    +    project = os.path.join(datafiles.dirname, datafiles.basename, 'missing-certs')
    
    56
    +
    
    57
    +    project_conf = {
    
    58
    +        'name': 'test',
    
    59
    +
    
    60
    +        'remote-execution': {
    
    61
    +            'exec-service': {
    
    62
    +                'url': 'http://localhost:8088'
    
    63
    +            },
    
    64
    +            'storage-service': {
    
    65
    +                'url': 'http://charactron:11001',
    
    66
    +                config_key: config_value,
    
    67
    +            }
    
    68
    +        }
    
    69
    +    }
    
    70
    +    project_conf_file = os.path.join(project, 'project.conf')
    
    71
    +    _yaml.dump(project_conf, project_conf_file)
    
    72
    +
    
    73
    +    # Use `pull` here to ensure we try to initialize the remotes, triggering the error
    
    74
    +    #
    
    75
    +    # This does not happen for a simple `bst show`.
    
    76
    +    result = cli.run(project=project, args=['show', 'element.bst'])
    
    77
    +    result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA, "Your config is missing")
    
    78
    +
    
    79
    +
    
    80
    +# Assert that if incomplete information is supplied we get a sensible error message.
    
    81
    +@pytest.mark.datafiles(DATA_DIR)
    
    82
    +def test_empty_config(cli, datafiles):
    
    83
    +    project = os.path.join(datafiles.dirname, datafiles.basename, 'missing-certs')
    
    84
    +
    
    85
    +    project_conf = {
    
    86
    +        'name': 'test',
    
    87
    +
    
    88
    +        'remote-execution': {
    
    89
    +        }
    
    90
    +    }
    
    91
    +    project_conf_file = os.path.join(project, 'project.conf')
    
    92
    +    _yaml.dump(project_conf, project_conf_file)
    
    93
    +
    
    94
    +    # Use `pull` here to ensure we try to initialize the remotes, triggering the error
    
    95
    +    #
    
    96
    +    # This does not happen for a simple `bst show`.
    
    97
    +    result = cli.run(project=project, args=['pull', 'element.bst'])
    
    98
    +    result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA, "specify one")



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]