Skip to content

Commit

Permalink
Supply purchase plan for gallery images (#452)
Browse files Browse the repository at this point in the history
Co-authored-by: Magnus Lundin <magnusl@thermocalc.se>
  • Loading branch information
smirgel and Magnus Lundin committed Sep 3, 2023
1 parent 571c13a commit bb06c11
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,27 @@ public AzureVMDeploymentInfo createDeployment(
imageId = galleryImageVersion.id();
LOGGER.log(Level.INFO, "Create VM with gallery image id {0}", new Object[]{imageId});
putVariableIfNotBlank(tmp, "imageId", imageId);

Map<String, String> imageTags = galleryImageVersion.tags();

Check warning on line 537 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 537 is not covered by tests
if (imageTags != null) {

Check warning on line 538 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 538 is only partially covered, 2 branches are missing
String planInfo = imageTags.get("PlanInfo");

Check warning on line 539 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 539 is not covered by tests
String planProduct = imageTags.get("PlanProduct");

Check warning on line 540 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 540 is not covered by tests
String planPublisher = imageTags.get("PlanPublisher");

Check warning on line 541 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 541 is not covered by tests

if (StringUtils.isNotBlank(planInfo) && StringUtils.isNotBlank(planProduct)

Check warning on line 543 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 543 is only partially covered, 4 branches are missing
&& StringUtils.isNotBlank(planPublisher)) {

Check warning on line 544 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 544 is only partially covered, 2 branches are missing
for (JsonNode resource : resources) {

Check warning on line 545 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 545 is only partially covered, 2 branches are missing
String type = resource.get("type").asText();

Check warning on line 546 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 546 is not covered by tests
if (type.contains("virtualMachine")) {

Check warning on line 547 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 547 is only partially covered, 2 branches are missing
ObjectNode planNode = MAPPER.createObjectNode();

Check warning on line 548 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 548 is not covered by tests
planNode.put("name", planInfo);

Check warning on line 549 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 549 is not covered by tests
planNode.put("publisher", planPublisher);

Check warning on line 550 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 550 is not covered by tests
planNode.put("product", planProduct);

Check warning on line 551 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 551 is not covered by tests
((ObjectNode) resource).replace("plan", planNode);

Check warning on line 552 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 552 is not covered by tests
}
}

Check warning on line 554 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 554 is not covered by tests
}
}
}

if (imageId != null) {
Expand Down

0 comments on commit bb06c11

Please sign in to comment.