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

pack build support --extension #1651

Merged
merged 33 commits into from
Apr 7, 2023
Merged

pack build support --extension #1651

merged 33 commits into from
Apr 7, 2023

Conversation

edithwuly
Copy link
Contributor

Summary

pack build support --extension.

Output

Before

Error: unknown flag: --extension

After

...
Adding extension samples/tree version 0.0.1 to builder
...
Successfully built image sample-app

Documentation

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

Related

Resolves #1551

@edithwuly edithwuly requested review from a team as code owners March 1, 2023 10:41
@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label Mar 1, 2023
@github-actions github-actions bot added this to the 0.29.0 milestone Mar 1, 2023
dependabot bot and others added 16 commits March 1, 2023 19:37
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](golang/crypto@v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [golang.org/x/oauth2](https://github.com/golang/oauth2) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/golang/oauth2/releases)
- [Commits](golang/oauth2@v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/oauth2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [github.com/containerd/containerd](https://github.com/containerd/containerd) from 1.6.15 to 1.6.18.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](containerd/containerd@v1.6.15...v1.6.18)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.7.1 to 1.11.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.7.1...v1.11.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [github.com/docker/cli](https://github.com/docker/cli) from 23.0.0+incompatible to 23.0.1+incompatible.
- [Release notes](https://github.com/docker/cli/releases)
- [Commits](docker/cli@v23.0.0...v23.0.1)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [github.com/buildpacks/lifecycle](https://github.com/buildpacks/lifecycle) from 0.15.3 to 0.16.0.
- [Release notes](https://github.com/buildpacks/lifecycle/releases)
- [Changelog](https://github.com/buildpacks/lifecycle/blob/main/RELEASE.md)
- [Commits](buildpacks/lifecycle@v0.15.3...v0.16.0)

---
updated-dependencies:
- dependency-name: github.com/buildpacks/lifecycle
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](onsi/gomega@v1.26.0...v1.27.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Signed-off-by: Matej Vasek <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Signed-off-by: Joe Kutner <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](golang/net@v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [github.com/gdamore/tcell/v2](https://github.com/gdamore/tcell) from 2.5.4 to 2.6.0.
- [Release notes](https://github.com/gdamore/tcell/releases)
- [Changelog](https://github.com/gdamore/tcell/blob/main/CHANGESv2.md)
- [Commits](gdamore/tcell@v2.5.4...v2.6.0)

---
updated-dependencies:
- dependency-name: github.com/gdamore/tcell/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.0 to 1.27.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](onsi/gomega@v1.27.0...v1.27.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.0.0-20220209214540-3681064d5158 to 0.1.0.
- [Release notes](https://github.com/golang/sys/releases)
- [Commits](https://github.com/golang/sys/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Bumps [crazy-max/ghaction-chocolatey](https://github.com/crazy-max/ghaction-chocolatey) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/crazy-max/ghaction-chocolatey/releases)
- [Changelog](https://github.com/crazy-max/ghaction-chocolatey/blob/v2/CHANGELOG.md)
- [Commits](crazy-max/ghaction-chocolatey@v2...v2)

---
updated-dependencies:
- dependency-name: crazy-max/ghaction-chocolatey
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Stack suggest should use the singular of stack, not stacks.

Signed-off-by: Aidan Delaney <[email protected]>
Signed-off-by: edithwuly <[email protected]>
@github-actions github-actions bot added the type/chore Issue that requests non-user facing changes. label Mar 1, 2023
@codecov
Copy link

codecov bot commented Mar 1, 2023

Codecov Report

Merging #1651 (a5b92c2) into main (16d6187) will decrease coverage by 0.07%.
The diff coverage is 67.00%.

❗ Current head a5b92c2 differs from pull request most recent head fdcd17d. Consider uploading reports for the commit fdcd17d to get more accurate results

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1651      +/-   ##
==========================================
- Coverage   80.53%   80.45%   -0.07%     
==========================================
  Files         165      165              
  Lines       10850    10925      +75     
==========================================
+ Hits         8737     8789      +52     
- Misses       1587     1606      +19     
- Partials      526      530       +4     
Flag Coverage Δ
os_linux 79.28% <67.00%> (-0.06%) ⬇️
os_macos 77.40% <67.00%> (-0.08%) ⬇️
os_windows 80.37% <67.00%> (-0.07%) ⬇️
unit 80.45% <67.00%> (-0.07%) ⬇️

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

@github-actions github-actions bot removed the type/chore Issue that requests non-user facing changes. label Mar 1, 2023
Copy link
Member

@natalieparellano natalieparellano left a comment

Choose a reason for hiding this comment

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

@edithwuly awesome work! This is really great to see. The code looks sound, we just need to add some tests in order to verify. You might take a look at the tests for --buildpack here:

when("Buildpacks option", func() {

I don't think all of the tests in this block are valid for extensions, probably the most important ones are:

  • it("builder order is overwritten", func() {
  • when("id - no version is provided", func() {
  • it("all buildpacks are added to ephemeral builder", func() {

    This may also benefit from an acceptance test, like we have here - however even experienced contributors will agree that modifying the pack acceptance tests can be painful, so we could definitely help you with that or work to minimize the scope for this PR.

}

switch locatorType {
case buildpack.RegistryLocator:
Copy link
Member

Choose a reason for hiding this comment

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

A note, in case it helps others, buildpack.FromBuilderLocator is deprecated now that we have pre- and post- buildpacks. We may want --pre-extension and --post-extension (like exist for buildpacks) but that should be considered out-of-scope for this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have added case buildpack.FromBuilderLocator in processExtensions()` funtion. Please help me review, thanks!

@edithwuly
Copy link
Contributor Author

Thanks @natalieparellano for your review! I'm glad to know my code is satisfying. I'm working on the most important unit tests and will patch this PR as soon as completed.

Signed-off-by: edithwuly <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Signed-off-by: edithwuly <[email protected]>
@edithwuly
Copy link
Contributor Author

Hi @natalieparellano! I try to add two unit tests for --extension. Please help me review. Thanks!

But I have some trouble on the "all extensions are added to ephemeral builder" test. I think it is used to test whether child extension can be added to builder with meta extension as a whole layer. And it uses the extractPackaged() function, in which it seems that extractExtensions() function has not been ready.

return nil, nil, nil // TODO: add extractExtensions when `pack extension package` is supported in https://github.com/buildpacks/pack/issues/1489

Copy link
Member

@natalieparellano natalieparellano left a comment

Choose a reason for hiding this comment

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

@edithwuly awesome work! This is getting to be in great shape. I left a couple nits and one clarification. It seems almost done now :)

internal/commands/build.go Outdated Show resolved Hide resolved
pkg/client/build.go Outdated Show resolved Hide resolved
pkg/client/build.go Outdated Show resolved Hide resolved
pkg/client/build.go Outdated Show resolved Hide resolved
pkg/client/build_test.go Show resolved Hide resolved
@dfreilich dfreilich modified the milestones: 0.29.0, 0.30.0 Mar 26, 2023
@natalieparellano
Copy link
Member

@edithwuly any update on this one? This one just requires a couple of updates (and would make acceptance tests for #1698 a LOT easier 🙃 )

edithwuly and others added 6 commits April 7, 2023 14:19
Co-authored-by: Natalie Arellano <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Co-authored-by: Natalie Arellano <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Co-authored-by: Natalie Arellano <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Co-authored-by: Natalie Arellano <[email protected]>
Signed-off-by: edithwuly <[email protected]>
Signed-off-by: wlywly <[email protected]>
@edithwuly
Copy link
Contributor Author

Yes, sorry about the delay. I have merged your suggestions, removed the rest three lines and merged the buildpacks:main. Thank you very much! @natalieparellano

@pacostas
Copy link

pacostas commented Apr 7, 2023

I tested this PR using the extension we've been working on, and it seems to be working properly. We're really excited about getting this PR landed :)

@jkutner jkutner merged commit cc9993c into buildpacks:main Apr 7, 2023
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.

pack build should support --extension
7 participants