Skip to content

Commit

Permalink
Merge branch 'main' into schneems/output
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems authored Feb 12, 2024
2 parents f3f6e39 + f959dd1 commit fd2a647
Show file tree
Hide file tree
Showing 49 changed files with 402 additions and 524 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
- name: Rust Cache
uses: Swatinem/[email protected]
- name: Install Pack CLI
uses: buildpacks/github-actions/[email protected].1
uses: buildpacks/github-actions/[email protected].2
- name: Run integration tests
# Runs only tests annotated with the `ignore` attribute (which in this repo, are the integration tests).
run: cargo test -- --ignored
Expand All @@ -89,7 +89,8 @@ jobs:
run: cargo run --package libcnb-cargo -- libcnb package
working-directory: ./examples/basics
- name: Pack build using examples/basics
# Uses a non-libc image to validate the static musl cross-compilation.
# TODO: Switch this back to using the `alpine` tag once the stable Pack CLI release supports
# image extensions (currently newer sample alpine images fail to build with stable Pack).
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/
# TODO: This test previously used a non-libc builder to validate the static musl cross-compilation.
# This image used the experimental image extensions feature which has to be explicitly enabled and doesn't
# work with `--trust-builder`. To unblock CI, the builder has been changed to `heroku/builder:22`. As soon as
# we can, we should use a non-libc builder again.
run: pack build example-basics --force-color --builder heroku/builder:22 --trust-builder --buildpack packaged/x86_64-unknown-linux-musl/debug/libcnb-examples_basics --path examples/
2 changes: 1 addition & 1 deletion .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:

- name: Create pull request
id: pr
uses: peter-evans/create-pull-request@v5.0.2
uses: peter-evans/create-pull-request@v6.0.0
with:
token: ${{ steps.generate-token.outputs.app_token }}
title: Prepare release v${{ steps.new-version.outputs.version }}
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]


## [0.18.0] - 2024-02-12

### Changed

- Now targets [Buildpack API 0.10](https://github.com/buildpacks/spec/releases/tag/buildpack%2Fv0.10). Buildpacks need to upgrade the `api` key to `0.10` in their `buildpack.toml`. ([#773](https://github.com/heroku/libcnb.rs/pull/773))
- Improved the consistency of cross-compilation assistance provided across all supported `target_triple` and host OS/architecture combinations. [#769](https://github.com/heroku/libcnb.rs/pull/769)
- Added cross-compilation assistance for `aarch64-unknown-linux-musl` (on macOS and ARM64 Linux) and `x86_64-unknown-linux-musl` (on ARM64 Linux). [#769](https://github.com/heroku/libcnb.rs/pull/769)
- Raised Minimum Supported Rust Version (MSRV) to `1.76`. ([#774](https://github.com/heroku/libcnb.rs/pull/774))
- `libcnb`:
- Changed `Layer` interface from `&self` to `&mut self`. ([#669](https://github.com/heroku/libcnb.rs/pull/669))

Expand All @@ -20,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `MappedWrite::unwrap` for getting the wrapped `Write` back out. ([#765](https://github.com/heroku/libcnb.rs/pull/765))
- Added build `buildpack_output` module. This will help buildpack authors provide consistent and delightful output to their buildpack users ([#721](https://github.com/heroku/libcnb.rs/pull/721))

### Removed

- Types, errors, macros and functions related to stacks. The concept of stacks has been removed from the CNB spec. Use `Target` instead. ([#773](https://github.com/heroku/libcnb.rs/pull/773))

## [0.17.0] - 2023-12-06

### Added
Expand Down Expand Up @@ -245,7 +256,8 @@ version number. See the changelog below for other changes.

- Remove support for legacy BOM. Remove `Launch::bom`, `Build::bom`, `bom::Bom`, `bom::Entry`. ([#489](https://github.com/heroku/libcnb.rs/pull/489))

[unreleased]: https://github.com/heroku/libcnb.rs/compare/v0.17.0...HEAD
[unreleased]: https://github.com/heroku/libcnb.rs/compare/v0.18.0...HEAD
[0.18.0]: https://github.com/heroku/libcnb.rs/compare/v0.17.0...v0.18.0
[0.17.0]: https://github.com/heroku/libcnb.rs/compare/v0.16.0...v0.17.0
[0.16.0]: https://github.com/heroku/libcnb.rs/compare/v0.15.0...v0.16.0
[0.15.0]: https://github.com/heroku/libcnb.rs/compare/v0.14.0...v0.15.0
Expand Down
18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ members = [
]

[workspace.package]
version = "0.17.0"
rust-version = "1.75"
version = "0.18.0"
rust-version = "1.76"
edition = "2021"
license = "BSD-3-Clause"

Expand All @@ -38,10 +38,10 @@ missing_errors_doc = "allow"
module_name_repetitions = "allow"

[workspace.dependencies]
libcnb = { version = "=0.17.0", path = "libcnb" }
libcnb-common = { version = "=0.17.0", path = "libcnb-common" }
libcnb-data = { version = "=0.17.0", path = "libcnb-data" }
libcnb-package = { version = "=0.17.0", path = "libcnb-package" }
libcnb-proc-macros = { version = "=0.17.0", path = "libcnb-proc-macros" }
libcnb-test = { version = "=0.17.0", path = "libcnb-test" }
toml = { version = "0.8.8" }
libcnb = { version = "=0.18.0", path = "libcnb" }
libcnb-common = { version = "=0.18.0", path = "libcnb-common" }
libcnb-data = { version = "=0.18.0", path = "libcnb-data" }
libcnb-package = { version = "=0.18.0", path = "libcnb-package" }
libcnb-proc-macros = { version = "=0.18.0", path = "libcnb-proc-macros" }
libcnb-test = { version = "=0.18.0", path = "libcnb-test" }
toml = { version = "0.8.10" }
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
[docs.rs]: https://docs.rs/libcnb/latest/libcnb/
[Latest Version]: https://img.shields.io/crates/v/libcnb.svg
[crates.io]: https://crates.io/crates/libcnb
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.76+-lightgray.svg
[install-rust]: https://www.rust-lang.org/tools/install

`libcnb.rs` is a framework for writing [Cloud Native Buildpacks](https://buildpacks.io) in Rust.
It is an opinionated implementation adding language constructs and convenience methods for working
with the spec. It values strong adherence to the spec and data formats.

It currently targets version `0.9` of the CNB [Buildpack API specification](https://github.com/buildpacks/spec/blob/buildpack/0.9/buildpack.md).
It currently targets version `0.10` of the CNB [Buildpack API specification](https://github.com/buildpacks/spec/blob/buildpack/0.10/buildpack.md).

## Quick Start Guide

Expand Down Expand Up @@ -78,15 +78,12 @@ Since we're writing a Cloud Native Buildpack, we also need a `buildpack.toml`. U
file named `buildpack.toml` in the root of your project, right next to `Cargo.toml`.

```toml
api = "0.9"
api = "0.10"

[buildpack]
id = "libcnb-examples/my-buildpack"
version = "0.1.0"
name = "My Buildpack"

[[stacks]]
id = "*"
```

That's all we need! We can now move on to finally write some buildpack code!
Expand Down Expand Up @@ -132,7 +129,7 @@ impl Buildpack for HelloWorldBuildpack {
type Error = GenericError;
// This method will be called when the CNB lifecycle executes the detect phase (`bin/detect`).
// Use the `DetectContext` to access CNB data such as the stack this buildpack is currently
// Use the `DetectContext` to access CNB data such as the operating system this buildpack is currently
// executed on, the app directory and similar things. When using libcnb.rs, you never have
// to read environment variables or read/write files to disk to interact with the CNB lifecycle.
//
Expand All @@ -148,7 +145,7 @@ impl Buildpack for HelloWorldBuildpack {
// build phase (`bin/build`).
fn build(&self, context: BuildContext<Self>) -> libcnb::Result<BuildResult, Self::Error> {
println!("Hello World!");
println!("Build runs on stack {}!", context.stack_id);
println!("The build is running on: {} ({})!", context.target.os, context.target.arch);
BuildResultBuilder::new()
.launch(
Expand Down Expand Up @@ -218,7 +215,7 @@ libcnb-examples/my-buildpack 0.1.0
===> RESTORING
===> BUILDING
Hello World!
Build runs on stack heroku-22!
The build is running on: linux (amd64)!
===> EXPORTING
Adding layer 'buildpacksio/lifecycle:launch.sbom'
Adding 1/1 app layer(s)
Expand All @@ -230,7 +227,7 @@ Adding label 'io.buildpacks.build.metadata'
Adding label 'io.buildpacks.project.metadata'
Setting default process type 'web'
Saving my-image...
*** Images (aa4695184718):
*** Images (85b067fc926a):
my-image
Successfully built image my-image
```
Expand Down
5 changes: 1 addition & 4 deletions examples/basics/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
api = "0.9"
api = "0.10"

[buildpack]
id = "libcnb-examples/basics"
version = "0.1.0"
name = "Example libcnb buildpack: basics"

[[stacks]]
id = "*"
6 changes: 5 additions & 1 deletion examples/basics/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ impl Buildpack for BasicBuildpack {
}

fn build(&self, context: BuildContext<Self>) -> libcnb::Result<BuildResult, Self::Error> {
println!("Build runs on stack {}!", context.stack_id);
println!(
"The build is running on {} ({})!",
context.target.os, context.target.arch
);

BuildResultBuilder::new().build()
}
}
Expand Down
5 changes: 1 addition & 4 deletions examples/execd/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
api = "0.9"
api = "0.10"

[buildpack]
id = "libcnb-examples/execd"
version = "0.1.0"
name = "Example libcnb buildpack: execd"

[[stacks]]
id = "*"
6 changes: 3 additions & 3 deletions libcnb-cargo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ path = "src/main.rs"
workspace = true

[dependencies]
clap = { version = "4.4.11", default-features = false, features = [
clap = { version = "4.5.0", default-features = false, features = [
"derive",
"error-context",
"help",
Expand All @@ -29,8 +29,8 @@ clap = { version = "4.4.11", default-features = false, features = [
libcnb-data.workspace = true
libcnb-package.workspace = true
pathdiff = "0.2.1"
thiserror = "1.0.50"
thiserror = "1.0.57"

[dev-dependencies]
tempfile = "3.8.1"
tempfile = "3.10.0"
libcnb-common.workspace = true
2 changes: 1 addition & 1 deletion libcnb-cargo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ pack build my-image-name \

[Latest Version]: https://img.shields.io/crates/v/libcnb-cargo.svg
[crates.io]: https://crates.io/crates/libcnb-cargo
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.76+-lightgray.svg
[install-rust]: https://www.rust-lang.org/tools/install
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ api = "0.8"
[buildpack]
id = "multiple-buildpacks/not-libcnb"
version = "0.0.0"

[[stacks]]
id = "some-stack"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ api = "0.8"
[buildpack]
id = "multiple-buildpacks/one"
version = "0.0.0"

[[stacks]]
id = "some-stack"
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,3 @@ api = "0.8"
[buildpack]
id = "multiple-buildpacks/two"
version = "0.0.0"

[[stacks]]
id = "some-stack"
5 changes: 1 addition & 4 deletions libcnb-cargo/tests/fixtures/single_buildpack/buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
api = "0.8"
api = "0.10"

[buildpack]
id = "single-buildpack"
version = "0.0.0"

[[stacks]]
id = "some-stack"
4 changes: 2 additions & 2 deletions libcnb-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ include = ["src/**/*", "LICENSE", "README.md"]
workspace = true

[dependencies]
serde = { version = "1.0.193", features = ["derive"] }
thiserror = "1.0.50"
serde = { version = "1.0.196", features = ["derive"] }
thiserror = "1.0.57"
toml.workspace = true
2 changes: 1 addition & 1 deletion libcnb-common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ This is an internal crate and should not be used by users directly. There are no
[docs.rs]: https://docs.rs/libcnb-proc-macros/latest/libcnb_common/
[Latest Version]: https://img.shields.io/crates/v/libcnb-common.svg
[crates.io]: https://crates.io/crates/libcnb-common
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.76+-lightgray.svg
[install-rust]: https://www.rust-lang.org/tools/install
4 changes: 2 additions & 2 deletions libcnb-data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ workspace = true
[dependencies]
fancy-regex = { version = "0.13.0", default-features = false, features = ["std"] }
libcnb-proc-macros.workspace = true
serde = { version = "1.0.193", features = ["derive"] }
thiserror = "1.0.50"
serde = { version = "1.0.196", features = ["derive"] }
thiserror = "1.0.57"
toml.workspace = true
uriparse = "0.6.4"

Expand Down
2 changes: 1 addition & 1 deletion libcnb-data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ on this crate directly.
[docs.rs]: https://docs.rs/libcnb-data/latest/libcnb_data/
[Latest Version]: https://img.shields.io/crates/v/libcnb-data.svg
[crates.io]: https://crates.io/crates/libcnb-data
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.74+-lightgray.svg
[MSRV]: https://img.shields.io/badge/MSRV-rustc_1.76+-lightgray.svg
[install-rust]: https://www.rust-lang.org/tools/install
Loading

0 comments on commit fd2a647

Please sign in to comment.