private string ResolveWorkerRuntimeVersion(WorkerRuntime workerRuntime)
        {
            var framework        = GetEnvironmentVariableOrNull(OryxBuildConstants.OryxEnvVars.FrameworkSetting);
            var frameworkVersion = GetEnvironmentVariableOrNull(OryxBuildConstants.OryxEnvVars.FrameworkVersionSetting);

            // If either of them is not set we are not in a position to determine the version, and should let the caller
            // switch to default
            if (string.IsNullOrEmpty(framework) || string.IsNullOrEmpty(frameworkVersion))
            {
                return(FunctionAppSupportedWorkerRuntime.GetDefaultLanguageVersion(workerRuntime));
            }

            // If it's set to DOCKER, it could be a) a function app image b) a custom image
            // For custom image, there's no point doing a build, so we just default them (the parser won't work).
            // if it's indeed a function app image, we look for the right tag that tells us about the version.
            //
            // Or if it's set to a supported worker runtime that was inferred, we assume that the framework version
            // that is set is the correct version requested.
            if (framework.Equals("DOCKER", StringComparison.OrdinalIgnoreCase))
            {
                var parsedVersion = ParseRuntimeVersionFromImage(frameworkVersion);
                if (!string.IsNullOrEmpty(parsedVersion))
                {
                    return(parsedVersion);
                }
            }
            else if (framework.Equals(workerRuntime.ToString(), StringComparison.OrdinalIgnoreCase))
            {
                return(frameworkVersion);
            }

            return(FunctionAppSupportedWorkerRuntime.GetDefaultLanguageVersion(workerRuntime));
        }
Exemple #2
0
 private string ResolveWorkerRuntimeVersion(WorkerRuntime workerRuntime)
 {
     return(FunctionAppSupportedWorkerRuntime.GetDefaultLanguageVersion(workerRuntime));
 }