Skip to content

Commit

Permalink
Post PR #88 Cleanup
Browse files Browse the repository at this point in the history
We can remove this fallback key for reading the repository to publish to now that the following PRs have been merged:

- heroku/buildpacks-go#124
- heroku/buildpacks-php#15
- heroku/buildpacks-ruby#184
- heroku/buildpacks-jvm#555
- heroku/buildpacks-nodejs#610
- heroku/buildpacks-python#58
- heroku/buildpacks-procfile#156
  • Loading branch information
colincasey committed Aug 3, 2023
1 parent fcfbb5b commit 091b665
Showing 1 changed file with 1 addition and 32 deletions.
33 changes: 1 addition & 32 deletions src/buildpacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,7 @@ pub(crate) fn read_image_repository_metadata(
metadata
.as_ref()
.and_then(|metadata| metadata.get("release").and_then(|value| value.as_table()))
.and_then(|release| {
release
.get("image")
// TODO: remove this once each buildpack.toml metadata is updated to
// replace [metadata.release.docker] with [metadata.release.image]
.or_else(|| release.get("docker"))
.and_then(|value| value.as_table())
})
.and_then(|release| release.get("image").and_then(|value| value.as_table()))
.and_then(|docker| docker.get("repository").and_then(|value| value.as_str()))
.map(|value| value.to_string())
}
Expand All @@ -64,30 +57,6 @@ mod test {
use libcnb_data::buildpack::BuildpackDescriptor;
use libcnb_package::GenericMetadata;

#[test]
fn test_read_image_repository_metadata_deprecated() {
let data = r#"
api = "0.9"
[buildpack]
id = "foo/bar"
version = "0.0.1"
[[stacks]]
id = "*"
[metadata.release.docker]
repository = "deprecated repository value"
"#;

let buildpack_descriptor =
toml::from_str::<BuildpackDescriptor<GenericMetadata>>(data).unwrap();
assert_eq!(
read_image_repository_metadata(&buildpack_descriptor),
Some("deprecated repository value".to_string())
);
}

#[test]
fn test_read_image_repository_metadata() {
let data = r#"
Expand Down

0 comments on commit 091b665

Please sign in to comment.