use of com.google.cloud.tools.intellij.appengine.cloud.flexible.UserSpecifiedPathDeploymentSource in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineDeploymentConfiguration method checkFlexConfig.
/**
* Checks that this configuration is valid for a flex deployment, otherwise throws a {@link
* RuntimeConfigurationError}.
*
* @param deployable the {@link AppEngineDeployable deployment source} that was selected by the
* user to deploy
* @param project the {@link Project} that this configuration belongs to
* @throws RuntimeConfigurationError if this configuration is not valid for a flex deployment
*/
private void checkFlexConfig(AppEngineDeployable deployable, Project project) throws RuntimeConfigurationError {
check(!(deployable instanceof UserSpecifiedPathDeploymentSource) || (!StringUtil.isEmpty(userSpecifiedArtifactPath) && isJarOrWar(userSpecifiedArtifactPath)), "appengine.flex.config.user.specified.artifact.error");
check(StringUtils.isNotBlank(moduleName), "appengine.flex.config.select.module");
AppEngineFlexibleFacet facet = AppEngineFlexibleFacet.getFacetByModuleName(moduleName, project);
check(facet != null, "appengine.flex.config.select.module");
String appYamlPath = facet.getConfiguration().getAppYamlPath();
check(StringUtils.isNotBlank(appYamlPath), "appengine.flex.config.browse.app.yaml");
check(Files.exists(Paths.get(appYamlPath)), "appengine.deployment.config.appyaml.error");
try {
Optional<FlexibleRuntime> runtime = AppEngineProjectService.getInstance().getFlexibleRuntimeFromAppYaml(appYamlPath);
if (runtime.isPresent() && runtime.get().isCustom()) {
String dockerDirectory = facet.getConfiguration().getDockerDirectory();
check(StringUtils.isNotBlank(dockerDirectory), "appengine.flex.config.browse.docker.directory");
check(Files.exists(Paths.get(dockerDirectory, DOCKERFILE_NAME)), "appengine.deployment.config.dockerfile.error");
}
} catch (MalformedYamlFileException e) {
throw new RuntimeConfigurationError(GctBundle.message("appengine.appyaml.malformed"));
}
}
use of com.google.cloud.tools.intellij.appengine.cloud.flexible.UserSpecifiedPathDeploymentSource in project google-cloud-intellij by GoogleCloudPlatform.
the class AppEngineDeploymentConfiguration method checkCommonConfig.
private void checkCommonConfig(AppEngineDeployable deployable) throws RuntimeConfigurationError {
// do not check SDK if it supports dynamic install - the deployment runner will block itself
// until installation is done.
CloudSdkService cloudSdkService = CloudSdkService.getInstance();
SdkStatus sdkStatus = cloudSdkService.getStatus();
if (sdkStatus != SdkStatus.READY && !cloudSdkService.isInstallSupported()) {
Set<CloudSdkValidationResult> sdkValidationResult = CloudSdkValidator.getInstance().validateCloudSdk();
if (!sdkValidationResult.isEmpty()) {
CloudSdkValidationResult result = Iterables.getFirst(sdkValidationResult, null);
throw new RuntimeConfigurationError(GctBundle.message("appengine.flex.config.server.error", result.getMessage()));
}
}
check(deployable instanceof UserSpecifiedPathDeploymentSource || deployable.isValid(), "appengine.config.deployment.source.error");
check(StringUtils.isNotBlank(cloudProjectName), "appengine.flex.config.project.missing.message");
}
Aggregations