Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pkg/cincinnati/cincinnati.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ func (c Client) GetUpdates(ctx context.Context, uri *url.URL, arch string, chann
if len(conditionalUpdates[i].Risks[j].MatchingRules) == 0 {
klog.Warningf("Conditional update to %s, risk %q, has empty pruned matchingRules; dropping this target to avoid rejections when pushing to the Kubernetes API server. Pruning results: %s", conditionalUpdates[i].Release.Version, risk.Name, err)
conditionalUpdates = append(conditionalUpdates[:i], conditionalUpdates[i+1:]...)
break
} else if err != nil {
klog.Warningf("Conditional update to %s, risk %q, has pruned matchingRules (although other valid, recognized matchingRules were given, and are sufficient to keep the conditional update): %s", conditionalUpdates[i].Release.Version, risk.Name, err)
}
Expand Down
57 changes: 57 additions & 0 deletions pkg/cincinnati/cincinnati_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,63 @@ func TestGetUpdates(t *testing.T) {
]
}
]
}`,
expectedQuery: "arch=test-arch&channel=test-channel&id=01234567-0123-0123-0123-0123456789ab&version=4.1.0",
current: configv1.Release{
Version: "4.1.0",
Image: "quay.io/openshift-release-dev/ocp-release:4.1.0",
URL: "https://example.com/errata/4.1.0",
Channels: []string{"channel-a", "test-channel"},
},
}, {
name: "condition with risks after invalid risk",
version: "4.1.0",
graph: `{
"nodes": [
{
"version": "4.1.0",
"payload": "quay.io/openshift-release-dev/ocp-release:4.1.0",
"metadata": {
"url": "https://example.com/errata/4.1.0",
"io.openshift.upgrades.graph.release.channels": "test-channel,channel-a"
}
},
{
"version": "4.1.1",
"payload": "quay.io/openshift-release-dev/ocp-release:4.1.1",
"metadata": {
"url": "https://example.com/errata/4.1.1",
"io.openshift.upgrades.graph.release.channels": "test-channel"
}
}
],
"conditionalEdges": [
{
"edges": [{"from": "4.1.0", "to": "4.1.1"}],
"risks": [
{
"url": "https://example.com/bug/123",
"name": "BugA",
"message": "This risk has no recognized rules, and so the conditional update to 4.1.1 will be dropped to avoid rejections when pushing to the Kubernetes API server.",
"matchingRules": [
{
"type": "does-not-exist"
}
]
},
{
"url": "https://example.com/bug/456",
"name": "BugB",
"message": "All 4.1.0 clusters are incompatible with 4.1.1.",
"matchingRules": [
{
"type": "Always"
}
]
}
]
}
]
}`,
expectedQuery: "arch=test-arch&channel=test-channel&id=01234567-0123-0123-0123-0123456789ab&version=4.1.0",
current: configv1.Release{
Expand Down