[Notes] [Git][BuildStream/buildstream][valentindavid/remote_execution_configuration] 8 commits: doc/Makefile: Update comment about sphinx entrypoint



Title: GitLab

Valentin David pushed to branch valentindavid/remote_execution_configuration at BuildStream / buildstream

Commits:

13 changed files:

Changes:

  • .gitlab-ci.yml
    1
    -image: buildstream/testsuite-debian:9-master-123-7ce6581b
    
    1
    +image: buildstream/testsuite-debian:9-06bab030-b848172c
    
    2 2
     
    
    3 3
     cache:
    
    4 4
       key: "$CI_JOB_NAME-"
    
    ... ... @@ -91,23 +91,23 @@ source_dist:
    91 91
         - ${COVERAGE_DIR}
    
    92 92
     
    
    93 93
     tests-debian-9:
    
    94
    -  image: buildstream/testsuite-debian:9-master-123-7ce6581b
    
    94
    +  image: buildstream/testsuite-debian:9-06bab030-b848172c
    
    95 95
       <<: *tests
    
    96 96
     
    
    97 97
     tests-fedora-27:
    
    98
    -  image: buildstream/testsuite-fedora:27-master-123-7ce6581b
    
    98
    +  image: buildstream/testsuite-fedora:27-06bab030-b848172c
    
    99 99
       <<: *tests
    
    100 100
     
    
    101 101
     tests-fedora-28:
    
    102
    -  image: buildstream/testsuite-fedora:28-master-123-7ce6581b
    
    102
    +  image: buildstream/testsuite-fedora:28-06bab030-b848172c
    
    103 103
       <<: *tests
    
    104 104
     
    
    105 105
     tests-ubuntu-18.04:
    
    106
    -  image: buildstream/testsuite-ubuntu:18.04-master-123-7ce6581b
    
    106
    +  image: buildstream/testsuite-ubuntu:18.04-06bab030-b848172c
    
    107 107
       <<: *tests
    
    108 108
     
    
    109 109
     overnight-fedora-28-aarch64:
    
    110
    -  image: buildstream/testsuite-fedora:aarch64-28-master-123-7ce6581b
    
    110
    +  image: buildstream/testsuite-fedora:aarch64-28-06bab030-32a101f6
    
    111 111
       tags:
    
    112 112
         - aarch64
    
    113 113
       <<: *tests
    
    ... ... @@ -120,7 +120,7 @@ overnight-fedora-28-aarch64:
    120 120
     tests-unix:
    
    121 121
       # Use fedora here, to a) run a test on fedora and b) ensure that we
    
    122 122
       # can get rid of ostree - this is not possible with debian-8
    
    123
    -  image: buildstream/testsuite-fedora:27-master-123-7ce6581b
    
    123
    +  image: buildstream/testsuite-fedora:27-06bab030-b848172c
    
    124 124
       <<: *tests
    
    125 125
       variables:
    
    126 126
         BST_FORCE_BACKEND: "unix"
    
    ... ... @@ -140,7 +140,7 @@ tests-unix:
    140 140
     
    
    141 141
     tests-fedora-missing-deps:
    
    142 142
       # Ensure that tests behave nicely while missing bwrap and ostree
    
    143
    -  image: buildstream/testsuite-fedora:28-master-123-7ce6581b
    
    143
    +  image: buildstream/testsuite-fedora:28-06bab030-b848172c
    
    144 144
       <<: *tests
    
    145 145
     
    
    146 146
       script:
    

  • buildstream/_context.py
    ... ... @@ -34,6 +34,7 @@ from ._artifactcache import ArtifactCache
    34 34
     from ._artifactcache.cascache import CASCache
    
    35 35
     from ._workspaces import Workspaces, WorkspaceProjectCache, WORKSPACE_PROJECT_FILE
    
    36 36
     from .plugin import _plugin_lookup
    
    37
    +from .sandbox import SandboxRemote
    
    37 38
     
    
    38 39
     
    
    39 40
     # Context()
    
    ... ... @@ -72,6 +73,9 @@ class Context():
    72 73
             # The locations from which to push and pull prebuilt artifacts
    
    73 74
             self.artifact_cache_specs = None
    
    74 75
     
    
    76
    +        # The global remote execution configuration
    
    77
    +        self.remote_execution_specs = None
    
    78
    +
    
    75 79
             # The directory to store build logs
    
    76 80
             self.logdir = None
    
    77 81
     
    
    ... ... @@ -187,7 +191,7 @@ class Context():
    187 191
             _yaml.node_validate(defaults, [
    
    188 192
                 'sourcedir', 'builddir', 'artifactdir', 'logdir',
    
    189 193
                 'scheduler', 'artifacts', 'logging', 'projects',
    
    190
    -            'cache', 'prompt', 'workspacedir',
    
    194
    +            'cache', 'prompt', 'workspacedir', 'remote-execution'
    
    191 195
             ])
    
    192 196
     
    
    193 197
             for directory in ['sourcedir', 'builddir', 'artifactdir', 'logdir', 'workspacedir']:
    
    ... ... @@ -212,6 +216,8 @@ class Context():
    212 216
             # Load artifact share configuration
    
    213 217
             self.artifact_cache_specs = ArtifactCache.specs_from_config_node(defaults)
    
    214 218
     
    
    219
    +        self.remote_execution_specs = SandboxRemote.specs_from_config_node(defaults)
    
    220
    +
    
    215 221
             # Load pull build trees configuration
    
    216 222
             self.pull_buildtrees = _yaml.node_get(cache, bool, 'pull-buildtrees')
    
    217 223
     
    
    ... ... @@ -271,7 +277,8 @@ class Context():
    271 277
             # Shallow validation of overrides, parts of buildstream which rely
    
    272 278
             # on the overrides are expected to validate elsewhere.
    
    273 279
             for _, overrides in _yaml.node_items(self._project_overrides):
    
    274
    -            _yaml.node_validate(overrides, ['artifacts', 'options', 'strict', 'default-mirror'])
    
    280
    +            _yaml.node_validate(overrides, ['artifacts', 'options', 'strict', 'default-mirror',
    
    281
    +                                            'remote-execution'])
    
    275 282
     
    
    276 283
             profile_end(Topics.LOAD_CONTEXT, 'load')
    
    277 284
     
    

  • buildstream/_ostree.py
    ... ... @@ -34,7 +34,7 @@ from ._exceptions import BstError, ErrorDomain
    34 34
     
    
    35 35
     # pylint: disable=wrong-import-position,wrong-import-order
    
    36 36
     gi.require_version('OSTree', '1.0')
    
    37
    -from gi.repository import GLib, Gio, OSTree  # nopep8
    
    37
    +from gi.repository import GLib, Gio, OSTree  # noqa
    
    38 38
     
    
    39 39
     
    
    40 40
     # For users of this file, they must expect (except) it.
    

  • buildstream/_project.py
    ... ... @@ -507,7 +507,16 @@ class Project():
    507 507
             self.artifact_cache_specs = ArtifactCache.specs_from_config_node(config, self.directory)
    
    508 508
     
    
    509 509
             # Load remote-execution configuration for this project
    
    510
    -        self.remote_execution_specs = SandboxRemote.specs_from_config_node(config, self.directory)
    
    510
    +        project_specs = SandboxRemote.specs_from_config_node(config, self.directory)
    
    511
    +        override_specs = SandboxRemote.specs_from_config_node(
    
    512
    +            self._context.get_overrides(self.name), self.directory)
    
    513
    +
    
    514
    +        if override_specs is not None:
    
    515
    +            self.remote_execution_specs = override_specs
    
    516
    +        elif project_specs is not None:
    
    517
    +            self.remote_execution_specs = project_specs
    
    518
    +        else:
    
    519
    +            self.remote_execution_specs = self._context.remote_execution_specs
    
    511 520
     
    
    512 521
             # Load sandbox environment variables
    
    513 522
             self.base_environment = _yaml.node_get(config, Mapping, 'environment')
    

  • buildstream/_signals.py
    ... ... @@ -38,7 +38,7 @@ def terminator_handler(signal_, frame):
    38 38
             terminator_ = terminator_stack.pop()
    
    39 39
             try:
    
    40 40
                 terminator_()
    
    41
    -        except:                                                 # pylint: disable=bare-except
    
    41
    +        except:                               # noqa pylint: disable=bare-except
    
    42 42
                 # Ensure we print something if there's an exception raised when
    
    43 43
                 # processing the handlers. Note that the default exception
    
    44 44
                 # handler won't be called because we os._exit next, so we must
    

  • buildstream/element.py
    ... ... @@ -1568,7 +1568,7 @@ class Element(Plugin):
    1568 1568
                     utils._force_rmtree(rootdir)
    
    1569 1569
     
    
    1570 1570
                 with _signals.terminator(cleanup_rootdir), \
    
    1571
    -                self.__sandbox(rootdir, output_file, output_file, self.__sandbox_config) as sandbox:  # nopep8
    
    1571
    +                self.__sandbox(rootdir, output_file, output_file, self.__sandbox_config) as sandbox:  # noqa
    
    1572 1572
     
    
    1573 1573
                     # By default, the dynamic public data is the same as the static public data.
    
    1574 1574
                     # The plugin's assemble() method may modify this, though.
    

  • buildstream/sandbox/_sandboxremote.py
    ... ... @@ -41,7 +41,7 @@ from .._protos.google.longrunning import operations_pb2, operations_pb2_grpc
    41 41
     from .._artifactcache.cascache import CASRemote, CASRemoteSpec
    
    42 42
     
    
    43 43
     
    
    44
    -class RemoteExecutionSpec(namedtuple('RemoteExecutionSpec', 'exec_service storage_service action_service')):
    
    44
    +class RemoteExecutionSpec(namedtuple('RemoteExecutionSpec', 'exec_service storage_service action_service basedir')):
    
    45 45
         pass
    
    46 46
     
    
    47 47
     
    
    ... ... @@ -59,29 +59,59 @@ class SandboxRemote(Sandbox):
    59 59
             if config is None:
    
    60 60
                 return
    
    61 61
     
    
    62
    +        def resolve_path(path):
    
    63
    +            if config.basedir and path:
    
    64
    +                return os.path.join(config.basedir, path)
    
    65
    +            else:
    
    66
    +                return path
    
    67
    +
    
    62 68
             self.storage_url = config.storage_service['url']
    
    63 69
             self.exec_url = config.exec_service['url']
    
    64 70
     
    
    71
    +        exec_certs = {}
    
    72
    +        for key in ['client-cert', 'client-key', 'server-cert']:
    
    73
    +            if key in config.exec_service:
    
    74
    +                with open(resolve_path(config.exec_service[key]), 'rb') as f:
    
    75
    +                    exec_certs[key] = f.read()
    
    76
    +
    
    77
    +        self.exec_credentials = grpc.ssl_channel_credentials(
    
    78
    +            root_certificates=exec_certs.get('server-cert'),
    
    79
    +            private_key=exec_certs.get('client-key'),
    
    80
    +            certificate_chain=exec_certs.get('client-cert'))
    
    81
    +
    
    82
    +        action_certs = {}
    
    83
    +        for key in ['client-cert', 'client-key', 'server-cert']:
    
    84
    +            if key in config.action_service:
    
    85
    +                with open(resolve_path(config.exec_service[key]), 'rb') as f:
    
    86
    +                    action_certs[key] = f.read()
    
    87
    +
    
    65 88
             if config.action_service:
    
    66 89
                 self.action_url = config.action_service['url']
    
    90
    +            self.action_credentials = grpc.ssl_channel_credentials(
    
    91
    +                root_certificates=action_certs.get('server-cert'),
    
    92
    +                private_key=action_certs.get('client-key'),
    
    93
    +                certificate_chain=action_certs.get('client-cert'))
    
    67 94
             else:
    
    68 95
                 self.action_url = None
    
    96
    +            self.action_credentials = None
    
    69 97
     
    
    70 98
             self.server_instance = config.exec_service.get('instance', None)
    
    71 99
             self.storage_instance = config.storage_service.get('instance', None)
    
    72 100
     
    
    73
    -        self.storage_remote_spec = CASRemoteSpec(self.storage_url, push=True,
    
    74
    -                                                 server_cert=config.storage_service['server-cert'],
    
    75
    -                                                 client_key=config.storage_service['client-key'],
    
    76
    -                                                 client_cert=config.storage_service['client-cert'],
    
    77
    -                                                 instance_name=self.storage_instance)
    
    101
    +        self.storage_remote_spec = CASRemoteSpec(
    
    102
    +            self.storage_url, push=True,
    
    103
    +            server_cert=resolve_path(config.storage_service['server-cert']),
    
    104
    +            client_key=resolve_path(config.storage_service['client-key']),
    
    105
    +            client_cert=resolve_path(config.storage_service['client-cert']),
    
    106
    +            instance_name=self.storage_instance)
    
    107
    +
    
    78 108
             self.operation_name = None
    
    79 109
     
    
    80 110
         def info(self, msg):
    
    81 111
             self._get_context().message(Message(None, MessageType.INFO, msg))
    
    82 112
     
    
    83 113
         @staticmethod
    
    84
    -    def specs_from_config_node(config_node, basedir):
    
    114
    +    def specs_from_config_node(config_node, basedir=None):
    
    85 115
     
    
    86 116
             def require_node(config, keyname):
    
    87 117
                 val = config.get(keyname)
    
    ... ... @@ -109,7 +139,7 @@ class SandboxRemote(Sandbox):
    109 139
             remote_exec_storage_config = require_node(remote_config, 'storage-service')
    
    110 140
             remote_exec_action_config = remote_config.get('action-cache-service', {})
    
    111 141
     
    
    112
    -        _yaml.node_validate(remote_exec_service_config, ['url', 'instance'])
    
    142
    +        _yaml.node_validate(remote_exec_service_config, ['url', 'instance'] + tls_keys)
    
    113 143
             _yaml.node_validate(remote_exec_storage_config, ['url', 'instance'] + tls_keys)
    
    114 144
             if remote_exec_action_config:
    
    115 145
                 _yaml.node_validate(remote_exec_action_config, ['url'])
    
    ... ... @@ -137,7 +167,8 @@ class SandboxRemote(Sandbox):
    137 167
     
    
    138 168
             spec = RemoteExecutionSpec(remote_config['execution-service'],
    
    139 169
                                        remote_config['storage-service'],
    
    140
    -                                   remote_exec_action_config)
    
    170
    +                                   remote_exec_action_config,
    
    171
    +                                   basedir)
    
    141 172
             return spec
    
    142 173
     
    
    143 174
         def run_remote_command(self, channel, action_digest):
    
    ... ... @@ -295,6 +326,8 @@ class SandboxRemote(Sandbox):
    295 326
                                    "for example: http://buildservice:50051.")
    
    296 327
             if url.scheme == 'http':
    
    297 328
                 channel = grpc.insecure_channel('{}:{}'.format(url.hostname, url.port))
    
    329
    +        elif url.scheme == 'https':
    
    330
    +            channel = grpc.secure_channel('{}:{}'.format(url.hostname, url.port), self.exec_credentials)
    
    298 331
             else:
    
    299 332
                 raise SandboxError("Remote execution currently only supports the 'http' protocol "
    
    300 333
                                    "and '{}' was supplied.".format(url.scheme))
    
    ... ... @@ -352,11 +385,11 @@ class SandboxRemote(Sandbox):
    352 385
             if not url.port:
    
    353 386
                 raise SandboxError("You must supply a protocol and port number in the action-cache-service url, "
    
    354 387
                                    "for example: http://buildservice:50051.")
    
    355
    -        if not url.scheme == "http":
    
    356
    -            raise SandboxError("Currently only support http for the action cache"
    
    357
    -                               "and {} was supplied".format(url.scheme))
    
    388
    +        if url.scheme == 'http':
    
    389
    +            channel = grpc.insecure_channel('{}:{}'.format(url.hostname, url.port))
    
    390
    +        elif url.scheme == 'https':
    
    391
    +            channel = grpc.secure_channel('{}:{}'.format(url.hostname, url.port), self.action_credentials)
    
    358 392
     
    
    359
    -        channel = grpc.insecure_channel('{}:{}'.format(url.hostname, url.port))
    
    360 393
             request = remote_execution_pb2.GetActionResultRequest(action_digest=action_digest)
    
    361 394
             stub = remote_execution_pb2_grpc.ActionCacheStub(channel)
    
    362 395
             try:
    

  • dev-requirements.txt
    1 1
     coverage == 4.4.0
    
    2
    -pep8
    
    3 2
     pylint
    
    4 3
     pytest >= 3.9
    
    4
    +pytest-codestyle >= 1.4.0
    
    5 5
     pytest-cov >= 2.5.0
    
    6 6
     pytest-datafiles >= 2.0
    
    7 7
     pytest-env
    
    8
    -pytest-pep8
    
    9 8
     pytest-pylint
    
    10 9
     pytest-xdist
    
    11 10
     pytest-timeout
    

  • doc/Makefile
    ... ... @@ -6,10 +6,10 @@
    6 6
     # we dont use the standard `sphinx-build` and `sphinx-apidoc` entry points.
    
    7 7
     #
    
    8 8
     # The following technique works as long as sphinx is installed for python3,
    
    9
    -# regardless of the entry point which might be in /usr/bin or PATH, but
    
    10
    -# will stop working in sphinx >= 2.0. Hopefully by then, the mentioned
    
    11
    -# bug will be fixed and we can use a standard python3 specific script to
    
    12
    -# invoke sphnix.
    
    9
    +# regardless of the entry point which might be in /usr/bin or PATH.
    
    10
    +#
    
    11
    +# Since Sphinx 2.0 is planned to be Python 3-only, this workaround should not
    
    12
    +# be needed once Spinx 2.0 is released, and we upgrade to it
    
    13 13
     #
    
    14 14
     SPHINXOPTS    =
    
    15 15
     SPHINXBUILD   = python3 -m sphinx
    

  • doc/source/format_project.rst
    ... ... @@ -218,6 +218,7 @@ The use of ports are required to distinguish between pull only access and
    218 218
     push/pull access. For information regarding the server/client certificates
    
    219 219
     and keys, please see: :ref:`Key pair for the server <server_authentication>`.
    
    220 220
     
    
    221
    +.. _project_remote_execution:
    
    221 222
     
    
    222 223
     Remote execution
    
    223 224
     ~~~~~~~~~~~~~~~~
    
    ... ... @@ -243,9 +244,6 @@ using the `remote-execution` option:
    243 244
         action-cache-service:
    
    244 245
           url: http://bar.action.com:50052
    
    245 246
     
    
    246
    -The execution-service part of remote execution does not support encrypted
    
    247
    -connections yet, so the protocol must always be http.
    
    248
    -
    
    249 247
     storage-service specifies a remote CAS store and the parameters are the
    
    250 248
     same as those used to specify an :ref:`artifact server <artifacts>`.
    
    251 249
     
    
    ... ... @@ -268,6 +266,9 @@ instance names.
    268 266
     
    
    269 267
     The Remote Execution API can be found via https://github.com/bazelbuild/remote-apis.
    
    270 268
     
    
    269
    +Remote execution configuration can be also provided in the `user
    
    270
    +configuration <user_config_remote_execution>`.
    
    271
    +
    
    271 272
     .. _project_essentials_mirrors:
    
    272 273
     
    
    273 274
     Mirrors
    

  • doc/source/using_config.rst
    ... ... @@ -100,6 +100,54 @@ pull only access and push/pull access. For information regarding this and the
    100 100
     server/client certificates and keys, please see:
    
    101 101
     :ref:`Key pair for the server <server_authentication>`.
    
    102 102
     
    
    103
    +.. _user_config_remote_execution:
    
    104
    +
    
    105
    +Remote execution
    
    106
    +~~~~~~~~~~~~~~~~
    
    107
    +
    
    108
    +The same configuration for :ref:`remote execution <project_remote_execution>`
    
    109
    +in ``project.conf`` can be provided in the user configuation.
    
    110
    +
    
    111
    +There is only one remote execution configuration used per project.
    
    112
    +
    
    113
    +The project overrides will be taken in priority. The global
    
    114
    +configuration will be used as fallback.
    
    115
    +
    
    116
    +1. Global remote execution fallback:
    
    117
    +
    
    118
    +.. code:: yaml
    
    119
    +
    
    120
    +  remote-execution:
    
    121
    +    execution-service:
    
    122
    +      url: http://execution.fallback.example.com:50051
    
    123
    +      instance-name: main
    
    124
    +    storage-service:
    
    125
    +      url: https://storage.fallback.example.com:11002/
    
    126
    +      server-cert: /keys/server.crt
    
    127
    +      client-cert: /keys/client.crt
    
    128
    +      client-key: /keys/client.key
    
    129
    +      instance-name: main
    
    130
    +    action-cache-service:
    
    131
    +      url: http://action.flalback.example.com:50052
    
    132
    +
    
    133
    +2. Project override:
    
    134
    +
    
    135
    +.. code:: yaml
    
    136
    +
    
    137
    +  projects:
    
    138
    +    some_project:
    
    139
    +      remote-execution:
    
    140
    +        execution-service:
    
    141
    +          url: http://execution.some_project.example.com:50051
    
    142
    +          instance-name: main
    
    143
    +        storage-service:
    
    144
    +          url: https://storage.some_project.example.com:11002/
    
    145
    +          server-cert: /some_project_keys/server.crt
    
    146
    +          client-cert: /some_project_keys/client.crt
    
    147
    +          client-key: /some_project_keys/client.key
    
    148
    +          instance-name: main
    
    149
    +        action-cache-service:
    
    150
    +          url: http://action.some_project.example.com:50052
    
    103 151
     
    
    104 152
     
    
    105 153
     Strict build plan
    

  • setup.cfg
    ... ... @@ -11,20 +11,11 @@ parentdir_prefix = BuildStream-
    11 11
     test=pytest
    
    12 12
     
    
    13 13
     [tool:pytest]
    
    14
    -addopts = --verbose --basetemp ./tmp --pep8 --pylint --pylint-rcfile=.pylintrc --cov=buildstream --cov-config .coveragerc --durations=20
    
    14
    +addopts = --verbose --basetemp ./tmp --codestyle --pylint --pylint-rcfile=.pylintrc --cov=buildstream --cov-config .coveragerc --durations=20
    
    15 15
     norecursedirs = tests/integration/project integration-cache tmp __pycache__ .eggs
    
    16 16
     python_files = tests/*/*.py
    
    17
    -pep8maxlinelength = 119
    
    18
    -pep8ignore =
    
    19
    -    * E129
    
    20
    -    * E125
    
    21
    -    doc/source/conf.py ALL
    
    22
    -    tmp/* ALL
    
    23
    -    */lib/python3* ALL
    
    24
    -    */bin/* ALL
    
    25
    -    buildstream/_fuse/fuse.py ALL
    
    26
    -    .eggs/* ALL
    
    27
    -    *_pb2.py ALL
    
    28
    -    *_pb2_grpc.py ALL
    
    17
    +codestyle_max_line_length = 119
    
    18
    +codestyle_ignore = E129 E125 W504 W605
    
    19
    +codestyle_exclude = doc/source/conf.py buildstream/_fuse/fuse.py buildstream/_protos/**/*py
    
    29 20
     env =
    
    30 21
         D:BST_TEST_SUITE=True

  • tests/testutils/http_server.py
    ... ... @@ -29,7 +29,7 @@ class RequestHandler(SimpleHTTPRequestHandler):
    29 29
                     expected_password, directory = self.server.users[user]
    
    30 30
                     if password == expected_password:
    
    31 31
                         return directory
    
    32
    -            except:
    
    32
    +            except:                           # noqa
    
    33 33
                     raise Unauthorized('unauthorized')
    
    34 34
                 return None
    
    35 35
     
    



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