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

Conditionally packaging a buildpack or an extension #934

Merged
merged 3 commits into from
Jun 17, 2024

Conversation

pacostas
Copy link
Contributor

@pacostas pacostas commented Jun 5, 2024

Summary

This PR changes the package.sh script to conditionally package a buildpack or an extension according to whether is an extension or a buildpack.

The way this is implemented is to check whether the extension file exists on the directory, otherwise, it fallbacks to the default behavior of packaging a buildpack.

Test results:

Use Cases

Checklist

  • I have viewed, signed, and submitted the Contributor License Agreement.
  • I have linked issue(s) that this PR should close using keywords or the Github UI (See docs)
  • I have added an integration test, if necessary.
  • I have reviewed the styleguide for guidance on my code quality.
  • I'm happy with the commit history on this PR (I have rebased/squashed as needed).

@pacostas pacostas requested a review from a team as a code owner June 5, 2024 14:04
robdimsdale
robdimsdale previously approved these changes Jun 6, 2024
Copy link
Member

@robdimsdale robdimsdale left a comment

Choose a reason for hiding this comment

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

Looks good - thanks.

I cleaned up some code a bit, and left a comment inline for a potential future refactor.

buildpack package "${output}" \
--path "${BUILD_DIR}/buildpack.tgz" \
--format file
pushd "${BUILD_DIR}/cnbdir" > /dev/null
Copy link
Member

Choose a reason for hiding this comment

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

Initially i was confused why we were not doing something similar to the pack buildpack package --path <path> below, then I realized that pack extension package doesn't have that feature.

I opened this feature request on pack -if/when that lands we can clean this up.

@mhdawson
Copy link
Member

@ForestEckhardt wondering if you might have time to help review/land?

buildpack::archive "${version}"
buildpackage::create "${output}"
buildpack_type=buildpack
if [ -f "extension.toml" ]; then
Copy link
Contributor

@ForestEckhardt ForestEckhardt Jun 17, 2024

Choose a reason for hiding this comment

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

Does this need to be an absolute path as well to solve the same problem as seen in #947?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ForestEckhardt There was no error on that one, but I changed it anyway to point to an absolute path. I also rebased the branch.

@ForestEckhardt ForestEckhardt merged commit b219ad9 into paketo-buildpacks:main Jun 17, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants