Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use arm64 lifecycle for arm64 linux base image #1521

Merged
merged 1 commit into from
Sep 29, 2022
Merged

Use arm64 lifecycle for arm64 linux base image #1521

merged 1 commit into from
Sep 29, 2022

Conversation

jpena-r7
Copy link
Contributor

Summary

This change installs the arm64 lifecycle when creating a builder on an arm64 linux base image. Tests were also added to verify expected behavior.

Unit and acceptance tests were run locally.

Output

Before

The current behavior is that it always downloads the x86-64 lifecycle.

After

I verified the correct behavior by building pack on an arm64 machine and creating a builder on an arm64 stack. See the output from a small script used to test the change below and the correct lifecycle url being used. it also verifies that the lifecycle binary can be executed inside the container.

++ git clone -q https://github.com/jpena-r7/pack.git
++ cd pack
++ git checkout --track origin/use-arm64-lifecycle-on-arm64
Branch 'use-arm64-lifecycle-on-arm64' set up to track remote branch 'use-arm64-lifecycle-on-arm64' from 'origin'.
Switched to a new branch 'use-arm64-lifecycle-on-arm64'
++ make build
mkdir out/tests || (exit 0)
> Building...
go build -ldflags "-s -w -X 'github.com/buildpacks/pack.Version=0.0.0+git-b02475c' -extldflags " -trimpath -o ./out/pack -a ./cmd/pack
++ cd ..
++ git clone -q https://github.com/jericop/amazonlinux-builder-buildpackless-base.git
++ ./pack/out/pack builder create amazonlinux-builder:arm --config amazonlinux-builder-buildpackless-base/builder.toml
Warning: builder configuration: empty order definition
base-cnb: Pulling from jericop/amazonlinux-run
Digest: sha256:f4e33a89725f6a9aa47dc28ae36ed32595db78d1eef28155fd75511199eb2238
Status: Image is up to date for jericop/amazonlinux-run:base-cnb
base-cnb: Pulling from jericop/amazonlinux-build
Digest: sha256:d775ff59e9b4a4a8e9e0c2449114fafe5b183be68115263679940c1782984589
Status: Image is up to date for jericop/amazonlinux-build:base-cnb
Downloading from https://github.com/buildpacks/lifecycle/releases/download/v0.14.1/lifecycle-v0.14.1+linux.arm64.tgz
5.17 MB/5.17 MB
Successfully created builder image amazonlinux-builder:arm
Tip: Run pack build <image-name> --builder amazonlinux-builder:arm to use this builder
++ docker run -it --rm --entrypoint /cnb/lifecycle/lifecycle amazonlinux-builder:arm
ERROR: failed to parse arguments
++ pack builder inspect amazonlinux-builder:arm
++ grep -A1 Run
Run Images:
  jericop/amazonlinux-run:base-cnb
++ docker inspect jericop/amazonlinux-run:base-cnb
++ jq '.[].Architecture'
"arm64"
++ arch
aarch64

Documentation

  • Should this change be documented?
    • Yes, see #___
    • No

Related

Resolves #1518

@jpena-r7 jpena-r7 requested a review from a team as a code owner September 27, 2022 04:51
@github-actions github-actions bot added this to the 0.28.0 milestone Sep 27, 2022
@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label Sep 27, 2022
Signed-off-by: Jerico Pena <jpena@rapid7.com>
@codecov
Copy link

codecov bot commented Sep 27, 2022

Codecov Report

Merging #1521 (3a29b7b) into main (2138b9f) will decrease coverage by 1.03%.
The diff coverage is 81.25%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1521      +/-   ##
==========================================
- Coverage   81.14%   80.11%   -1.02%     
==========================================
  Files         155      155              
  Lines       10086    10095       +9     
==========================================
- Hits         8183     8087      -96     
- Misses       1420     1524     +104     
- Partials      483      484       +1     
Flag Coverage Δ
os_linux 79.89% <81.25%> (+0.02%) ⬆️
os_macos 77.37% <81.25%> (-<0.01%) ⬇️
os_windows 79.96% <81.25%> (-1.05%) ⬇️
unit 80.11% <81.25%> (-1.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Member

@jjbustamante jjbustamante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks awesome to me!!! Great job @jpena-r7!

@samj1912 samj1912 merged commit 495ef2a into buildpacks:main Sep 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

x86_64 lifecycle installed on arm64 builder created by pack
4 participants