Add validation for runtime parse
This commit is contained in:
Родитель
8f57138e9f
Коммит
ea82bae12c
|
@ -135,6 +135,9 @@ public class DeployHandler {
|
|||
final String javaVersion = getJavaVersion();
|
||||
final Runtime runtime = os == OperatingSystem.DOCKER ? FunctionAppRuntime.DOCKER : os == OperatingSystem.WINDOWS ?
|
||||
FunctionAppWindowsRuntime.fromJavaVersionUserText(javaVersion) : FunctionAppLinuxRuntime.fromJavaVersionUserText(javaVersion);
|
||||
if (Objects.isNull(runtime) && StringUtils.isNotBlank(config.javaVersion())) {
|
||||
throw new AzureToolkitRuntimeException("invalid runtime configuration, please refer to https://aka.ms/maven_function_configuration#supported-runtime for valid values");
|
||||
}
|
||||
return new RuntimeConfig().runtime(runtime)
|
||||
.image(config.image()).registryUrl(config.registryUrl())
|
||||
.username(config.username()).password(config.password());
|
||||
|
|
|
@ -175,6 +175,9 @@ public class DeployTask extends DefaultTask {
|
|||
final Runtime runtime = os == OperatingSystem.DOCKER ? FunctionAppRuntime.DOCKER : os == OperatingSystem.WINDOWS ?
|
||||
WebAppWindowsRuntime.fromContainerAndJavaVersionUserText(webContainer, javaVersion) :
|
||||
WebAppLinuxRuntime.fromContainerAndJavaVersionUserText(webContainer, javaVersion);
|
||||
if (Objects.isNull(runtime) && (StringUtils.isNotBlank(config.webContainer()) || StringUtils.isNotBlank(config.javaVersion()))) {
|
||||
throw new AzureToolkitRuntimeException("invalid runtime configuration, please refer to https://aka.ms/maven_webapp_runtime for valid values");
|
||||
}
|
||||
return new RuntimeConfig()
|
||||
.runtime(runtime)
|
||||
.registryUrl(config.registryUrl())
|
||||
|
|
Загрузка…
Ссылка в новой задаче