public override async Task StartAsync(CancellationToken cancellationToken)
        {
            _serverCfg.OnChange(CfgChanged);

            var options      = _serverCfg.CurrentValue;
            var instanceRoot = Path.Combine(Environment.CurrentDirectory, options.InstanceRoot);

            if (!Directory.Exists(instanceRoot))
            {
                Directory.CreateDirectory(instanceRoot);
                _logger.LogInformation("Created InstanceRoot {InstanceRoot}", instanceRoot);
            }

            // Init server instances.
            foreach (var(key, instanceOptions) in options.Instances)
            {
                _logger.LogDebug("Initializing instance {Name} ({Key})", instanceOptions.Name, key);

                var instance =
                    new ServerInstance(
                        key,
                        instanceOptions,
                        _configuration,
                        options,
                        _provider.GetRequiredService <ILogger <ServerInstance> >(),
                        _taskQueue,
                        _provider);

                _instances.Add(key, instance);
            }

            // This calls ExecuteAsync
            await base.StartAsync(cancellationToken);
        }
Example #2
0
        public override async Task StartAsync(CancellationToken cancellationToken)
        {
            // Init server instances.
            foreach (var(key, instanceOptions) in _serversOptions.Instances)
            {
                _logger.LogDebug("Initializing instance {Name} ({Key})", instanceOptions.Name, key);

                var instance =
                    new ServerInstance(key, instanceOptions, _configuration, _jenkinsLogger, _serversOptions,
                                       _serverInstanceLogger, _taskQueue, _localLogger);
                _instances.Add(key, instance);
            }

            // This calls ExecuteAsync
            await base.StartAsync(cancellationToken);
        }
Example #3
0
        public override async Task StartAsync(CancellationToken cancellationToken)
        {
            var instanceRoot = Path.Combine(Environment.CurrentDirectory, _serversOptions.InstanceRoot);

            if (!Directory.Exists(instanceRoot))
            {
                Directory.CreateDirectory(instanceRoot);
                _logger.LogInformation($"Created InstanceRoot {instanceRoot}");
            }

            // Init server instances.
            foreach (var(key, instanceOptions) in _serversOptions.Instances)
            {
                _logger.LogDebug("Initializing instance {Name} ({Key})", instanceOptions.Name, key);

                var instance =
                    new ServerInstance(key, instanceOptions, _configuration, _jenkinsLogger, _serversOptions,
                                       _serverInstanceLogger, _taskQueue, _localLogger, _gitLogger);
                _instances.Add(key, instance);
            }

            // This calls ExecuteAsync
            await base.StartAsync(cancellationToken);
        }