Ejemplo n.º 1
0
        void ReadAdditionalVariablesFromFile(CalamariVariables variables)
        {
            var path = variables.Get(AdditionalVariablesPathVariable)
                       ?? variables.Get($"env:{AdditionalVariablesPathVariable}");

            string BuildExceptionMessage(string reason)
            => $"Could not read additional variables from JSON file at '{path}'. " +
            $"{reason} Make sure the file can be read or remove the " +
            $"'{AdditionalVariablesPathVariable}' environment variable. " +
            $"See inner exception for details.";

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            if (!fileSystem.FileExists(path))
            {
                throw new CommandException(BuildExceptionMessage("File does not exist."));
            }

            try
            {
                var readVars = new VariableDictionary(path);
                variables.Merge(readVars);
            }
            catch (Exception e)
            {
                throw new CommandException(BuildExceptionMessage("The file could not be read."), e);
            }
        }
Ejemplo n.º 2
0
        async Task AssertDeploySuccessAsync(TargetSite targetSite)
        {
            var imageName    = newVariables.Get(SpecialVariables.Action.Package.PackageId);
            var registryUrl  = newVariables.Get(SpecialVariables.Action.Package.Registry);
            var imageVersion = newVariables.Get(SpecialVariables.Action.Package.PackageVersion) ?? "latest";

            var config = await webMgmtClient.WebApps.GetConfigurationAsync(targetSite);

            Assert.AreEqual($@"DOCKER|{imageName}:{imageVersion}", config.LinuxFxVersion);

            var appSettings = await webMgmtClient.WebApps.ListApplicationSettingsAsync(targetSite);

            Assert.AreEqual("https://" + registryUrl, appSettings.Properties["DOCKER_REGISTRY_SERVER_URL"]);
        }