Skip to content

Commit

Permalink
Merge pull request #1726 from microsoft/endgame-august
Browse files Browse the repository at this point in the history
merge release branch into master
  • Loading branch information
shenqianjin authored Aug 26, 2021
2 parents dc9a604 + 6fd6e69 commit 7ca4584
Show file tree
Hide file tree
Showing 112 changed files with 2,392 additions and 1,210 deletions.
16 changes: 16 additions & 0 deletions azure-functions-maven-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log
All notable changes to the "Maven Plugin for Azure Function" will be documented in this file.
- [Change Log](#change-log)
- [1.13.0](#1130)
- [1.12.0](#1120)
- [1.11.0](#1110)
- [1.10.0](#1100)
- [1.9.0](#190)
- [1.8.0](#180)
Expand All @@ -19,6 +22,19 @@ All notable changes to the "Maven Plugin for Azure Function" will be documented
- [1.2.1](#121)
- [1.2.0](#120)

## 1.13.0
- Support skip function extensions installation [#1616](https://github.com/microsoft/azure-maven-plugins/issues/1616) (Thanks @sschmeck)

## 1.12.0
- Support mutltiple tenants in authentication
- Fix oauth login issue: cannot select account
- Migrate to Track2 Azure SDK for Azure Functions service

## 1.11.0
- Deprecate azure-auth-helper and use azure identity for authentication
- Start Function App after deployment
- Fix possible deadlock during `azure-functions:run` [#1383](https://github.com/microsoft/azure-maven-plugins/issues/1383) (Thanks @glqdlt)

## 1.10.0
- Support function execution retry on invocation failures with @Retry annotation [PR#1203](https://github.com/microsoft/azure-maven-plugins/pull/1203)
- Add support for Proxy [PR#1240](https://github.com/microsoft/azure-maven-plugins/pull/1240)
Expand Down
4 changes: 2 additions & 2 deletions azure-functions-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-maven-plugins</artifactId>
<version>1.13.0</version>
<version>1.14.0-SNAPSHOT</version>
</parent>

<artifactId>azure-functions-maven-plugin</artifactId>
<version>1.13.0</version>
<version>1.14.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Maven Plugin for Azure Functions</name>
<description>Maven Plugin for Azure Functions</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Properties;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -339,8 +340,14 @@ protected IFunctionApp updateFunctionApp(final IFunctionApp functionApp) throws
az.appServicePlan(getServicePlanResourceGroup(), appServicePlanName);
if (!targetServicePlan.exists()) {
targetServicePlan = getOrCreateAppServicePlan();
} else if (StringUtils.isNotEmpty(pricingTier)) {
targetServicePlan.update().withPricingTier(getParsedPricingTier()).commit();
} else {
if (region != null && !Objects.equals(Region.fromName(region), Region.fromName(targetServicePlan.entity().getRegion()))) {
AzureMessager.getMessager().warning(String.format("Skip region update for existing service plan '%s' since it is not allowed.",
targetServicePlan.name()));
}
if (StringUtils.isNotEmpty(pricingTier)) {
targetServicePlan.update().withPricingTier(getParsedPricingTier()).commit();
}
}
// update app settings
final Map<String, String> appSettings = getAppSettings();
Expand Down
2 changes: 1 addition & 1 deletion azure-maven-plugin-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-maven-plugins</artifactId>
<version>1.13.0</version>
<version>1.14.0-SNAPSHOT</version>
</parent>

<artifactId>azure-maven-plugin-lib</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.microsoft.azure.maven.model.SubscriptionOption;
import com.microsoft.azure.maven.utils.CustomTextIoStringListReader;
import com.microsoft.azure.maven.utils.MavenAuthUtils;
import com.microsoft.azure.maven.utils.ProxyUtils;
import com.microsoft.azure.maven.utils.SystemPropertyUtils;
import com.microsoft.azure.toolkit.lib.Azure;
import com.microsoft.azure.toolkit.lib.auth.Account;
Expand All @@ -32,6 +31,7 @@
import com.microsoft.azure.toolkit.lib.common.logging.Log;
import com.microsoft.azure.toolkit.lib.common.messager.AzureMessager;
import com.microsoft.azure.toolkit.lib.common.model.Subscription;
import com.microsoft.azure.toolkit.lib.common.proxy.ProxyInfo;
import com.microsoft.azure.toolkit.lib.common.proxy.ProxyManager;
import com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemeter;
import com.microsoft.azure.toolkit.lib.common.telemetry.AzureTelemetryClient;
Expand All @@ -44,13 +44,15 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.crypto.SettingsDecrypter;
import org.apache.maven.shared.filtering.MavenResourcesFiltering;
Expand Down Expand Up @@ -475,9 +477,10 @@ public void execute() throws MojoExecutionException {
Azure.az().config().setLogLevel(HttpLogDetailLevel.NONE.name());
Azure.az().config().setUserAgent(getUserAgent());
// init proxy manager
ProxyUtils.initProxy(Optional.ofNullable(this.session).map(MavenSession::getRequest).orElse(null));
initMavenSettingsProxy(Optional.ofNullable(this.session).map(MavenSession::getRequest).orElse(null));
ProxyManager.getInstance().applyProxy();
initTelemetryProxy();
telemetryProxy.addDefaultProperty(PROXY, String.valueOf(ProxyManager.getInstance().getProxy() != null));
telemetryProxy.addDefaultProperty(PROXY, String.valueOf(ProxyManager.getInstance().isProxyEnabled()));
// Work around for Application Insights Java SDK:
// Sometimes, NoClassDefFoundError will be thrown even after Maven build is completed successfully.
// An issue has been filed at https://github.com/Microsoft/ApplicationInsights-Java/issues/416
Expand Down Expand Up @@ -517,6 +520,26 @@ public void execute() throws MojoExecutionException {
}
}

private static void initMavenSettingsProxy(MavenExecutionRequest request) {
if (request != null) {
final List<Proxy> mavenProxies = request.getProxies();
if (CollectionUtils.isNotEmpty(mavenProxies)) {
final Proxy mavenProxy = mavenProxies.stream().filter(
proxy -> proxy.isActive() && proxy.getPort() > 0 && StringUtils.isNotBlank(proxy.getHost())).findFirst().orElse(null);
if (mavenProxy != null) {
final ProxyInfo mavenProxyInfo = ProxyInfo.builder()
.source("maven")
.host(mavenProxy.getHost())
.port(mavenProxy.getPort())
.username(mavenProxy.getUsername())
.password(mavenProxy.getPassword())
.build();
Azure.az().config().setProxyInfo(mavenProxyInfo);
}
}
}
}

/**
* Sub-class can override this method to decide whether skip execution.
*
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion azure-sfmesh-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-maven-plugins</artifactId>
<version>1.13.0</version>
<version>1.14.0-SNAPSHOT</version>
</parent>

<artifactId>azure-sfmesh-maven-plugin</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions azure-spring-cloud-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<modelVersion>4.0.0</modelVersion>

<artifactId>azure-spring-cloud-maven-plugin</artifactId>
<version>1.7.0</version>
<version>1.8.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-maven-plugins</artifactId>
<version>1.13.0</version>
<version>1.14.0-SNAPSHOT</version>
</parent>
<name>Azure Spring Cloud Maven Plugin</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected void initTelemetryProxy() {
telemetryProxy.addDefaultProperty(TELEMETRY_KEY_WITHIN_PARENT_POM, String.valueOf(project.getPackaging().equalsIgnoreCase("pom")));
telemetryProxy.addDefaultProperty(TELEMETRY_KEY_JAVA_VERSION, javaVersion);

telemetryProxy.addDefaultProperty(PROXY, String.valueOf(ProxyManager.getInstance().getProxy() != null));
telemetryProxy.addDefaultProperty(PROXY, String.valueOf(ProxyManager.getInstance().isProxyEnabled()));

// Todo update deploy mojo telemetries with real value
telemetryProxy.addDefaultProperty(TELEMETRY_KEY_AUTH_METHOD, TELEMETRY_VALUE_AUTH_POM_CONFIGURATION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import com.microsoft.azure.toolkit.lib.Azure;
import com.microsoft.azure.toolkit.lib.auth.AzureAccount;
import com.microsoft.azure.toolkit.lib.auth.exception.LoginFailureException;
import com.microsoft.azure.toolkit.lib.common.entity.IAzureEntityManager;
import com.microsoft.azure.toolkit.lib.common.entity.IAzureResource;
import com.microsoft.azure.toolkit.lib.common.exception.AzureExecutionException;
import com.microsoft.azure.toolkit.lib.common.exception.InvalidConfigurationException;
import com.microsoft.azure.toolkit.lib.common.model.Subscription;
Expand Down Expand Up @@ -322,7 +322,7 @@ private void selectAppCluster() throws IOException, InvalidConfigurationExceptio
}
final List<SpringCloudCluster> clusters = az.clusters();
this.wrapper.putCommonVariable("clusters", clusters);
final SpringCloudCluster targetAppCluster = this.wrapper.handleSelectOne("select-ASC", clusters, null, IAzureEntityManager::name);
final SpringCloudCluster targetAppCluster = this.wrapper.handleSelectOne("select-ASC", clusters, null, IAzureResource::name);
if (targetAppCluster != null) {
this.appSettings.setClusterName(targetAppCluster.name());
getLog().info(String.format("Using service: %s", TextUtils.blue(targetAppCluster.name())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>azure-toolkit-libs</artifactId>
<groupId>com.microsoft.azure</groupId>
<version>0.10.0</version>
<version>0.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
20 changes: 1 addition & 19 deletions azure-toolkit-libs/azure-toolkit-appservice-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>azure-toolkit-libs</artifactId>
<groupId>com.microsoft.azure</groupId>
<version>0.10.0</version>
<version>0.11.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -48,13 +48,6 @@
<artifactId>azure-toolkit-auth-lib</artifactId>
</dependency>


<!-- https://mvnrepository.com/artifact/com.microsoft.azure.applicationinsights.v2015_05_01/azure-mgmt-insights -->
<dependency>
<groupId>com.microsoft.azure.applicationinsights.v2015_05_01</groupId>
<artifactId>azure-mgmt-insights</artifactId>
<version>1.0.0-beta</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure.functions</groupId>
<artifactId>azure-functions-java-library</artifactId>
Expand Down Expand Up @@ -117,17 +110,6 @@
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
</dependency>
<dependency>
<groupId>com.github.java-json-tools</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.2.14</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-toolkit-resource-lib</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import com.microsoft.azure.toolkit.lib.appservice.model.DiagnosticConfig;
import com.microsoft.azure.toolkit.lib.appservice.model.PublishingProfile;
import com.microsoft.azure.toolkit.lib.appservice.model.Runtime;
import com.microsoft.azure.toolkit.lib.common.entity.IAzureEntityManager;
import com.microsoft.azure.toolkit.lib.common.entity.IAzureResource;
import reactor.core.publisher.Flux;

import java.io.InputStream;

public interface IAppService<T extends AppServiceBaseEntity> extends IFileClient, IProcessClient, IAzureEntityManager<T> {
public interface IAppService<T extends AppServiceBaseEntity> extends IFileClient, IProcessClient, IAzureResource<T> {
void start();

void stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import com.microsoft.azure.toolkit.lib.appservice.entity.AppServicePlanEntity;
import com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem;
import com.microsoft.azure.toolkit.lib.appservice.model.PricingTier;
import com.microsoft.azure.toolkit.lib.common.entity.IAzureEntityManager;
import com.microsoft.azure.toolkit.lib.common.entity.IAzureResource;
import com.microsoft.azure.toolkit.lib.common.model.Region;

import java.util.List;

public interface IAppServicePlan extends IAzureEntityManager<AppServicePlanEntity> {
public interface IAppServicePlan extends IAzureResource<AppServicePlanEntity> {
Creator create();

Updater update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,17 @@ public IAppServicePlan execute() {
.withOperatingSystem(config.os())
.commit();
AzureMessager.getMessager().info(String.format(CREATE_APP_SERVICE_PLAN_DONE, appServicePlan.name()));
} else if (config.pricingTier() != null) {
} else {
if (config.region() != null && !Objects.equals(config.region(), Region.fromName(appServicePlan.entity().getRegion()))) {
AzureMessager.getMessager().warning(String.format("Ignore region update for existing service plan '%s' because it is not allowed.",
AzureMessager.getMessager().warning(String.format("Skip region update for existing service plan '%s' since it is not allowed.",
appServicePlan.name()));
}
appServicePlan.update().withPricingTier(config.pricingTier()).commit();
if (config.pricingTier() != null) {
// apply pricing tier to service plan
appServicePlan.update().withPricingTier(config.pricingTier()).commit();
}
}

return appServicePlan;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public DeployWebAppTask(IWebApp webApp, List<WebAppArtifact> artifacts, boolean
}

@Override
@AzureOperation(name = "webapp.deploy", params = {"this.config.getAppName()"}, type = AzureOperation.Type.SERVICE)
@AzureOperation(name = "webapp.deploy", params = {"this.webApp.entity().getName()"}, type = AzureOperation.Type.SERVICE)
public IWebApp execute() {
if (webApp.getRuntime().isDocker()) {
AzureMessager.getMessager().info(AzureString.format(SKIP_DEPLOYMENT_FOR_DOCKER_APP_SERVICE, "https://" + webApp.hostName()));
Expand Down
Loading

0 comments on commit 7ca4584

Please sign in to comment.