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

Allows application/jar files to be delivered by postal #196

Merged
merged 2 commits into from
Jul 6, 2021

Conversation

ryanmoran
Copy link
Member

Summary

In some cases, buildpack authors will want to include *.jar files as dependencies in their buildpack.toml. For a jar file, the Java ecosystem tooling expects that file not to be decompressed even though it is an archive format. Instead, it is expected that the file simply be downloaded into the layer. This changeset adds application/jar to the set of "no-op" archives such that it will achieve this behavior.

Additionally, to ensure the jar file ends up in the layer with the same name it declares in the buildpack.toml, this changeset introduces a new vacation.Archive.WithName option that allows users to give a name to the file that will be copied into when using the "no-op" archive code path. Modifications to the postal.Service.Deliver implementation parse the dependency URI and assign the basename of that path as the archive name.

Other Changes

While I was making these changes, I also split up the implementation files in the vacation package to organize the code a bit better as it had become kind of difficult to navigate in a single file. Additionally, I renamed the test files to remove the stutter they had with the vacation_ prefix. Finally, I turned the private writeTextFile implementation into an exported type called vacation.NopArchive.

⚠️ THIS IS A BREAKING CHANGE IN THE API OF postal.Service.Deliver ⚠️

Since we are now using the basename of the dependency URI to name a simple file that is installed using postal.Service.Deliver, this will break any implementations that previously relied on the filename being hardcoded to artifact.

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).

- introduces vacation.NopArchive type for non-archive files
- splits vacation implementation files up into type-named files
- renames vacation test files to remove stutter
- adds vacation.Archive.WithName option to allow NopArchives to have
  specified names
- uses vacation.Archive.WithName option in postal.Service.Deliver to
  deliver file to location matching the dependency URI basename
- includes application/jar mime-type as NopArchive type
@ryanmoran ryanmoran requested a review from a team as a code owner June 30, 2021 18:10
@ForestEckhardt ForestEckhardt merged commit 0de1e74 into main Jul 6, 2021
@ForestEckhardt ForestEckhardt deleted the vacation-reorg branch July 6, 2021 15:10
@sophiewigmore sophiewigmore mentioned this pull request Jul 8, 2021
5 tasks
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.

2 participants