private async Task AppendQubeSetupToStartTask(
            RenderingEnvironment environment,
            string poolName,
            IEnumerable <string> additionalGroups,
            StartTask startTask,
            QubeConfig qubeConfig,
            InstallationPackage qubePackage,
            bool isWindows)
        {
            var commandLine   = startTask.CommandLine;
            var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles);

            var startTaskScriptUrl = isWindows
                ? GetWindowsStartTaskUrl(environment)
                : GetLinuxStartTaskUrl(environment);

            var uri      = new Uri(startTaskScriptUrl);
            var filename = uri.AbsolutePath.Split('/').Last();
            var installScriptResourceFile = new ResourceFile(httpUrl: startTaskScriptUrl, filePath: filename);

            resourceFiles.Add(installScriptResourceFile);

            var workerGroups = $"azure,{poolName}";

            if (additionalGroups != null && additionalGroups.Any())
            {
                workerGroups += $",{string.Join(',', additionalGroups)}";
            }

            commandLine += $".\\{installScriptResourceFile.FilePath} " +
                           $"-qubeSupervisorIp {qubeConfig.SupervisorIp} " +
                           $"-workerHostGroups '{workerGroups}'";

            if (qubePackage != null && !string.IsNullOrEmpty(qubePackage.Container))
            {
                resourceFiles.AddRange(await GetResourceFilesFromContainer(qubePackage.Container));

                // Add qb.conf if one isn't already specified by the package
                if (!resourceFiles.Any(rf => rf.FilePath.Contains("qb.conf")))
                {
                    var qbConfResourceFile = new ResourceFile(httpUrl: _configuration["Qube:QbConf"], filePath: "qb.conf");
                    resourceFiles.Add(qbConfResourceFile);
                }
            }
            else
            {
                // No package, lets just configure
                commandLine += " -skipInstall ";
            }

            commandLine += ";";

            startTask.CommandLine   = commandLine;
            startTask.ResourceFiles = resourceFiles;
        }
Пример #2
0
        private async Task AppendQubeParamsToStartTask(
            PoolConfigurationModel poolConfiguration,
            RenderingEnvironment environment,
            StartTask startTask,
            QubeConfig qubeConfig,
            InstallationPackage qubePackage,
            bool isWindows)
        {
            var commandLine   = startTask.CommandLine;
            var resourceFiles = new List <ResourceFile>(startTask.ResourceFiles);

            var workerGroups = $"azure,{poolConfiguration.PoolName}";

            if (poolConfiguration.AdditionalGroups != null && poolConfiguration.AdditionalGroups.Any())
            {
                workerGroups += $",{string.Join(',', poolConfiguration.AdditionalGroups)}";
            }

            commandLine += $"-qubeSupervisorIp {qubeConfig.SupervisorIp} " +
                           $"-workerHostGroups '{workerGroups}'";

            if (qubePackage != null && !string.IsNullOrEmpty(qubePackage.Container))
            {
                resourceFiles.AddRange(await GetResourceFilesFromContainer(qubePackage.Container));

                // Add qb.conf if one isn't already specified by the package
                if (!resourceFiles.Any(rf => rf.FilePath.Contains("qb.conf")))
                {
                    var qbConfResourceFile = new ResourceFile(httpUrl: _configuration["Qube:QbConf"], filePath: "qb.conf");
                    resourceFiles.Add(qbConfResourceFile);
                }
            }
            else
            {
                // No package, lets just configure
                commandLine += " -skipInstall ";
            }

            commandLine += ";";

            startTask.CommandLine   = commandLine;
            startTask.ResourceFiles = resourceFiles;
        }