Skip to content

Commit

Permalink
Merge branch 'endgame-202303' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
wangmingliang-ms committed Apr 1, 2023
2 parents c89cb87 + 175b318 commit 42adc79
Show file tree
Hide file tree
Showing 44 changed files with 288 additions and 161 deletions.
2 changes: 2 additions & 0 deletions azure-appservice-maven-plugin-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-appservice-maven-plugin-lib</artifactId>
<version>1.29.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
Expand Down
1 change: 1 addition & 0 deletions azure-functions-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<version>1.29.0-SNAPSHOT</version>
</parent>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-functions-maven-plugin</artifactId>
<version>1.26.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
Expand Down
2 changes: 2 additions & 0 deletions azure-maven-plugin-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
<version>1.29.0-SNAPSHOT</version>
</parent>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-maven-plugin-lib</artifactId>
<version>1.29.0-SNAPSHOT</version>
<name>Azure Maven Plugin Library</name>
<description>Common library for Azure Maven Plugins</description>
<url>https://github.com/microsoft/azure-maven-plugins</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ public static void validateArtifactCompileVersion(final String runtimeJavaVersio
runtimeVersion = Utils.getJavaMajorVersion(runtimeJavaVersion);
artifactCompileVersion = Utils.getArtifactCompileVersion(artifact);
} catch (RuntimeException e) {
AzureMessager.getMessager().warning("Failed to get version of your artifact, skip artifact compatibility test");
AzureMessager.getMessager().info("Failed to get version of your artifact, skip artifact compatibility test");
return;
}
if (artifactCompileVersion <= runtimeVersion) {
Expand Down Expand Up @@ -679,7 +679,7 @@ protected <T> List<T> getValidRuntimes(final List<T> runtimes, final Function<T,
.sorted(Comparator.comparing(levelGetter))
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(result)) {
final String supportedRuntimes = runtimes.stream().map(Object::toString).collect(Collectors.joining(","));
final String supportedRuntimes = runtimes.stream().map(Object::toString).collect(Collectors.joining(", "));
AzureMessager.getMessager().warning(AzureString.format(COMPILE_LEVEL_NOT_SUPPORTED, compileLevel, supportedRuntimes));
return runtimes;
} else {
Expand Down
1 change: 1 addition & 0 deletions azure-sfmesh-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<version>1.29.0-SNAPSHOT</version>
</parent>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-sfmesh-maven-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
Expand Down
9 changes: 5 additions & 4 deletions azure-spring-apps-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>azure-spring-apps-maven-plugin</artifactId>
<version>1.17.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<parent>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-maven-plugins</artifactId>
<version>1.29.0-SNAPSHOT</version>
</parent>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-spring-apps-maven-plugin</artifactId>
<version>1.17.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Azure Spring Apps Maven Plugin</name>
<description>Maven Plugin for Azure Spring Apps</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@
import com.microsoft.azure.maven.prompt.DefaultPrompter;
import com.microsoft.azure.maven.prompt.IPrompter;
import com.microsoft.azure.maven.utils.MavenConfigUtils;
import com.microsoft.azure.toolkit.lib.Azure;
import com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException;
import com.microsoft.azure.toolkit.lib.common.model.IArtifact;
import com.microsoft.azure.toolkit.lib.common.operation.AzureOperation;
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
import com.microsoft.azure.toolkit.lib.common.utils.TextUtils;
import com.microsoft.azure.toolkit.lib.springcloud.AzureSpringCloud;
import com.microsoft.azure.toolkit.lib.springcloud.SpringCloudApp;
import com.microsoft.azure.toolkit.lib.springcloud.SpringCloudCluster;
import com.microsoft.azure.toolkit.lib.springcloud.SpringCloudDeployment;
import com.microsoft.azure.toolkit.lib.springcloud.Utils;
import com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudAppConfig;
Expand Down Expand Up @@ -85,7 +88,11 @@ protected void doExecute() throws Throwable {
.orElseThrow(() -> new AzureToolkitRuntimeException("No artifact is specified to deploy."));
final String javaVersion = Optional.ofNullable(deploymentConfig).map(SpringCloudDeploymentConfig::getJavaVersion)
.map(version -> StringUtils.removeStart(version, "Java_")).orElse(StringUtils.EMPTY);
validateArtifactCompileVersion(javaVersion, file, getFailsOnRuntimeValidationError());
final SpringCloudCluster springCloudCluster = Azure.az(AzureSpringCloud.class).clusters(appConfig.getSubscriptionId()).get(appConfig.getClusterName(), appConfig.getResourceGroup());
final boolean skipCompileVersionValidation = Optional.ofNullable(springCloudCluster).map(SpringCloudCluster::isEnterpriseTier).orElse(false);
if (!skipCompileVersionValidation) {
validateArtifactCompileVersion(javaVersion, file, getFailsOnRuntimeValidationError());
}
final DeploySpringCloudAppTask task = new DeploySpringCloudAppTask(appConfig, true, true);

final List<AzureTask<?>> tasks = task.getSubTasks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static String eval(String template, Map<String, Object> bindings) {
try {
return engine.createTemplate(template).make(bindings).toString();
} catch (MissingPropertyException e) {
log.log(Level.WARNING, String.format(MISSING_PROPERTY, template, bindings));
log.log(Level.FINE, String.format(MISSING_PROPERTY, template, bindings));
} catch (Exception e) {
log.log(Level.WARNING, String.format(INVALID_TEMPLATE, template, bindings), e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,6 @@ public <T> List<T> handleMultipleCase(String templateId, List<T> options, Functi
return options;
} else {
if (!this.prompt.promoteYesNo(TemplateUtils.evalText("promote.one", variables), defaultSelected, false)) {
// user cancels
final String warningMessage = TemplateUtils.evalText("message.select_none", variables);
if (StringUtils.isNotBlank(warningMessage)) {
log.warn(warningMessage);
}
return Collections.emptyList();
}
return options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ property: memoryInGB

---
id: configure-jvm-options
promote: "Input JVM options${(schema.default) ? '(***' ~ schema.default ~ '***)' : ''}:"
promote: "Input JVM options${(schema.default) ? \"(***' ~ schema.default ~ '***)\" : ''}:"
resource: Deployment
property: jvmOptions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-toolkit-applicationinsights-lib</artifactId>
<version>0.32.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
Expand Down
2 changes: 2 additions & 0 deletions azure-toolkit-libs/azure-toolkit-appservice-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-toolkit-appservice-lib</artifactId>
<version>0.32.0-SNAPSHOT</version>

<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.time.Duration;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -94,7 +95,7 @@ private void deployArtifacts() {
.collect(Collectors.toList());
artifactsOneDeploy.forEach(resource -> deploymentResultAtomicReference.set(webApp.pushDeploy(resource.getDeployType(), resource.getFile(),
DeployOptions.builder().path(resource.getPath()).restartSite(restartSite).trackDeployment(true).build())));
if (BooleanUtils.isTrue(waitDeploymentComplete) && !waitUntilDeploymentReady(this.deploymentStatusRefreshInterval, this.deploymentStatusMaxRefreshTimes)) {
if (!waitUntilDeploymentReady(this.deploymentStatusRefreshInterval, this.deploymentStatusMaxRefreshTimes)) {
startStreamingLog();
}
OperationContext.action().setTelemetryProperty("deploy-cost", String.valueOf(System.currentTimeMillis() - startTime));
Expand Down Expand Up @@ -133,15 +134,15 @@ public boolean waitUntilDeploymentReady(long deploymentStatusRefreshInterval, lo
}

private boolean isTrackDeploymentStatusSupported() {
if (webApp.getFormalStatus().isStopped()) {
if (BooleanUtils.isTrue(this.waitDeploymentComplete) && webApp.getFormalStatus().isStopped()) {
messager.info("Skip waiting deployment status for stopped web app.");
return false;
}
if (webApp.getRuntime().isWindows() && BooleanUtils.isTrue(this.waitDeploymentComplete)) {
if (BooleanUtils.isTrue(this.waitDeploymentComplete) && webApp.getRuntime().isWindows()) {
messager.warning("`waitDeploymentComplete` is not supported in Windows runtime, skip waiting for deployment status.");
return false;
}
return webApp.getRuntime().isLinux();
return Optional.ofNullable(this.waitDeploymentComplete).orElse(webApp.getRuntime().isLinux());
}

private CsmDeploymentStatus getDeploymentStatus(final WebAppBase<?, ?, ?> target, final KuduDeploymentResult result) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
]
},
"files": {
"function.java": "package $packageName$;\n\nimport com.microsoft.azure.functions.HttpMethod;\nimport com.microsoft.azure.functions.HttpRequestMessage;\nimport com.microsoft.azure.functions.HttpResponseMessage;\nimport com.microsoft.azure.functions.HttpStatus;\nimport com.microsoft.azure.functions.OutputBinding;\nimport com.microsoft.azure.functions.annotation.AuthorizationLevel;\nimport com.microsoft.azure.functions.annotation.FunctionName;\nimport com.microsoft.azure.functions.annotation.HttpTrigger;\nimport com.microsoft.azure.functions.sql.annotation.SQLOutput;\nimport com.fasterxml.jackson.core.JsonParseException;\nimport com.fasterxml.jackson.databind.JsonMappingException;\nimport com.fasterxml.jackson.databind.ObjectMapper;\n\nimport java.io.IOException;\nimport java.util.Optional;\n\npublic class $className$ {\n // Visit https://aka.ms/sqlbindingsoutput to learn how to use this output binding\n // The SQL bindings extension is part of a preview extension bundle, please use `Microsoft.Azure.Functions.ExtensionBundle.Preview` in host.json\n // Please add com.microsoft.azure.functions:azure-functions-java-library-sql and com.fasterxml.jackson.core:jackson-databind to your project dependencies\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage run(\n @HttpTrigger(\n name = \"req\",\n methods = {HttpMethod.POST},\n authLevel = AuthorizationLevel.FUNCTION,\n route = \"\")\n HttpRequestMessage<Optional<String>> request,\n @SQLOutput(\n name = \"output\",\n commandText = \"$table$\",\n connectionStringSetting = \"$SqlConnectionString$\")\n OutputBinding<TodoItem> output) throws JsonParseException, JsonMappingException, IOException {\n\n String json = request.getBody().get();\n ObjectMapper mapper = new ObjectMapper();\n TodoItem todoItem = mapper.readValue(json, TodoItem.class);\n output.setValue(todoItem);\n\n return request.createResponseBuilder(HttpStatus.OK).header(\"Content-Type\", \"application/json\").body(todoItem).build();\n }\n\n public static class TodoItem {\n public String Id;\n public int Priority;\n public String Description;\n\n public String getId() {\n return Id;\n }\n \n public void setId(String id) {\n Id = id;\n }\n \n public int getPriority() {\n return Priority;\n }\n \n public void setPriority(int priority) {\n Priority = priority;\n }\n \n public String getDescription() {\n return Description;\n }\n \n public void setDescription(String description) {\n Description = description;\n }\n }\n \n}"
"function.java": "package $packageName$;\n\nimport com.microsoft.azure.functions.HttpMethod;\nimport com.microsoft.azure.functions.HttpRequestMessage;\nimport com.microsoft.azure.functions.HttpResponseMessage;\nimport com.microsoft.azure.functions.HttpStatus;\nimport com.microsoft.azure.functions.OutputBinding;\nimport com.microsoft.azure.functions.annotation.AuthorizationLevel;\nimport com.microsoft.azure.functions.annotation.FunctionName;\nimport com.microsoft.azure.functions.annotation.HttpTrigger;\nimport com.microsoft.azure.functions.sql.annotation.SQLOutput;\nimport com.fasterxml.jackson.core.JsonParseException;\nimport com.fasterxml.jackson.databind.JsonMappingException;\nimport com.fasterxml.jackson.databind.ObjectMapper;\n\nimport java.io.IOException;\nimport java.util.Optional;\n\npublic class $className$ {\n /**\n * Visit Visit https://aka.ms/sqlbindingsoutput to learn how to use this output binding\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-sql and com.fasterxml.jackson.core:jackson-databind to your project dependencies\n * 2. Add an app setting named \"SqlConnectionString\" containing the connection string to use for the SQL connection\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the version to \"[4.*, 5.0.0)\"\n */\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage run(\n @HttpTrigger(\n name = \"req\",\n methods = {HttpMethod.POST},\n authLevel = AuthorizationLevel.FUNCTION,\n route = \"\")\n HttpRequestMessage<Optional<String>> request,\n @SQLOutput(\n name = \"output\",\n commandText = \"$table$\",\n connectionStringSetting = \"$SqlConnectionString$\")\n OutputBinding<TodoItem> output) throws JsonParseException, JsonMappingException, IOException {\n\n String json = request.getBody().get();\n ObjectMapper mapper = new ObjectMapper();\n TodoItem todoItem = mapper.readValue(json, TodoItem.class);\n output.setValue(todoItem);\n\n return request.createResponseBuilder(HttpStatus.OK).header(\"Content-Type\", \"application/json\").body(todoItem).build();\n }\n\n public static class TodoItem {\n public String Id;\n public int Priority;\n public String Description;\n\n public String getId() {\n return Id;\n }\n \n public void setId(String id) {\n Id = id;\n }\n \n public int getPriority() {\n return Priority;\n }\n \n public void setPriority(int priority) {\n Priority = priority;\n }\n \n public String getDescription() {\n return Description;\n }\n \n public void setDescription(String description) {\n Description = description;\n }\n }\n}"
}
},
{
Expand Down Expand Up @@ -449,7 +449,7 @@
]
},
"files": {
"function.java": "package $packageName$;\n\nimport com.microsoft.azure.functions.HttpMethod;\nimport com.microsoft.azure.functions.HttpRequestMessage;\nimport com.microsoft.azure.functions.HttpResponseMessage;\nimport com.microsoft.azure.functions.HttpStatus;\nimport com.microsoft.azure.functions.annotation.AuthorizationLevel;\nimport com.microsoft.azure.functions.annotation.FunctionName;\nimport com.microsoft.azure.functions.annotation.HttpTrigger;\nimport com.microsoft.azure.functions.sql.annotation.SQLInput;\n\nimport java.util.Optional;\n\npublic class $className$ {\n // Visit https://aka.ms/sqlbindingsinput to learn how to use this input binding\n // The SQL bindings extension is part of a preview extension bundle, please use `Microsoft.Azure.Functions.ExtensionBundle.Preview` in host.json\n // Please add com.microsoft.azure.functions:azure-functions-java-library-sql to your project dependencies\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage run(\n @HttpTrigger(\n name = \"req\",\n methods = {HttpMethod.GET},\n authLevel = AuthorizationLevel.FUNCTION,\n route = \"\")\n HttpRequestMessage<Optional<String>> request,\n @SQLInput(\n name = \"result\",\n commandText = \"SELECT * FROM $object$\",\n commandType = \"Text\",\n connectionStringSetting = \"$SqlConnectionString$\")\n Object[] result) {\n\n return request.createResponseBuilder(HttpStatus.OK).header(\"Content-Type\", \"application/json\").body(result).build();\n }\n}"
"function.java": "package $packageName$;\n\nimport com.microsoft.azure.functions.HttpMethod;\nimport com.microsoft.azure.functions.HttpRequestMessage;\nimport com.microsoft.azure.functions.HttpResponseMessage;\nimport com.microsoft.azure.functions.HttpStatus;\nimport com.microsoft.azure.functions.annotation.AuthorizationLevel;\nimport com.microsoft.azure.functions.annotation.FunctionName;\nimport com.microsoft.azure.functions.annotation.HttpTrigger;\nimport com.microsoft.azure.functions.sql.annotation.SQLInput;\n\nimport java.util.Optional;\n\npublic class $className$ {\n /**\n * Visit https://aka.ms/sqlbindingsinput to learn how to use this input binding\n * \n * These tasks should be completed prior to running:\n * 1. Add com.microsoft.azure.functions:azure-functions-java-library-sql to your project dependencies\n * 2. Add an app setting named \"SqlConnectionString\" containing the connection string to use for the SQL connection\n * 3. Change the bundle name in host.json to \"Microsoft.Azure.Functions.ExtensionBundle.Preview\" and the version to \"[4.*, 5.0.0)\"\n */\n @FunctionName(\"$functionName$\")\n public HttpResponseMessage run(\n @HttpTrigger(\n name = \"req\",\n methods = {HttpMethod.GET},\n authLevel = AuthorizationLevel.FUNCTION,\n route = \"\")\n HttpRequestMessage<Optional<String>> request,\n @SQLInput(\n name = \"result\",\n commandText = \"SELECT * FROM $object$\",\n commandType = \"Text\",\n connectionStringSetting = \"$SqlConnectionString$\")\n Object[] result) {\n\n return request.createResponseBuilder(HttpStatus.OK).header(\"Content-Type\", \"application/json\").body(result).build();\n }\n}"
}
}
]
Expand Down
2 changes: 2 additions & 0 deletions azure-toolkit-libs/azure-toolkit-auth-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-toolkit-auth-lib</artifactId>
<version>0.32.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
Expand Down
2 changes: 2 additions & 0 deletions azure-toolkit-libs/azure-toolkit-common-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>

<groupId>com.microsoft.azure</groupId>
<artifactId>azure-toolkit-common-lib</artifactId>
<version>0.32.0-SNAPSHOT</version>

<dependencies>
<dependency>
Expand Down
Loading

0 comments on commit 42adc79

Please sign in to comment.