Skip to content

Outlier semver detection#20

Merged
marccampbell merged 2 commits into
masterfrom
no-semver
Mar 2, 2020
Merged

Outlier semver detection#20
marccampbell merged 2 commits into
masterfrom
no-semver

Conversation

@marccampbell
Copy link
Copy Markdown
Member

This fixes #19 but doesn't have a lot of error room.

Open to suggestions for better thresholds here.

The problem is summarized by: Elasticsearch has a lot of tags of their image (see list at the bottom of this message). It's very easy to split this into semver and non-semver. But what is that 43.0.0 doing? It's clearly not really semver, and it will always report as a false "newer" version. So this PR looks for Major version gaps and discards anything after a gap.

0.0.1
0.0.2
0.8.0-alpha4
0.8.0-alpha5
0.8.0-rc1
0.8.0-rc2
0.8.0-rc3
0.8.0-rc4
0.8.0-rc5
0.8.0-rc6
0.8.0
0.8.1-rc1
0.8.1-rc2
0.8.1
0.9.0-SNAPSHOT-apm
0.9.0-rc2
0.9.0-rc3
0.9.0-rc6
0.9.0-rc7
0.9.0
1.0.0-beta1-bc10
1.0.0-beta1-bc11
1.0.0-beta1-bc12
1.0.0-beta1-bc5
1.0.0-beta1-bc6
1.0.0-beta1-bc7
1.0.0-beta1-bc8
1.0.0-beta1-bc9
1.0.0-beta1
1.0.0-rc3
1.0.0-rc4
1.0.0-rc5
1.0.0-rc6
1.0.0
1.0.1-rc1
1.0.1-rc2
1.0.1
43.0.0
apm
test

Comment thread pkg/outdated/registry.go Outdated
// SemverOutlierMajorVersionThreshold defines the number of major versions that must be skipped before
// the next version is considered an outlier
// setting this to 1 allows NO major versions to be skipped
SemverOutlierMajorVersionThreshold = 1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should default to two
I know there are legitimate repos that have skipped a major version before

},
},
{
name: "no outliers",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not seem like a test case with no outliers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and in fact we don't have a no outliers test
so maybe add a test case that has major versions 1, 2, 3 and 4, with no outliers expected?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another thing to test - 1, 2, 5, 9
Are both 5&9 detected as outliers?

Similarly - 4, 5, 6
presumably there shouldn't be any outliers there

And if we know the current semver, we should use that as the start - so that if we're on version 5, we shouldn't report 6 as an outlier just because the total set of detected major versions was 1, 2, 5, 6, 7

Comment on lines +148 to +149
assert.Equal(t, test.expectedOutliers, actualOutliersStrings)
assert.Equal(t, test.expectedRemaining, actualRemainingStrings)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these should use req.Equal

but unimportant

Copy link
Copy Markdown
Contributor

@laverya laverya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks like a good most-of-the-way solution
I'm still worried about a situation where the currently installed version is part of an "outlier" range though

@marccampbell marccampbell merged commit bfd0d99 into master Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plugin gets confused when upstream has any tags not intended as semver

2 participants