Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/builder/lifecycle.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ func (l *lifecycle) binaries() []string {

// SupportedLinuxArchitecture returns true for each binary architecture available at https://github.com/buildpacks/lifecycle/releases/
func SupportedLinuxArchitecture(arch string) bool {
return arch == "arm64" || arch == "ppc64le" || arch == "s390x"
return arch == "arm64" || arch == "ppc64le" || arch == "s390x" || arch == "x86-64"
}
4 changes: 4 additions & 0 deletions pkg/client/create_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ func (c *Client) uriFromLifecycleVersion(version semver.Version, os string, arch
return fmt.Sprintf("https://github.com/buildpacks/lifecycle/releases/download/v%s/lifecycle-v%s+windows.%s.tgz", version.String(), version.String(), arch)
}

if architecture == "amd64" {
architecture = "x86-64"
}

if builder.SupportedLinuxArchitecture(architecture) {
arch = architecture
} else {
Expand Down
38 changes: 38 additions & 0 deletions pkg/client/create_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,44 @@ func testCreateBuilder(t *testing.T, when spec.G, it spec.S) {
h.AssertNil(t, err)
})

it("should download x86-64 lifecycle when architecture is amd64", func() {
prepareFetcherWithBuildImage()
prepareFetcherWithRunImages()
opts.Config.Lifecycle.URI = ""
opts.Config.Lifecycle.Version = "3.4.5"
h.AssertNil(t, fakeBuildImage.SetArchitecture("amd64"))

mockDownloader.EXPECT().Download(
gomock.Any(),
"https://github.com/buildpacks/lifecycle/releases/download/v3.4.5/lifecycle-v3.4.5+linux.x86-64.tgz",
).Return(
blob.NewBlob(filepath.Join("testdata", "lifecycle", "platform-0.4")), nil,
)

err := subject.CreateBuilder(context.TODO(), opts)
h.AssertNil(t, err)
h.AssertNotContains(t, out.String(), "failed to find a lifecycle binary")
})

it("should warn and default to x86-64 for unknown architecture", func() {
prepareFetcherWithBuildImage()
prepareFetcherWithRunImages()
opts.Config.Lifecycle.URI = ""
opts.Config.Lifecycle.Version = "3.4.5"
h.AssertNil(t, fakeBuildImage.SetArchitecture("riscv64"))

mockDownloader.EXPECT().Download(
gomock.Any(),
"https://github.com/buildpacks/lifecycle/releases/download/v3.4.5/lifecycle-v3.4.5+linux.x86-64.tgz",
).Return(
blob.NewBlob(filepath.Join("testdata", "lifecycle", "platform-0.4")), nil,
)

err := subject.CreateBuilder(context.TODO(), opts)
h.AssertNil(t, err)
h.AssertContains(t, out.String(), "failed to find a lifecycle binary")
})

when("windows", func() {
it("should download from predetermined uri", func() {
opts.Config.Extensions = nil // TODO: downloading extensions doesn't work yet; to be implemented in https://github.com/buildpacks/pack/issues/1489
Expand Down
Loading