-
Notifications
You must be signed in to change notification settings - Fork 47
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
🌱 don't consider bundle deprecated if the package is deprecated #577
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 |
---|---|---|
|
@@ -229,3 +229,55 @@ func TestBundleHasDeprecation(t *testing.T) { | |
}) | ||
} | ||
} | ||
|
||
func TestBundleIsDeprecated(t *testing.T) { | ||
for _, tt := range []struct { | ||
name string | ||
bundle *catalogmetadata.Bundle | ||
deprecated bool | ||
}{ | ||
{ | ||
name: "has package and channel deprecations, not deprecated", | ||
bundle: &catalogmetadata.Bundle{ | ||
Deprecations: []declcfg.DeprecationEntry{ | ||
{ | ||
Reference: declcfg.PackageScopedReference{ | ||
Schema: "olm.package", | ||
}, | ||
}, | ||
{ | ||
Reference: declcfg.PackageScopedReference{ | ||
Schema: "olm.channel", | ||
Name: "foo", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "has no deprecation entries, not deprecated", | ||
bundle: &catalogmetadata.Bundle{}, | ||
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. Possibly a silly question: Does this If it is handled in a separate data strucutre, could we change package catalogmetadata
type Bundle struct {
...
deprecated bool
}
It seems unnecessary to store a list of 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.
Correct.
Not handled in a separate data structure at the moment as the catalogmetadata.Bundle type is what is used to determine everything after resolution. 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. I think this question is related to #577 (comment) |
||
}, | ||
{ | ||
name: "has bundle deprecation entry, deprecated", | ||
bundle: &catalogmetadata.Bundle{ | ||
Bundle: declcfg.Bundle{ | ||
Name: "foo", | ||
}, | ||
Deprecations: []declcfg.DeprecationEntry{ | ||
{ | ||
Reference: declcfg.PackageScopedReference{ | ||
Schema: "olm.bundle", | ||
Name: "foo", | ||
}, | ||
}, | ||
}, | ||
}, | ||
deprecated: true, | ||
}, | ||
} { | ||
t.Run(tt.name, func(t *testing.T) { | ||
assert.Equal(t, tt.deprecated, tt.bundle.IsDeprecated()) | ||
}) | ||
} | ||
} |
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.
Removing this will actually mean that explicitly deprecated bundles will be preferred less than ones that aren't even if the entire package is deprecated - fixing
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.
Looking at this a little closer (sorry I didn't get the chance with the original PR), I'm a little concerned that we're putting package and channel level deprecations in the
Bundle
type.I think I would have expected that we would put the package deprecation in the
Package
type, channel deprecation in theChannel
type and bundle deprecation in theBundle
type.And if we had that, we could use composition by embedding the deprecation type in each of the package/channel/bundle types and then use a shared
IsDeprecated
function that comes with that deprecation type.Is it possible to do something like this?
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.
Probably, but my concern with doing that is that we would likely need to restructure resolution to provide all those types as results from the resolution. IIUC the resolution process currently will only return the
Bundle
type that contains all the necessary information for continuing with the install/upgrade process.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.
Restructuring resolution to return variables for
Package
,Channel
, andBundle
types is out of scope for this work IMOThere 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.
One other question about this point. Think about this scenario:
foo
is deprecatedfoo.v1.0.0
is not deprecatedfoo.v1.0.1
is deprecatedI would expect
foo.v1.0.0
to be preferred overfoo.v1.0.1
. Thepackage
deprecation should not cascade to the bundles one way or the other.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 okay. I was under the impression that in that scenario
foo.v1.0.1
would still be preferred overfoo.v1.0.0
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.
6fdc060 - reverts to where the check is removed and should satisfy the expectation you have.
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.
@joelanford Could you take another look when you have some time?