-
Notifications
You must be signed in to change notification settings - Fork 582
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
many: expose component constraints from validation sets #14592
many: expose component constraints from validation sets #14592
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14592 +/- ##
==========================================
+ Coverage 78.95% 78.96% +0.01%
==========================================
Files 1084 1085 +1
Lines 146638 147146 +508
==========================================
+ Hits 115773 116192 +419
- Misses 23667 23725 +58
- Partials 7198 7229 +31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
6bbfc3b
to
3c91b0b
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.
I suggest the first commit here should be its own PR, thanks
407b591
to
ddb3518
Compare
ddb3518
to
16e7660
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.
lgtm, just one question
overlord/snapstate/target.go
Outdated
@@ -413,14 +414,12 @@ func completeStoreAction(action *store.SnapAction, revOpts RevisionOptions, igno | |||
|
|||
// if the caller didn't provide any validation sets, make sure that | |||
// the snap is allowed by all of the enforced validation sets | |||
invalidSets, err := vsets.CheckPresenceInvalid(naming.Snap(action.InstanceName)) | |||
pres, err := vsets.Presence(naming.Snap(action.InstanceName)) |
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.
Will this get the right presence if we use an instance name?
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.
Good catch, thank you. Seems this has been wrong.
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.
16e7660
to
92ef00b
Compare
This is now based on #14621, the validation sets changes will end up needing this new code. |
98183e9
to
dc522a9
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.
thank you
// TODO: figure out the best way to handle parallel installs and | ||
// validation sets. right now, we just ignore them. | ||
if isParallelInstall { | ||
return nil |
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.
Maybe it's worth logging something in case we hit this unexpectedly?
dc522a9
to
2ab0208
Compare
@pedronis this is ready for your review again. |
f922b67
to
7664aa9
Compare
…component's constraints
Co-authored-by: Miguel Pires <[email protected]>
7664aa9
to
28fe47e
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.
thank you, did a pass
|
||
// RequiredComponents returns a set of all of the components that are required | ||
// to be installed when this snap is installed. | ||
func (s *SnapPresence) RequiredComponents() map[string]presence { |
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.
it's strange to have a public method that has a return that uses an unexported type?
// The method assumes that validation sets are not in conflict. | ||
func (v *ValidationSets) CheckPresenceInvalid(snapRef naming.SnapRef) ([]ValidationSetKey, error) { | ||
cstrs := v.constraintsForSnap(snapRef) | ||
type presence struct { |
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.
wouldn't it be a bit clearer if this was exported?
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.
Yeah, probably. I was having a hard time naming it, since Presence technically already has a meaning.
…on that vsets must not be in conflict
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.
couple of naming suggestions
cstrs := v.constraintsForSnap(snapRef) | ||
// ContainerPresence represents the allowed presence of a snap or component with | ||
// respect to a set of validation sets that it was derived from. | ||
type ContainerPresence struct { |
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.
we have a PresenceConstraintError alread,y maybe this should be called PresenceContraint ?
|
||
// SnapPresence contains information about a snap's allowed presence with | ||
// respect to a set of validation sets. | ||
type SnapPresence struct { |
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.
SnapPresenceConstraint(s) ?
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.
Done, thanks.
…e-component-constraints
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.
thank you
asserts/snapasserts/export_test.go
Outdated
func NewSnapPresence(p ContainerPresence, comps map[string]ContainerPresence) SnapPresence { | ||
return SnapPresence{ | ||
ContainerPresence: p, | ||
func NewSnapPresence(p PresenceContraint, comps map[string]PresenceContraint) SnapPresenceConstraints { |
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.
should this also be renamed for consistency?
The arch failures are a known issue due to arch releasing the 6.12 over the weekend. A fix is being worked on. |
This refactor enables us to get component constraints out of snapasserts.ValidationSets. I also removed some of the old methods that can be replaced by these new ones.