use of com.microsoft.azure.gradle.configuration.GradleWebAppConfig in project azure-gradle-plugins by microsoft.
the class DeployTask method parseConfiguration.
private GradleWebAppConfig parseConfiguration() {
final AzureWebappPluginExtension ctx = this.azureWebappExtension;
GradleWebAppConfig config = new GradleWebAppConfig();
config.subscriptionId(ctx.getSubscription());
config.resourceGroup(ctx.getResourceGroup());
config.appName(ctx.getAppName());
config.pricingTier(ctx.getPricingTier());
config.region(ctx.getRegion());
config.runtime(ctx.getRuntime());
config.appSettings(ctx.getAppSettings());
config.servicePlanName(ctx.getAppServicePlanName());
config.servicePlanResourceGroup(ctx.getAppServicePlanResourceGroup());
config.deploymentSlotName(Optional.ofNullable(ctx.getDeploymentSlot()).map(GradleDeploymentSlotConfig::name).orElse(null));
config.deploymentSlotConfigurationSource(Optional.ofNullable(ctx.getDeploymentSlot()).map(GradleDeploymentSlotConfig::configurationSource).orElse(null));
if (StringUtils.isNotBlank(this.artifactFile)) {
File file = new File(this.artifactFile);
if (!file.exists()) {
throw new AzureToolkitRuntimeException(String.format("artifact file(%s) cannot be found.", file.getAbsolutePath()));
}
final WebAppArtifact webAppArtifact = WebAppArtifact.builder().deployType(Utils.getDeployTypeByFileExtension(file)).file(file).build();
config.webAppArtifacts(Collections.singletonList(webAppArtifact));
}
return config;
}
use of com.microsoft.azure.gradle.configuration.GradleWebAppConfig in project azure-gradle-plugins by microsoft.
the class DeployTask method deploy.
@TaskAction
@AzureOperation(name = "webapp.deploy_app", type = AzureOperation.Type.ACTION)
public void deploy() throws GradleException {
try {
ProxyManager.getInstance().applyProxy();
TelemetryAgent.getInstance().addDefaultProperty(PROXY, String.valueOf(ProxyManager.getInstance().isProxyEnabled()));
TelemetryAgent.getInstance().addDefaultProperties(azureWebappExtension.getTelemetryProperties());
initTask();
TelemetryAgent.getInstance().trackTaskStart(this.getClass());
final GradleWebAppConfig config = parseConfiguration();
normalizeConfigValue(config);
validate(config);
config.subscriptionId(GradleAuthHelper.login(azureWebappExtension.getAuth(), config.subscriptionId()));
validateOnline(config);
final WebAppBase<?, ?, ?> target = createOrUpdateWebapp(config);
deployArtifact(target, config);
TelemetryAgent.getInstance().trackTaskSuccess(this.getClass());
} catch (Exception e) {
AzureMessager.getMessager().error(e);
TelemetryAgent.getInstance().traceException(this.getClass(), e);
throw new GradleException("Cannot deploy web app due to error: " + e.getMessage(), e);
}
}
Aggregations