diff --git a/pom.xml b/pom.xml index 907c2927..6d135499 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ jenkinsci/azure-vm-agents-plugin 2.387.3 true - 846 + 883 diff --git a/src/main/java/com/microsoft/azure/vmagent/AzureVMCloud.java b/src/main/java/com/microsoft/azure/vmagent/AzureVMCloud.java index 9608ff10..27ec9ff4 100644 --- a/src/main/java/com/microsoft/azure/vmagent/AzureVMCloud.java +++ b/src/main/java/com/microsoft/azure/vmagent/AzureVMCloud.java @@ -135,7 +135,7 @@ public class AzureVMCloud extends Cloud { @DataBoundConstructor public AzureVMCloud( - String cloudName, + String name, String azureCredentialsId, String maxVirtualMachinesLimit, String deploymentTimeout, @@ -145,7 +145,7 @@ public AzureVMCloud( List vmTemplates) { super( getOrGenerateCloudName( - cloudName, + name, azureCredentialsId, getResourceGroupName( resourceGroupReferenceType, @@ -268,10 +268,10 @@ public String getCloudName() { return this.name; } - public static String getOrGenerateCloudName(String cloudName, String credentialId, String resourceGroupName) { - return StringUtils.isBlank(cloudName) + public static String getOrGenerateCloudName(String name, String credentialId, String resourceGroupName) { + return StringUtils.isBlank(name) ? AzureUtil.getCloudName(credentialId, resourceGroupName) - : cloudName; + : name; } public String getNewResourceGroupName() { diff --git a/src/main/resources/com/microsoft/azure/vmagent/AzureVMCloud/config.jelly b/src/main/resources/com/microsoft/azure/vmagent/AzureVMCloud/config.jelly index 909dcad8..009ef89d 100644 --- a/src/main/resources/com/microsoft/azure/vmagent/AzureVMCloud/config.jelly +++ b/src/main/resources/com/microsoft/azure/vmagent/AzureVMCloud/config.jelly @@ -4,7 +4,7 @@ ${%Azure_VM_Agent_Log_Link} - diff --git a/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/advanced.yaml b/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/advanced.yaml index a4b09676..686ca6f7 100644 --- a/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/advanced.yaml +++ b/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/advanced.yaml @@ -2,7 +2,7 @@ jenkins: clouds: - azureVM: azureCredentialsId: "azure-cred" - cloudName: "azure" + name: "azure" cloudTags: - name: "author" value: "gavin" diff --git a/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/basic.yaml b/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/basic.yaml index ae1f22a7..3871e680 100644 --- a/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/basic.yaml +++ b/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/basic.yaml @@ -2,7 +2,7 @@ jenkins: clouds: - azureVM: azureCredentialsId: "azure-cred" - cloudName: "azure" + name: "azure" deploymentTimeout: 1200 maxVirtualMachinesLimit: 10 newResourceGroupName: "vm-agent" diff --git a/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/expectedAdvanced.yaml b/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/expectedAdvanced.yaml index 980f0552..e4644fea 100644 --- a/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/expectedAdvanced.yaml +++ b/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/expectedAdvanced.yaml @@ -1,12 +1,12 @@ - azureVM: azureCredentialsId: "azure-cred" - cloudName: "azure" cloudTags: - name: "author" value: "gavin" deploymentTimeout: 1200 existingResourceGroupName: "vm-agents" maxVirtualMachinesLimit: 10 + name: "azure" resourceGroupReferenceType: "existing" vmTemplates: - agentWorkspace: "/opt/jenkins" diff --git a/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/expectedBasic.yaml b/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/expectedBasic.yaml index 15709253..2b8157fc 100644 --- a/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/expectedBasic.yaml +++ b/src/test/resources/com/microsoft/azure/vmagent/test/jcasc/expectedBasic.yaml @@ -1,8 +1,8 @@ - azureVM: azureCredentialsId: "azure-cred" - cloudName: "azure" deploymentTimeout: 1200 maxVirtualMachinesLimit: 10 + name: "azure" newResourceGroupName: "vm-agent" resourceGroupReferenceType: "new" vmTemplates: