@@ -10,95 +10,18 @@ import (
1010)
1111
1212// nextBestGuessers is the order in which to attempt to lookup other alternative matches that are close to this job type.
13- // TODO building a cross multiply would likely be beneficial
1413var nextBestGuessers = []NextBestKey {
15- MicroReleaseUpgrade ,
16- // MinorReleaseUpgrade,
14+ // The only guesser we try not is falling back to previous release. Otherwise if we don't have enough data, we don't
15+ // run the test. This was implemented after finding that we fail every attempt at a fallback.
16+ // Continuing with previous release helps us in the transition between major releases, so we kept this fallback.
1717 PreviousReleaseUpgrade ,
18-
19- combine (PreviousReleaseUpgrade , MicroReleaseUpgrade ),
20- // combine(PreviousReleaseUpgrade, MinorReleaseUpgrade),
21-
22- OnArchitecture ("amd64" ),
23- OnArchitecture ("ppc64le" ),
24- OnArchitecture ("s390x" ),
25- OnArchitecture ("arm64" ),
26-
27- combine (OnArchitecture ("amd64" ), MicroReleaseUpgrade ),
28- combine (OnArchitecture ("ppc64le" ), MicroReleaseUpgrade ),
29- combine (OnArchitecture ("s390x" ), MicroReleaseUpgrade ),
30- combine (OnArchitecture ("arm64" ), MicroReleaseUpgrade ),
31-
32- // combine(OnArchitecture("amd64"), MinorReleaseUpgrade),
33- // combine(OnArchitecture("ppc64le"), MinorReleaseUpgrade),
34- // combine(OnArchitecture("s390x"), MinorReleaseUpgrade),
35- // combine(OnArchitecture("arm64"), MinorReleaseUpgrade),
36-
37- combine (OnArchitecture ("amd64" ), PreviousReleaseUpgrade ),
38- combine (OnArchitecture ("ppc64le" ), PreviousReleaseUpgrade ),
39- combine (OnArchitecture ("s390x" ), PreviousReleaseUpgrade ),
40- combine (OnArchitecture ("arm64" ), PreviousReleaseUpgrade ),
41-
42- combine (OnArchitecture ("amd64" ), PreviousReleaseUpgrade , MicroReleaseUpgrade ),
43- combine (OnArchitecture ("ppc64le" ), PreviousReleaseUpgrade , MicroReleaseUpgrade ),
44- combine (OnArchitecture ("s390x" ), PreviousReleaseUpgrade , MicroReleaseUpgrade ),
45- combine (OnArchitecture ("arm64" ), PreviousReleaseUpgrade , MicroReleaseUpgrade ),
46-
47- // combine(OnArchitecture("amd64"), PreviousReleaseUpgrade, MinorReleaseUpgrade),
48- // combine(OnArchitecture("ppc64le"), PreviousReleaseUpgrade, MinorReleaseUpgrade),
49- // combine(OnArchitecture("s390x"), PreviousReleaseUpgrade, MinorReleaseUpgrade),
50- // combine(OnArchitecture("arm64"), PreviousReleaseUpgrade, MinorReleaseUpgrade),
51-
52- combine (ForTopology ("single" ), OnSDN ),
53- combine (ForTopology ("single" ), OnSDN , PreviousReleaseUpgrade ),
54- combine (ForTopology ("single" ), OnSDN , PreviousReleaseUpgrade , MicroReleaseUpgrade ),
5518}
5619
5720// NextBestKey returns the next best key in the query_results.json generated from BigQuery and a bool indicating whether this guesser has an opinion.
5821// If the bool is false, the key should not be used.
5922// Returning true doesn't mean the key exists, it just means that the key is worth trying.
6023type NextBestKey func (in platformidentification.JobType ) (platformidentification.JobType , bool )
6124
62- // MinorReleaseUpgrade if we don't have data for the current fromRelease and it's a micro upgrade, perhaps we have data
63- // for a minor upgrade. A 4.11 to 4.11 upgrade will attempt a 4.10 to 4.11 upgrade.
64- func MinorReleaseUpgrade (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
65- if len (in .FromRelease ) == 0 {
66- return platformidentification.JobType {}, false
67- }
68-
69- fromReleaseMinor := getMinor (in .FromRelease )
70- toReleaseMajor := getMajor (in .Release )
71- toReleaseMinor := getMinor (in .Release )
72- // if we're already a minor upgrade, this doesn't apply
73- if fromReleaseMinor == (toReleaseMinor - 1 ) {
74- return platformidentification.JobType {}, false
75- }
76-
77- ret := platformidentification .CloneJobType (in )
78- ret .FromRelease = fmt .Sprintf ("%d.%d" , toReleaseMajor , toReleaseMinor - 1 )
79- return ret , true
80- }
81-
82- // MicroReleaseUpgrade if we don't have data for the current fromRelease and it's a minor upgrade, perhaps we have data
83- // for a micro upgrade. A 4.10 to 4.11 upgrade will attempt a 4.11 to 4.11 upgrade.
84- func MicroReleaseUpgrade (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
85- if len (in .FromRelease ) == 0 {
86- return platformidentification.JobType {}, false
87- }
88-
89- fromReleaseMinor := getMinor (in .FromRelease )
90- toReleaseMajor := getMajor (in .Release )
91- toReleaseMinor := getMinor (in .Release )
92- // if we're already a micro upgrade, this doesn't apply
93- if fromReleaseMinor == toReleaseMinor {
94- return platformidentification.JobType {}, false
95- }
96-
97- ret := platformidentification .CloneJobType (in )
98- ret .FromRelease = fmt .Sprintf ("%d.%d" , toReleaseMajor , toReleaseMinor )
99- return ret , true
100- }
101-
10225// PreviousReleaseUpgrade if we don't have data for the current toRelease, perhaps we have data for the congruent test
10326// on the prior release. A 4.11 to 4.11 upgrade will attempt a 4.10 to 4.10 upgrade. A 4.11 no upgrade, will attempt a 4.10 no upgrade.
10427func PreviousReleaseUpgrade (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
@@ -130,68 +53,6 @@ func getMinor(in string) int {
13053 return int (minor )
13154}
13255
133- // OnOVN maybe we have data on OVN
134- func OnOVN (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
135- if in .Network == "ovn" {
136- return platformidentification.JobType {}, false
137- }
138-
139- ret := platformidentification .CloneJobType (in )
140- ret .Network = "ovn"
141- return ret , true
142- }
143-
144- // OnSDN maybe we have data on SDN
145- func OnSDN (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
146- if in .Network == "sdn" {
147- return platformidentification.JobType {}, false
148- }
149-
150- ret := platformidentification .CloneJobType (in )
151- ret .Network = "sdn"
152- return ret , true
153- }
154-
155- // OnArchitecture maybe we match a different architecture
156- func OnArchitecture (architecture string ) func (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
157- return func (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
158- if in .Architecture == architecture {
159- return platformidentification.JobType {}, false
160- }
161-
162- ret := platformidentification .CloneJobType (in )
163- ret .Architecture = architecture
164- return ret , true
165- }
166- }
167-
168- // ForTopology we match on exact topology
169- func ForTopology (topology string ) func (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
170- return func (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
171- if in .Topology != topology {
172- return platformidentification.JobType {}, false
173- }
174- return in , true
175- }
176- }
177-
178- // combine will start with the input and call each guess in order. It uses the output of the previous NextBestKeyFn
179- // as the input to the next. This allows combinations like "previous release upgrade micro" without writing custom
180- // functions for each.
181- func combine (nextBestKeys ... NextBestKey ) NextBestKey {
182- return func (in platformidentification.JobType ) (platformidentification.JobType , bool ) {
183- curr := in
184- for _ , nextBestKey := range nextBestKeys {
185- var ok bool
186- curr , ok = nextBestKey (curr )
187- if ! ok {
188- return curr , false
189- }
190- }
191- return curr , true
192- }
193- }
194-
19556func CurrentReleaseFromMap (releasesInQueryResults map [string ]bool ) string {
19657 var releaseSlice []struct {
19758 Key string
0 commit comments