Support CNB builder platform API 0.3

This commit adds support for Cloud Native Buildpacks builder platform
API 0.3, which is the latest platform API available currently. Support
for platform API 0.1 has been removed, adopting the policy of the pack
CLI to support the current platform API version and one version prior.

Fixes gh-20757
This commit is contained in:
Scott Frederick
2020-04-01 17:18:46 -05:00
parent bb9e37e119
commit a01c8452cb
22 changed files with 289 additions and 758 deletions

View File

@@ -89,14 +89,14 @@ class BootBuildImageIntegrationTests {
}
@TestTemplate
void buildsImageWithV1Builder() throws IOException {
void buildsImageWithV2Builder() throws IOException {
writeMainClass();
writeLongNameResource();
BuildResult result = this.gradleBuild.build("bootBuildImage");
String projectName = this.gradleBuild.getProjectDir().getName();
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("docker.io/library/" + projectName);
assertThat(result.getOutput()).contains("cloudfoundry/cnb:bionic-platform-api-0.1");
assertThat(result.getOutput()).contains("cloudfoundry/cnb:bionic-platform-api-0.2");
ImageReference imageReference = ImageReference.of(ImageName.of(projectName));
try (GenericContainer<?> container = new GenericContainer<>(imageReference.toString())) {
container.waitingFor(Wait.forLogMessage("Launched\\n", 1)).start();
@@ -111,10 +111,10 @@ class BootBuildImageIntegrationTests {
writeMainClass();
writeLongNameResource();
BuildResult result = this.gradleBuild.build("bootBuildImage", "--imageName=example.com/test-image-name",
"--builder=cloudfoundry/cnb:0.0.43-bionic");
"--builder=cloudfoundry/cnb:bionic-platform-api-0.2");
assertThat(result.task(":bootBuildImage").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);
assertThat(result.getOutput()).contains("example.com/test-image-name");
assertThat(result.getOutput()).contains("cloudfoundry/cnb:0.0.43-bionic");
assertThat(result.getOutput()).contains("cloudfoundry/cnb:bionic-platform-api-0.2");
ImageReference imageReference = ImageReference.of(ImageName.of("example.com/test-image-name"));
try (GenericContainer<?> container = new GenericContainer<>(imageReference.toString())) {
container.waitingFor(Wait.forLogMessage("Launched\\n", 1)).start();