Skip to content

Commit 5a37cfc

Browse files
Merge branch 'endgame-202401' into develop
2 parents 5377151 + edbda11 commit 5a37cfc

File tree

40 files changed

+620
-345
lines changed

40 files changed

+620
-345
lines changed

.azure-pipelines/sign-for-dev-release.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,16 @@ extends:
8080
inputs:
8181
targetType: inline
8282
script: |-
83-
CUSTOM_BRANCH=$(TOOLKIT_BRANCH)
84-
SOURCE_BRANCH=$(System.PullRequest.SourceBranch 2>/dev/null)
85-
TARGET_BRANCH=$(System.PullRequest.TargetBranch 2>/dev/null)
83+
TARGET_BRANCH=$(TOOLKIT_BRANCH)
8684
8785
ls ~/.m2/repository/com/microsoft/azure/azure-toolkit-*
8886
cd ..
8987
git clone https://github.com/microsoft/azure-maven-plugins.git
9088
cd azure-maven-plugins/azure-toolkit-libs
9189
92-
custom_existed_in_remote=$(git ls-remote --heads origin ${CUSTOM_BRANCH})
93-
source_existed_in_remote=$(git ls-remote --heads origin ${SOURCE_BRANCH})
94-
target_existed_in_remote=$(git ls-remote --heads origin ${TARGET_BRANCH})
95-
if [[ -n ${custom_existed_in_remote} ]]; then
96-
BRANCH=$CUSTOM_BRANCH
97-
elif [[ -n ${source_existed_in_remote} ]]; then
98-
BRANCH=$SOURCE_BRANCH
99-
elif [[ -n ${target_existed_in_remote} ]]; then
100-
BRANCH=$TARGET_BRANCH
101-
fi
102-
103-
echo "build azure-toolkit-libs: $BRANCH"
104-
git fetch origin $BRANCH
105-
git checkout $BRANCH
90+
echo "build azure-toolkit-libs: $TARGET_BRANCH"
91+
git fetch origin $TARGET_BRANCH
92+
git checkout $TARGET_BRANCH
10693
10794
git branch
10895
mvn clean install -T 4 -Dmaven.test.skip=true -Dmdep.analyze.skip=true -Dmaven.source.skip=true -Dmaven.javadoc.skip=true -Dcheckstyle.skip -B|| exit -1

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice-java/src/main/java/com/microsoft/azure/toolkit/intellij/appservice/AppServiceIntelliJActionsContributor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,7 @@
4040
import com.microsoft.azure.toolkit.lib.appservice.function.FunctionApp;
4141
import com.microsoft.azure.toolkit.lib.appservice.function.FunctionAppBase;
4242
import com.microsoft.azure.toolkit.lib.appservice.function.FunctionAppDeploymentSlot;
43-
import com.microsoft.azure.toolkit.lib.appservice.model.AppServiceFile;
44-
import com.microsoft.azure.toolkit.lib.appservice.model.FunctionAppDockerRuntime;
45-
import com.microsoft.azure.toolkit.lib.appservice.model.PricingTier;
43+
import com.microsoft.azure.toolkit.lib.appservice.model.*;
4644
import com.microsoft.azure.toolkit.lib.appservice.model.Runtime;
4745
import com.microsoft.azure.toolkit.lib.appservice.webapp.AzureWebApp;
4846
import com.microsoft.azure.toolkit.lib.appservice.webapp.WebApp;
@@ -249,6 +247,7 @@ public static AppServiceConfig getDefaultWebAppConfig(@Nullable final ResourceGr
249247
final AppServiceConfig result = AppServiceConfig.buildDefaultWebAppConfig(rgName, appName, "jar");
250248
result.appSettings(new HashMap<>());
251249
result.pricingTier(PricingTier.BASIC_B2);
250+
result.diagnosticConfig(DiagnosticConfig.builder().build());
252251
Optional.ofNullable(subscription).map(Subscription::getId).ifPresent(result::subscriptionId);
253252
Optional.ofNullable(group).map(ResourceGroup::getRegion).ifPresent(result::region);
254253
return result;

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice-java/src/main/java/com/microsoft/azure/toolkit/intellij/appservice/task/CreateFunctionAppTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.microsoft.azure.toolkit.ide.guidance.ComponentContext;
44
import com.microsoft.azure.toolkit.ide.guidance.Task;
55
import com.microsoft.azure.toolkit.ide.guidance.task.SignInTask;
6+
import com.microsoft.azure.toolkit.intellij.appservice.AppServiceIntelliJActionsContributor;
67
import com.microsoft.azure.toolkit.lib.Azure;
78
import com.microsoft.azure.toolkit.lib.appservice.config.FunctionAppConfig;
89
import com.microsoft.azure.toolkit.lib.appservice.config.RuntimeConfig;
@@ -42,10 +43,9 @@ public void execute() throws Exception {
4243
.map(id -> Azure.az(AzureAccount.class).account().getSubscription(id))
4344
.orElseThrow(() -> new AzureToolkitRuntimeException("Failed to get subscription to create function app"));
4445

45-
final FunctionAppConfig functionAppConfig = FunctionAppConfig.buildDefaultFunctionConfig("rg-" + name, name);
46+
final FunctionAppConfig functionAppConfig = AppServiceIntelliJActionsContributor.getDefaultFunctionAppConfig(null);
4647
functionAppConfig.appName(name);
4748
functionAppConfig.subscriptionId(subscription.getId());
48-
functionAppConfig.setRuntime(RuntimeConfig.fromRuntime(FunctionAppRuntime.getDefault()));
4949

5050
final FunctionAppBase<?, ?, ?> app = new CreateOrUpdateFunctionAppTask(functionAppConfig).execute();
5151
context.applyResult(FUNCTION_ID, app.getId());

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice-java/src/main/java/com/microsoft/azure/toolkit/intellij/appservice/task/DeployFunctionAppTask.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package com.microsoft.azure.toolkit.intellij.appservice.task;
77

8+
import com.azure.resourcemanager.resources.fluentcore.arm.ResourceId;
89
import com.intellij.execution.RunManagerEx;
910
import com.intellij.execution.RunnerAndConfigurationSettings;
1011
import com.intellij.execution.configurations.ConfigurationFactory;
@@ -23,6 +24,7 @@
2324
import com.microsoft.azure.toolkit.lib.common.utils.Utils;
2425

2526
import javax.annotation.Nonnull;
27+
import java.util.Objects;
2628

2729
public class DeployFunctionAppTask extends BaseDeployTask {
2830
private final AzureFunctionSupportConfigurationType functionType = AzureFunctionSupportConfigurationType.getInstance();
@@ -41,8 +43,9 @@ protected RunnerAndConfigurationSettings getRunConfigurationSettings(@Nonnull Co
4143
if (runConfiguration instanceof FunctionDeployConfiguration) {
4244
final Module[] functionModules = FunctionUtils.listFunctionModules(project);
4345
((FunctionDeployConfiguration) runConfiguration).saveTargetModule(functionModules[0]);
44-
final FunctionApp functionApp = Azure.az(AzureFunctions.class).functionApp(appId);
45-
((FunctionDeployConfiguration) runConfiguration).saveConfig(AppServiceConfigUtils.fromFunctionApp(functionApp, functionApp.getAppServicePlan()));
46+
final FunctionApp functionApp = Objects.requireNonNull(Azure.az(AzureFunctions.class).functionApp(appId),
47+
String.format("Can not find target app %s, please check whether app is created successfully", ResourceId.fromString(appId).name()));
48+
((FunctionDeployConfiguration) runConfiguration).saveConfig(AppServiceConfigUtils.fromFunctionApp(functionApp));
4649
}
4750
return settings;
4851
}

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice-java/src/main/java/com/microsoft/azure/toolkit/intellij/legacy/appservice/AppServiceInfoAdvancedPanel.java

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.intellij.util.ui.JBUI;
1414
import com.microsoft.azure.toolkit.ide.appservice.webapp.model.WebAppConfig;
1515
import com.microsoft.azure.toolkit.intellij.appservice.DockerUtils;
16+
import com.microsoft.azure.toolkit.intellij.common.AzureArtifact;
1617
import com.microsoft.azure.toolkit.intellij.common.AzureArtifactComboBox;
1718
import com.microsoft.azure.toolkit.intellij.common.AzureFormPanel;
1819
import com.microsoft.azure.toolkit.intellij.common.component.RegionComboBox;
@@ -24,7 +25,6 @@
2425
import com.microsoft.azure.toolkit.lib.Azure;
2526
import com.microsoft.azure.toolkit.lib.appservice.config.AppServiceConfig;
2627
import com.microsoft.azure.toolkit.lib.appservice.config.AppServicePlanConfig;
27-
import com.microsoft.azure.toolkit.lib.appservice.config.FunctionAppConfig;
2828
import com.microsoft.azure.toolkit.lib.appservice.config.RuntimeConfig;
2929
import com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem;
3030
import com.microsoft.azure.toolkit.lib.appservice.model.PricingTier;
@@ -44,6 +44,7 @@
4444

4545
import javax.swing.*;
4646
import java.awt.event.ItemEvent;
47+
import java.io.File;
4748
import java.text.SimpleDateFormat;
4849
import java.util.*;
4950
import java.util.function.Supplier;
@@ -101,18 +102,21 @@ public T getValue() {
101102
Optional.ofNullable(selectorRuntime.getValue()).map(RuntimeConfig::fromRuntime).ifPresent(result::runtime);
102103
Optional.ofNullable(selectorServicePlan.getValue()).map(AppServicePlan::getName).ifPresent(result::servicePlanName);
103104
Optional.ofNullable(selectorServicePlan.getValue()).map(AppServicePlan::getPricingTier).ifPresent(result::pricingTier);
104-
Optional.ofNullable(selectorServicePlan.getValue()).map(AppServicePlan::getResourceGroup)
105-
.map(ResourceGroup::getResourceGroupName).ifPresentOrElse(result::servicePlanResourceGroup, () -> result.servicePlanResourceGroup(result.resourceGroup()));
105+
Optional.ofNullable(selectorServicePlan.getValue())
106+
.map(plan -> plan.isDraftForCreating() ? result.getResourceGroup() : plan.getResourceGroupName())
107+
.ifPresent(result::servicePlanResourceGroup);
106108
final Boolean isDocker = Optional.ofNullable(selectorRuntime.getValue()).map(Runtime::isDocker).orElse(false);
107109
if (isDocker) {
108110
final ContainerAppDraft.ImageConfig image = chkUseQuickStart.isSelected() ? QUICK_START_IMAGE : pnlContainer.getValue();
109111
Optional.ofNullable(image).map(DockerUtils::convertImageConfigToRuntimeConfig).ifPresent(config::runtime);
110112
}
111-
// if (Objects.nonNull(artifact)) {
112-
// final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
113-
// final String path = artifact.getFileForDeployment();
114-
// config.setApplication(Paths.get(path));
115-
// }
113+
114+
if (deploymentTitle.isVisible()) {
115+
Optional.ofNullable(selectorApplication.getValue()).map(AzureArtifact::getFileForDeployment)
116+
.map(File::new)
117+
.filter(File::exists)
118+
.ifPresent(result::file);
119+
}
116120
this.config = result;
117121
return result;
118122
}
@@ -131,8 +135,12 @@ public void setValue(final T config) {
131135
Optional.ofNullable(AppServiceConfig.getResourceGroup(config)).ifPresent(this.selectorGroup::setValue);
132136
Optional.ofNullable(AppServiceConfig.getServicePlanConfig(config)).map(AppServicePlanConfig::getAppServicePlan).ifPresent(this.selectorServicePlan::setValue);
133137
Optional.ofNullable(config.runtime())
134-
.map(c -> config instanceof FunctionAppConfig ? RuntimeConfig.toFunctionAppRuntime(c) : RuntimeConfig.toWebAppRuntime(c))
138+
.map(RuntimeConfig::toWebAppRuntime)
135139
.ifPresent(this.selectorRuntime::setValue);
140+
Optional.ofNullable(config.file())
141+
.filter(File::exists)
142+
.map(f -> AzureArtifact.createFromFile(f.getPath(), project))
143+
.ifPresent(selectorApplication::setValue);
136144
final ContainerAppDraft.ImageConfig imageConfig = DockerUtils.convertRuntimeConfigToImageConfig(config.getRuntime());
137145
final boolean useDefaultImage = Objects.isNull(imageConfig) || StringUtils.equalsIgnoreCase(QUICK_START_IMAGE.getFullImageName(), imageConfig.getFullImageName());
138146
chkUseQuickStart.setSelected(useDefaultImage);
@@ -232,6 +240,9 @@ private void onRuntimeChanged(final ItemEvent e) {
232240
final boolean isDocker = Optional.ofNullable(runtime).map(Runtime::isDocker).orElse(false);
233241
this.imageTitle.setVisible(isDocker);
234242
this.pnlImage.setVisible(isDocker);
243+
this.deploymentTitle.setVisible(!isDocker);
244+
this.lblArtifact.setVisible(!isDocker);
245+
this.selectorApplication.setVisible(!isDocker);
235246
}
236247
}
237248

@@ -274,8 +285,6 @@ private void createUIComponents() {
274285

275286
public void setFixedRuntime(final Runtime runtime) {
276287
selectorRuntime.setPlatformList(Collections.singletonList(runtime));
277-
lblPlatform.setVisible(false);
278-
selectorRuntime.setEditable(false);
279288
}
280289

281290
private void toggleImageType(final boolean useQuickStart){

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice-java/src/main/java/com/microsoft/azure/toolkit/intellij/legacy/appservice/AppServiceInfoBasicPanel.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,5 @@ public void setDeploymentVisible(boolean visible) {
140140

141141
public void setFixedRuntime(final Runtime runtime) {
142142
selectorRuntime.setPlatformList(Collections.singletonList(runtime));
143-
lblPlatform.setVisible(false);
144-
selectorRuntime.setEditable(false);
145143
}
146144
}

0 commit comments

Comments
 (0)