Skip to content

Commit 2a2b0dd

Browse files
committed
Merge branch 'main' into libcnb-package/find_cargo_workspace
* main: Bump buildpacks/github-actions from 5.3.1 to 5.4.0 (#647) Prepare release v0.14.0 (#646) Pin intra-libcnb* crate dependencies to exact versions (#644) Rename libcnb-cargo integration test file (#645) Add version links in the changelog (#643) Update Quick Start Guide (#640) Run `cargo upgrade` as part of preparing libcnb releases (#641) Move packaged buildpack directory out of `target/` (#583) Refactor libcnb-cargo integration tests (#637) libcnb-test: Improve error messages for `address_for_port` (#636) libcnb-test: Implement `fmt::Display` for `LogOutput` (#635) # Conflicts: # CHANGELOG.md # libcnb-cargo/src/package/command.rs
2 parents 30c3dc6 + 7fb80a8 commit 2a2b0dd

File tree

27 files changed

+537
-443
lines changed

27 files changed

+537
-443
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ jobs:
6262
- name: Rust Cache
6363
uses: Swatinem/[email protected]
6464
- name: Install Pack CLI
65-
uses: buildpacks/github-actions/setup-pack@v5.3.1
65+
uses: buildpacks/github-actions/setup-pack@v5.4.0
6666
- name: Run integration tests
6767
# Runs only tests annotated with the `ignore` attribute (which in this repo, are the integration tests).
6868
run: cargo test -- --ignored
@@ -73,4 +73,4 @@ jobs:
7373
# Uses a non-libc image to validate the static musl cross-compilation.
7474
# TODO: Switch this back to using the `alpine` tag once the stable Pack CLI release supports
7575
# image extensions (currently newer sample alpine images fail to build with stable Pack).
76-
run: pack build example-basics --builder cnbs/sample-builder@sha256:da5ff69191919f1ff30d5e28859affff8e39f23038137c7751e24a42e919c1ab --trust-builder --buildpack target/buildpack/x86_64-unknown-linux-musl/debug/libcnb-examples_basics --path examples/
76+
run: pack build example-basics --builder cnbs/sample-builder@sha256:da5ff69191919f1ff30d5e28859affff8e39f23038137c7751e24a42e919c1ab --trust-builder --buildpack packaged/x86_64-unknown-linux-musl/debug/libcnb-examples_basics --path examples/

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/target/
2+
/packaged/
23
.DS_Store
34
.idea
45
Cargo.lock
56
**/fixtures/*/target/
7+
**/fixtures/*/packaged/

CHANGELOG.md

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,41 @@ This is the new, unified, changelog that contains changes from across all libcnb
44
separate changelogs for each crate were used. If you need to refer to these old changelogs, find them named
55
`HISTORICAL_CHANGELOG.md` in their respective crate directories.
66

7+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
8+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9+
710
## [Unreleased]
811

12+
### Changed
13+
14+
- `libcnb-package`:
15+
- Added `find_cargo_workspace` which provides a convenient starting point for locating buildpacks for packaging and testing purposes. ([#629](https://github.com/heroku/libcnb.rs/pull/629))
16+
17+
18+
## [0.14.0] - 2023-08-18
19+
920
### Added
1021

11-
- `libcnb-package`: Add cross-compilation assistance for Linux `aarch64-unknown-linux-musl`. ([#577](https://github.com/heroku/libcnb.rs/pull/577))
22+
- `libcnb-package`: Added cross-compilation assistance for Linux `aarch64-unknown-linux-musl`. ([#577](https://github.com/heroku/libcnb.rs/pull/577))
23+
- `libcnb-cargo`: Added `--package-dir` command line option to control where packaged buildpacks are written. ([#583](https://github.com/heroku/libcnb.rs/pull/583))
24+
- `libcnb-test`:
25+
- `LogOutput` now implements `std::fmt::Display`. ([#635](https://github.com/heroku/libcnb.rs/pull/635))
26+
- `ContainerConfig` now implements `Clone`. ([#636](https://github.com/heroku/libcnb.rs/pull/636))
1227

1328
### Changed
1429

30+
- `libcnb-cargo`: Moved the default location for packaged buildpacks from Cargo's `target/` directory to `packaged/` in the Cargo workspace root. This simplifies the path and stops modification of the `target/` directory which previously might have caching implications when other tools didn't expect non-Cargo output in that directory. Users that implicitly rely on the output directory need to adapt. The output of `cargo libcnb package` will refer to the new locations. ([#583](https://github.com/heroku/libcnb.rs/pull/583))
31+
- `libcnb-package`:
32+
- buildpack target directory now contains the target triple. Users that implicitly rely on the output directory need to adapt. The output of `cargo libcnb package` will refer to the new locations. ([#580](https://github.com/heroku/libcnb.rs/pull/580))
33+
- `get_buildpack_target_dir` was renamed to `get_buildpack_package_dir` ([#583](https://github.com/heroku/libcnb.rs/pull/583))
1534
- `libcnb-test`:
16-
- `ContainerContext::address_for_port` now returns `SocketAddr` directly instead of `Option<SocketAddr>`. ([#605](https://github.com/heroku/libcnb.rs/pull/605))
35+
- `ContainerContext::address_for_port` will now panic for all failure modes rather than just some, and so now returns `SocketAddr` directly instead of `Option<SocketAddr>`. This reduces test boilerplate due to the caller no longer needing to `.unwrap()` and improves debugging UX when containers crash after startup. ([#605](https://github.com/heroku/libcnb.rs/pull/605) and [#636](https://github.com/heroku/libcnb.rs/pull/636))
1736
- Docker commands are now run using the Docker CLI instead of Bollard and the Docker daemon API. ([#620](https://github.com/heroku/libcnb.rs/pull/620))
1837
- `ContainerConfig::entrypoint` now accepts a String rather than a vector of strings. Any arguments to the entrypoint should be moved to `ContainerConfig::command`. ([#620](https://github.com/heroku/libcnb.rs/pull/620))
19-
- `TestRunner::new` has been removed, since its only purpose was for advanced configuration that's no longer applicable. Use `TestRunner::default` instead. ([#620](https://github.com/heroku/libcnb.rs/pull/620))
20-
- `LogOutput` no longer exposes `stdout_raw` and `stderr_raw`. ([#607](https://github.com/heroku/libcnb.rs/pull/607))
38+
- Removed `TestRunner::new` since its only purpose was for advanced configuration that's no longer applicable. Use `TestRunner::default` instead. ([#620](https://github.com/heroku/libcnb.rs/pull/620))
39+
- Removed `stdout_raw` and `stderr_raw` from `LogOutput`. ([#607](https://github.com/heroku/libcnb.rs/pull/607))
2140
- Improved wording of panic error messages. ([#619](https://github.com/heroku/libcnb.rs/pull/619) and [#620](https://github.com/heroku/libcnb.rs/pull/620))
22-
- `libcnb-package`:
23-
- buildpack target directory now contains the target triple. Users that implicitly rely on the output directory need to adapt. The output of `cargo libcnb package` will refer to the new locations. ([#580](https://github.com/heroku/libcnb.rs/pull/580))
24-
- Added `find_cargo_workspace` which provides a convenient starting point for locating buildpacks for packaging and testing purposes. ([#629](https://github.com/heroku/libcnb.rs/pull/629))
25-
- `libherokubuildpack`: Switch the `flate2` decompression backend from `miniz_oxide` to `zlib`. ([#593](https://github.com/heroku/libcnb.rs/pull/593))
26-
- Bump minimum external dependency versions. ([#587](https://github.com/heroku/libcnb.rs/pull/587))
41+
- `libherokubuildpack`: Changed the `flate2` decompression backend from `miniz_oxide` to `zlib`. ([#593](https://github.com/heroku/libcnb.rs/pull/593))
2742

2843
### Fixed
2944

@@ -32,7 +47,7 @@ separate changelogs for each crate were used. If you need to refer to these old
3247
- `ContainerContext::expose_port` now only exposes the port to localhost. ([#610](https://github.com/heroku/libcnb.rs/pull/610))
3348
- If a test with an expected result of `PackResult::Failure` unexpectedly succeeds, the built app image is now correctly cleaned up. ([#625](https://github.com/heroku/libcnb.rs/pull/625))
3449

35-
## [0.13.0] 2023-06-21
50+
## [0.13.0] - 2023-06-21
3651

3752
The highlight of this release is the `cargo libcnb package` changes to support compilation of both buildpacks and meta-buildpacks.
3853

@@ -71,7 +86,7 @@ The highlight of this release is the `cargo libcnb package` changes to support c
7186
`dependency_graph::get_dependencies`
7287
to support dependency ordering and resolution in libcnb.rs-based Rust packages. ([#575](https://github.com/heroku/libcnb.rs/pull/575))
7388

74-
## [0.12.0] 2023-04-28
89+
## [0.12.0] - 2023-04-28
7590

7691
Highlight of this release is the bump to [Buildpack API 0.9](https://github.com/buildpacks/spec/releases/tag/buildpack%2Fv0.9). This release contains breaking changes, please refer to the items below for migration advice.
7792

@@ -87,26 +102,26 @@ Highlight of this release is the bump to [Buildpack API 0.9](https://github.com/
87102
- `Env::get_string_lossy` as a convenience method to work with environment variables directly. Getting a value out of an `Env` and treating its contents as unicode is a common case. Using this new method can simplify buildpack code. ([#565](https://github.com/heroku/libcnb.rs/pull/565))
88103
- `Clone` implementation for `libcnb::layer_env::Scope`. ([#566](https://github.com/heroku/libcnb.rs/pull/566))
89104

90-
## [0.11.5] 2023-02-07
105+
## [0.11.5] - 2023-02-07
91106

92107
### Changed
93108

94109
- Update `toml` to `0.7.1`. If your buildpack interacts with TOML data directly, you probably want to bump
95110
the `toml` version in your buildpack as well. ([#556](https://github.com/heroku/libcnb.rs/pull/556))
96111

97-
## [0.11.4] 2023-01-11
112+
## [0.11.4] - 2023-01-11
98113

99114
### Added
100115

101116
- libcnb-data: Store struct now supports `clone()` and `default()`. ([#547](https://github.com/heroku/libcnb.rs/pull/547))
102117

103-
## [0.11.3] 2023-01-09
118+
## [0.11.3] - 2023-01-09
104119

105120
### Added
106121

107122
- libcnb: Add `store` field to `BuildContext`, exposing the contents of `store.toml` if present. ([#543](https://github.com/heroku/libcnb.rs/pull/543))
108123

109-
## [0.11.2] 2022-12-15
124+
## [0.11.2] - 2022-12-15
110125

111126
### Fixed
112127

@@ -121,7 +136,7 @@ the `toml` version in your buildpack as well. ([#556](https://github.com/heroku/
121136

122137
- libherokubuildpack: Add `command` and `write` modules for working with `std::process::Command` output streams. ([#535](https://github.com/heroku/libcnb.rs/pull/535))
123138

124-
## [0.11.1] 2022-09-29
139+
## [0.11.1] - 2022-09-29
125140

126141
### Fixed
127142

@@ -132,7 +147,7 @@ the `toml` version in your buildpack as well. ([#556](https://github.com/heroku/
132147

133148
- Improve the `libherokubuildpack` root module rustdocs. ([#503](https://github.com/heroku/libcnb.rs/pull/503))
134149

135-
## [0.11.0] 2022-09-23
150+
## [0.11.0] - 2022-09-23
136151

137152
### Changed
138153

@@ -143,7 +158,7 @@ the `toml` version in your buildpack as well. ([#556](https://github.com/heroku/
143158

144159
- Add new crate `libherokubuildpack` with common code that can be useful when implementing buildpacks with libcnb. Originally hosted in a separate, private, repository. Code from `libherokubuildpack` might eventually find its way into libcnb.rs proper. At this point, consider it an incubator. ([#495](https://github.com/heroku/libcnb.rs/pull/495))
145160

146-
## [0.10.0] 2022-08-31
161+
## [0.10.0] - 2022-08-31
147162

148163
Highlight of this release is the bump to
149164
[Buildpack API 0.8](https://github.com/buildpacks/spec/releases/tag/buildpack%2Fv0.8) which brings support for SBOM to
@@ -174,3 +189,15 @@ version number. See the changelog below for other changes.
174189
### Removed
175190

176191
- Remove support for legacy BOM. Remove `Launch::bom`, `Build::bom`, `bom::Bom`, `bom::Entry`. ([#489](https://github.com/heroku/libcnb.rs/pull/489))
192+
193+
[unreleased]: https://github.com/heroku/libcnb.rs/compare/v0.14.0...HEAD
194+
[0.14.0]: https://github.com/heroku/libcnb.rs/compare/v0.13.0...v0.14.0
195+
[0.13.0]: https://github.com/heroku/libcnb.rs/compare/v0.12.0...v0.13.0
196+
[0.12.0]: https://github.com/heroku/libcnb.rs/compare/v0.11.5...v0.12.0
197+
[0.11.5]: https://github.com/heroku/libcnb.rs/compare/v0.11.4...v0.11.5
198+
[0.11.4]: https://github.com/heroku/libcnb.rs/compare/v0.11.3...v0.11.4
199+
[0.11.3]: https://github.com/heroku/libcnb.rs/compare/v0.11.2...v0.11.3
200+
[0.11.2]: https://github.com/heroku/libcnb.rs/compare/v0.11.1...v0.11.2
201+
[0.11.1]: https://github.com/heroku/libcnb.rs/compare/v0.11.0...v0.11.1
202+
[0.11.0]: https://github.com/heroku/libcnb.rs/compare/v0.10.0...v0.11.0
203+
[0.10.0]: https://github.com/heroku/libcnb.rs/compare/libcnb/v0.9.0...v0.10.0

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ members = [
1717
]
1818

1919
[workspace.package]
20-
version = "0.13.0"
20+
version = "0.14.0"
2121
rust-version = "1.64"
2222
edition = "2021"
2323
license = "BSD-3-Clause"
2424

2525
[workspace.dependencies]
26-
libcnb = { version = "0.13.0", path = "libcnb" }
27-
libcnb-data = { version = "0.13.0", path = "libcnb-data" }
28-
libcnb-package = { version = "0.13.0", path = "libcnb-package" }
29-
libcnb-proc-macros = { version = "0.13.0", path = "libcnb-proc-macros" }
30-
libcnb-test = { version = "0.13.0", path = "libcnb-test" }
31-
toml = { version = "0.7.5" }
26+
libcnb = { version = "=0.14.0", path = "libcnb" }
27+
libcnb-data = { version = "=0.14.0", path = "libcnb-data" }
28+
libcnb-package = { version = "=0.14.0", path = "libcnb-package" }
29+
libcnb-proc-macros = { version = "=0.14.0", path = "libcnb-proc-macros" }
30+
libcnb-test = { version = "=0.14.0", path = "libcnb-test" }
31+
toml = { version = "0.7.6" }

README.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,22 @@ In your project directory, run `cargo libcnb package` to start packaging:
178178

179179
```shell
180180
$ cargo libcnb package
181-
INFO - Reading buildpack metadata...
182-
INFO - Found buildpack libcnb-examples/my-buildpack with version 0.1.0.
183-
INFO - Determining automatic cross-compile settings...
184-
INFO - Building binaries (x86_64-unknown-linux-musl)...
181+
🔍 Locating buildpacks...
182+
📦 [1/1] Building libcnb-examples/my-buildpack
183+
Determining automatic cross-compile settings...
184+
Building binaries (x86_64-unknown-linux-musl)...
185185
# Omitting compilation output...
186-
Finished dev [unoptimized] target(s) in 8.51s
187-
INFO - Writing buildpack directory...
188-
INFO - Successfully wrote buildpack directory: target/buildpack/debug/libcnb-examples_my-buildpack (3.03 MiB)
189-
INFO - Packaging successfully finished!
190-
INFO - Hint: To test your buildpack locally with pack, run: pack build my-image --buildpack target/buildpack/debug/libcnb-examples_my-buildpack --path /path/to/application
186+
Finished dev [unoptimized] target(s) in 8.92s
187+
Writing buildpack directory...
188+
Successfully wrote buildpack directory: packaged/x86_64-unknown-linux-musl/debug/libcnb-examples_my-buildpack (4.06 MiB)
189+
✨ Packaging successfully finished!
190+
191+
💡 To test your buildpack locally with pack, run:
192+
pack build my-image-name \
193+
--buildpack /home/ponda.baba/my-buildpack/packaged/x86_64-unknown-linux-musl/debug/libcnb-examples_my-buildpack \
194+
--path /path/to/application
195+
196+
/home/ponda.baba/my-buildpack/packaged/x86_64-unknown-linux-musl/debug/libcnb-examples_my-buildpack
191197
```
192198

193199
If you get errors with hints about how to install required tools to cross-compile from your host platform to the
@@ -202,28 +208,28 @@ application code at all, we just create an empty directory and use that as our a
202208

203209
```shell
204210
$ mkdir bogus-app
205-
$ pack build my-image --buildpack target/buildpack/debug/libcnb-examples_my-buildpack --path bogus-app --builder heroku/builder:22
211+
$ pack build my-image --buildpack packaged/x86_64-unknown-linux-musl/debug/libcnb-examples_my-buildpack --path bogus-app --builder heroku/builder:22
206212
...
207213
===> ANALYZING
208-
Previous image with name "my-image" not found
214+
Image with name "my-image" not found
209215
===> DETECTING
210216
libcnb-examples/my-buildpack 0.1.0
211217
===> RESTORING
212218
===> BUILDING
213219
Hello World!
214220
Build runs on stack heroku-22!
215221
===> EXPORTING
216-
Adding layer 'launch.sbom'
222+
Adding layer 'buildpacksio/lifecycle:launch.sbom'
217223
Adding 1/1 app layer(s)
218-
Adding layer 'launcher'
219-
Adding layer 'config'
220-
Adding layer 'process-types'
224+
Adding layer 'buildpacksio/lifecycle:launcher'
225+
Adding layer 'buildpacksio/lifecycle:config'
226+
Adding layer 'buildpacksio/lifecycle:process-types'
221227
Adding label 'io.buildpacks.lifecycle.metadata'
222228
Adding label 'io.buildpacks.build.metadata'
223229
Adding label 'io.buildpacks.project.metadata'
224230
Setting default process type 'web'
225231
Saving my-image...
226-
*** Images (24eed75bb2e6):
232+
*** Images (aa4695184718):
227233
my-image
228234
Successfully built image my-image
229235
```

RELEASING.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,12 @@ easier to gauge cross-crate compatibility.
1010
1. In the `workspace.package` table, update `version` to the new version
1111
2. In the `workspace.dependencies` table, update the `version` of each of the repository-local dependencies to the new version
1212
3. Update [CHANGELOG.md](./CHANGELOG.md)
13-
1. Move all content under `## [Unreleased]` to a new section that follows this pattern: `## [VERSION] YYYY-MM-DD`
13+
1. Move all content under `## [Unreleased]` to a new section that follows this pattern: `## [VERSION] - YYYY-MM-DD`
1414
2. If appropriate, add a high-level summary of changes at the beginning of the new section
15-
4. Commit the changes, push them and open a PR targeting `main`
15+
3. Update the version compare links at the bottom of the file to both add the new version, and update the "unreleased" link's "from" version.
16+
4. Install the latest version of [cargo-edit](https://github.com/killercup/cargo-edit): `cargo install cargo-edit`
17+
5. Bump in-range dependency versions using: `cargo upgrade`
18+
6. Commit the changes, push them and open a PR targeting `main`
1619

1720
## Release
1821

examples/ruby-sample/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ rust-version.workspace = true
66
publish = false
77

88
[dependencies]
9-
flate2 = { version = "1.0.26", default-features = false, features = ["zlib"] }
9+
flate2 = { version = "1.0.27", default-features = false, features = ["zlib"] }
1010
libcnb.workspace = true
11-
serde = "1.0.166"
11+
serde = "1.0.183"
1212
sha2 = "0.10.7"
13-
tar = { version = "0.4.38", default-features = false }
14-
tempfile = "3.6.0"
13+
tar = { version = "0.4.40", default-features = false }
14+
tempfile = "3.7.1"
1515
ureq = { version = "2.7.1", default-features = false, features = ["tls"] }
1616

1717
[dev-dependencies]

libcnb-cargo/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ path = "src/main.rs"
1717

1818
[dependencies]
1919
cargo_metadata = "0.17.0"
20-
clap = { version = "4.3.10", default-features = false, features = [
20+
clap = { version = "4.3.22", default-features = false, features = [
2121
"derive",
2222
"error-context",
2323
"help",
@@ -27,9 +27,8 @@ clap = { version = "4.3.10", default-features = false, features = [
2727
libcnb-data.workspace = true
2828
libcnb-package.workspace = true
2929
pathdiff = "0.2.1"
30-
thiserror = "1.0.41"
30+
thiserror = "1.0.47"
3131
toml.workspace = true
3232

3333
[dev-dependencies]
34-
fs_extra = "1.3.0"
35-
tempfile = "3.6.0"
34+
tempfile = "3.7.1"

libcnb-cargo/src/cli.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use clap::{Parser, Subcommand};
2+
use std::path::PathBuf;
23

34
#[derive(Parser)]
45
#[command(bin_name = "cargo")]
@@ -25,6 +26,9 @@ pub(crate) struct PackageArgs {
2526
/// Build for the target triple
2627
#[arg(long, default_value = "x86_64-unknown-linux-musl")]
2728
pub target: String,
29+
/// Directory for packaged buildpacks, defaults to 'packaged' in Cargo workspace root
30+
#[arg(long)]
31+
pub package_dir: Option<PathBuf>,
2832
}
2933

3034
#[cfg(test)]

libcnb-cargo/src/main.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ mod package;
99

1010
// Suppress warnings due to the `unused_crate_dependencies` lint not handling integration tests well.
1111
#[cfg(test)]
12-
use fs_extra as _;
13-
#[cfg(test)]
1412
use tempfile as _;
1513

1614
use crate::cli::{Cli, LibcnbSubcommand};

0 commit comments

Comments
 (0)