Commit bb20b6d7 authored by Jim MacArthur's avatar Jim MacArthur
Browse files

Add "remote-execution" configuration option.

This just adds one option, "remote-execution/url". Affects multiple files.
parent e8d7f098
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -446,6 +446,7 @@ class Loader():
                                   _yaml.node_get(node, list, Symbol.ENV_NOCACHE, default_value=[]),
                                   _yaml.node_get(node, Mapping, Symbol.PUBLIC, default_value={}),
                                   _yaml.node_get(node, Mapping, Symbol.SANDBOX, default_value={}),
                                   _yaml.node_get(node, Mapping, Symbol.REMOTE_EXECUTION, default_value={}),
                                   element_kind == 'junction')

        # Cache it now, make sure it's already there before recursing
+2 −1
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ class MetaElement():
    #    first_pass: The element is to be loaded with first pass configuration (junction)
    #
    def __init__(self, project, name, kind, provenance, sources, config,
                 variables, environment, env_nocache, public, sandbox,
                 variables, environment, env_nocache, public, sandbox, remote_execution,
                 first_pass):
        self.project = project
        self.name = name
@@ -52,6 +52,7 @@ class MetaElement():
        self.env_nocache = env_nocache
        self.public = public
        self.sandbox = sandbox
        self.remote_execution = remote_execution
        self.build_dependencies = []
        self.dependencies = []
        self.first_pass = first_pass
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ class Symbol():
    DIRECTORY = "directory"
    JUNCTION = "junction"
    SANDBOX = "sandbox"
    REMOTE_EXECUTION = "remote-execution"


# Dependency()
+5 −1
Original line number Diff line number Diff line
@@ -129,6 +129,7 @@ class Project():

        self.artifact_cache_specs = None
        self._sandbox = None
        self._remote_execution = None
        self._splits = None

        self._context.add_project(self)
@@ -460,7 +461,7 @@ class Project():
            'aliases', 'name',
            'artifacts', 'options',
            'fail-on-overlap', 'shell', 'fatal-warnings',
            'ref-storage', 'sandbox', 'mirrors'
            'ref-storage', 'sandbox', 'mirrors', 'remote-execution'
        ])

        #
@@ -478,6 +479,9 @@ class Project():
        # Load sandbox configuration
        self._sandbox = _yaml.node_get(config, Mapping, 'sandbox')

        # Load remote execution configuration
        self._remote_execution = _yaml.node_get(config, Mapping, 'remote-execution')

        # Load project split rules
        self._splits = _yaml.node_get(config, Mapping, 'split-rules')

+22 −0
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ from . import _site
from ._platform import Platform
from .plugin import CoreWarnings
from .sandbox._config import SandboxConfig
from .sandbox._sandboxremote import SandboxRemote

from .storage.directory import Directory
from .storage._filebaseddirectory import FileBasedDirectory
@@ -250,6 +251,9 @@ class Element(Plugin):
        # Extract Sandbox config
        self.__sandbox_config = self.__extract_sandbox_config(meta)

        # Extract remote execution URL
        self.__remote_execution_url = self.__extract_remote_execution_config(meta)

    def __lt__(self, other):
        return self.name < other.name

@@ -2289,6 +2293,24 @@ class Element(Plugin):
        return SandboxConfig(self.node_get_member(sandbox_config, int, 'build-uid'),
                             self.node_get_member(sandbox_config, int, 'build-gid'))

    def __extract_remote_execution_config(self, meta):
        project = self._get_project()
        project.ensure_fully_loaded()
        rexec_config = _yaml.node_chain_copy(project._remote_execution)

        # The default config is already composited with the project overrides
        rexec_defaults = _yaml.node_get(self.__defaults, Mapping, 'remote-execution', default_value={})
        rexec_defaults = _yaml.node_chain_copy(rexec_defaults)

        _yaml.composite(rexec_config, rexec_defaults)
        _yaml.composite(rexec_config, meta.remote_execution)
        _yaml.node_final_assertions(rexec_config)

        # Rexec config, unlike others, has fixed members so we should validate them
        _yaml.node_validate(rexec_config, ['url'])

        return self.node_get_member(rexec_config, str, 'url')

    # This makes a special exception for the split rules, which
    # elements may extend but whos defaults are defined in the project.
    #