-
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
Rewrite Claims to support updated spec #212
Rewrite Claims to support updated spec #212
Conversation
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.
PR still in draft, but noted a few items, all minor. This is looking really good!
df6fff0
to
4d7c9e0
Compare
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.
All of my initial review comments have been addressed. Thank you! However, I remembered we are still skipping the claim schema test. Should we unskip and update in this PR? Or relegate to a follow-up?
Whooooooo! I unskipped the test AND IT PASSED! The ultimate validation. 😀 Thanks for remembering that it was skipped. |
Split result into separate struct where claim contains an action's input and the result contains the results (status, outputs, etc) of the operation. Since each action has all the same logic, and they were also copying each other, including tests, I consolidate that into a single function that they all share. * encryption in claim store * run doesn't modify claim * switch cred.bundle to value * Operation.Outputs map[PATH]NAME so that the operation knows which outputs to grab, but from then on in the operation result we can just deal with the output name * Don't make each driver deal with output defaults, have that be something that the runtime implementation (action) handles after the driver is executed. Signed-off-by: Carolyn Van Slyck <[email protected]>
* Make fields that aren't always set unexported, e.g. Result.claim, so that people don't accidently use them inappropriately. * Remove todos that were turned into issues * Move retrieval of most recent output values from installation to the claim store. * Add more claim store unit tests * Fix docker integration test Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
Check errors using contains not direct comparisons so that it can deal with wrapped errors. Signed-off-by: Carolyn Van Slyck <[email protected]>
Signed-off-by: Carolyn Van Slyck <[email protected]>
676b539
to
1f6d106
Compare
Rebased with changes from #211 that just merged. |
Use pointers to manage optionality of some fields on Result and Claim to indicate that they may not always be set and must be nil checked before assuming that they are safe to use, or assume that the length is meaningful. Signed-off-by: Carolyn Van Slyck <[email protected]>
) | ||
|
||
// Install the bundle and only record the success/failure of the operation. | ||
func Example_install() { |
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.
nit: I think we've used Example_Install
as convention for tests before (looking at, for example, TestClaim_Validate
).
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.
Oh yeah so I really wanted to name it that too, but then it doesn't show up in the godoc! 😅 It only shows up when lower-cased. I'm not sure why but that's why I named the whole file examples that way.
In the "doc" for godoc, they tell you to look at the sort package and that's what they do there too
https://blog.golang.org/examples
https://golang.org/src/sort/example_keys_test.go
If you know how to get it working with upper-case, let me know!
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.
Have we tried ExampleInstall
?
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.
Yup! godoc doesn't like that either 🤷♀️
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.
This has so many great changes, thanks a LOT for the work you put into this!
I have a few very small comments, but otherwise LGTM.
Signed-off-by: Carolyn Van Slyck <[email protected]>
} | ||
|
||
// Run executes the operation on the Debug driver | ||
func (d *Driver) Run(op *driver.Operation) (driver.OperationResult, error) { |
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.
Can we pass a context object as well to handle things like deadlines/cancellation/tracing?
func (d *Driver) Run(op *driver.Operation) (driver.OperationResult, error) { | |
func (d *Driver) Run(ctx context.Context, op *driver.Operation) (driver.OperationResult, error) { |
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 started making this change here, but I think it would be better in a second PR so we can really look over the changes to implementing the context handling in the drivers in isolation. I'll merge this then immediately open up the PR with my changes and tests so far and we can see what else needs to be done.
f68a445
to
5624fb7
Compare
Signed-off-by: Carolyn Van Slyck <[email protected]>
5624fb7
to
f33d0f8
Compare
This is basically a rewrite, sorry. It updates our claims implementation to support the changes to the claims spec per cnab-claim-1.0.0-DRAFT+b5ed2f3
I apologize that this is a monolith PR. I found it impossible to break up due to the nature of the changes to the spec and how it impacted the codebase.
This is not an exhaustive list of changes, see the spec for that but here are the major changes:
crud.Store
and its implementations had to change it's API to support this, and querying by a "tag" or "foreign key" so that we could look for records by its key (e.g. claim id) or find all records by the "foreign key" such as installation name. While also supporting data types like credentials that do not need this.The solution caters to the lowest common denominator, filesystem, and in the future we could introduce interfaces to help declare that an implementation supports querying (basically any other storage type like mongo or a real database).
Action
without an interface since it wasn't being used. Action now has support for working with claims to help coordinate properly persisting them, especially when errors occur.🚨 Based on PR #211, will need to rebase when that merges.