Skip to content

Commit

Permalink
fix(gceBakeHandler): Updating Image name pattern to match googlecompu…
Browse files Browse the repository at this point in the history
…te pre/post 1.1.2 plugin (#1122) (#1124)

(cherry picked from commit 0ff5ffe)

Co-authored-by: Christos Arvanitis <christos.arvanitis@armory.io>
  • Loading branch information
mergify[bot] and christosarvanitis authored Nov 26, 2024
1 parent 28269ad commit 59a8c79
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import java.util.concurrent.atomic.AtomicReference
@Component
public class GCEBakeHandler extends CloudProviderBakeHandler {

private static final String IMAGE_NAME_TOKEN = "googlecompute: A disk image was created:"
private static final String IMAGE_NAME_TOKEN = "googlecompute: A disk image was created"

private final resolvedBakeryDefaults = new AtomicReference<RoscoGoogleConfiguration.GCEBakeryDefaults>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,21 @@ class GCEBakeHandlerSpec extends Specification implements TestDefaults{
"Build 'googlecompute' finished.\n" +
"\n" +
"==> Builds finished. The artifacts of successful builds are:\n" +
"--> googlecompute: A disk image was created: kato-x12345678-trusty"
"--> googlecompute: ${packerLog}"

Bake bake = gceBakeHandler.scrapeCompletedBakeResults(REGION, "123", logsContent)
Bake bake = gceBakeHandler.scrapeCompletedBakeResults(REGION, bakeId, logsContent)

then:
with (bake) {
id == "123"
id == bakeId
!ami
image_name == "kato-x12345678-trusty"
image_name == imageName
}

where:
packerLog | bakeId | imageName
"A disk image was created: kato-x12345678-trusty" | "123" | "kato-x12345678-trusty"
"A disk image was created in the test-gcp project: kato-x12345678-trusty-changed" | "456" | "kato-x12345678-trusty-changed"
}

void 'scraping returns null for missing image name'() {
Expand Down

0 comments on commit 59a8c79

Please sign in to comment.