-
Notifications
You must be signed in to change notification settings - Fork 39
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
Optionally save logs as output #243
Conversation
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. Signed-off-by: Carolyn Van Slyck <[email protected]>
If an output was generated that isn't defined in the bundle, e.g. the driver or tool added the output, then do not throw an error when it is read. When reading through the claimstore only sensitive values are encrypted, so if it doesn't have a definition, it was stored without being encrypted. Signed-off-by: Carolyn Van Slyck <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
claim/result_test.go
Outdated
}) | ||
|
||
t.Run("output has no digest", func(t *testing.T) { | ||
t.Run("output has no meatdata", func(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is an easter egg for PR reviewers 🥩 and I almost don't want to change it buuut... s/meatdata/metadata
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pro meatdata
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. |
When listing documents in FileSystemStore with the file extension filter set to "", any document with an extension was being filtered out. This causes problems when an output (which doesn't require an extension) has a period in the name, such as the logs output, or mydata.json. I'v changed the logic so that when no filter is set for the file extension, we return all files in the directory. Signed-off-by: Carolyn Van Slyck <[email protected]>
@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. |
Oh my goodness, sorry one more fix for this FileSystemStore bug. 🤦♀️ |
The FileSystemStore was removing the file extension from output names but outputs can be generated with file extensions. So when there isn't a file extension filter specified for an item, such as outputs, leave the file extension as-is. We will still remove the .json extension for documents such as claims. Signed-off-by: Carolyn Van Slyck <[email protected]>
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. |
I can't spell but we shall miss you meatdata... Signed-off-by: Carolyn Van Slyck <[email protected]>
* Optionally save logs as output 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. Signed-off-by: Carolyn Van Slyck <[email protected]> * Handle reading undefined outputs If an output was generated that isn't defined in the bundle, e.g. the driver or tool added the output, then do not throw an error when it is read. When reading through the claimstore only sensitive values are encrypted, so if it doesn't have a definition, it was stored without being encrypted. Signed-off-by: Carolyn Van Slyck <[email protected]> * Fix empty file extension bug in FileSystemStore When listing documents in FileSystemStore with the file extension filter set to "", any document with an extension was being filtered out. This causes problems when an output (which doesn't require an extension) has a period in the name, such as the logs output, or mydata.json. I'v changed the logic so that when no filter is set for the file extension, we return all files in the directory. Signed-off-by: Carolyn Van Slyck <[email protected]> * Do not remove file extension from output names The FileSystemStore was removing the file extension from output names but outputs can be generated with file extensions. So when there isn't a file extension filter specified for an item, such as outputs, leave the file extension as-is. We will still remove the .json extension for documents such as claims. Signed-off-by: Carolyn Van Slyck <[email protected]> * Fix meatdata I can't spell but we shall miss you meatdata... Signed-off-by: Carolyn Van Slyck <[email protected]>
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.