cnabio / cnab-go

A Go implementation of CNAB Core 1.0
MIT License
69 stars 37 forks source link

Optionally save logs as output #243

Closed carolynvs closed 3 years ago

carolynvs commented 3 years ago

When action.SaveLogs is set, a copy of the invocation image logs are saved as an output named io.cnab.outputs.invocationImageLogs. The logs are copied as they are written to a logfile, which after the bundle completes, are saved as an output when the claim result is saved.

CNAB tools control if logs are saved or not, defaulting to false.

This is very useful for "remote" bundle execution, like when it's run by the kubernetes driver. The user can see the logs from a run without having to figure out which pod to log, and its stored with the other installation data.

This PR also fixes a bug in the FileSystemStore where listing outputs was not returning any outputs with a period in the name.

carolynvs commented 3 years ago

I found a bug with how the filesytem store lists outputs. You wouldn't have noticed unless you were working with an output with a period in the name. So this PR works but if you are using filesystem store, then there's a bug. I'm fixing now.

carolynvs commented 3 years ago

@vdice Can you take one more look? I just fixed that bug in FileSystemStore. Seemed like it should be fixed here since without it, when you list outputs on the filesystem, it was missing the logs.

carolynvs commented 3 years ago

Oh my goodness, sorry one more fix for this FileSystemStore bug. 🤦‍♀️

carolynvs commented 3 years ago

Sorry about that, there were a few changes needed to the test and FileSystemStore so that when you list outputs, you get the original filenames. For example, if I save an output named "users.json", when I list outputs, I should see "users.json" as the output name.