-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(boil)!: Output structured data in boil-target-tags file #1598
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,3 +5,6 @@ target/ | |
|
|
||
| # Patchable working files | ||
| patchable-work/ | ||
|
|
||
| # Generated by boil | ||
| boil-target-tags.json | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,8 +17,11 @@ pub enum Error { | |||||
| #[snafu(display("failed to create bakefile"))] | ||||||
| CreateBakefile { source: bakefile::Error }, | ||||||
|
|
||||||
| #[snafu(display("failed to write image manifest URIs to file"))] | ||||||
| WriteImageManifestUrisFile { source: std::io::Error }, | ||||||
| #[snafu(display("failed to create image manifest URIs file"))] | ||||||
| CreateImageManifestUrisFile { source: std::io::Error }, | ||||||
|
|
||||||
| #[snafu(display("failed to serialize image manifest URIs file as JSON"))] | ||||||
| SerializeImageManifestUrisFile { source: serde_json::Error }, | ||||||
|
|
||||||
| #[snafu(display("failed to serialize bakefile as JSON"))] | ||||||
| SerializeBakefile { source: serde_json::Error }, | ||||||
|
|
@@ -51,8 +54,9 @@ pub fn run_command(args: Box<BuildArguments>, config: Config) -> Result<(), Erro | |||||
|
|
||||||
| // Write the image manifest URIs to file if requested | ||||||
| if let Some(path) = args.write_image_manifest_uris { | ||||||
| std::fs::write(path, image_manifest_uris.join("\n")) | ||||||
| .context(WriteImageManifestUrisFileSnafu)?; | ||||||
| let file = std::fs::File::create(path).context(CreateImageManifestUrisFileSnafu)?; | ||||||
| serde_json::to_writer(file, &image_manifest_uris) | ||||||
| .context(SerializeImageManifestUrisFileSnafu)?; | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would we not guarantee it can serialize? Or is there something that could make it fail at runtime?
Suggested change
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Have approved, will le you decide if you want do the above. |
||||||
| } | ||||||
|
|
||||||
| // Output the bakefile contents if in dry-run mode | ||||||
|
|
@@ -103,10 +107,17 @@ pub fn run_command(args: Box<BuildArguments>, config: Config) -> Result<(), Erro | |||||
| } | ||||||
| ); | ||||||
|
|
||||||
| println!( | ||||||
| "Successfully built {count} image{plural}:\n{images}", | ||||||
| // Take care of formatting output | ||||||
| let mut built_images = String::new(); | ||||||
| for (name, tags) in image_manifest_uris { | ||||||
| built_images.push_str(&format!("{name}:\n")); | ||||||
| built_images.push_str(&format!(" {tags}", tags = tags.join("\n "))); | ||||||
| built_images.push('\n'); | ||||||
| } | ||||||
|
|
||||||
| print!( | ||||||
| "Successfully built {count} image{plural}:\n{built_images}", | ||||||
| plural = if count > 1 { "s" } else { "" }, | ||||||
| images = image_manifest_uris.join("\n") | ||||||
| ); | ||||||
|
|
||||||
| Ok(()) | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.