Skip to content

Commit

Permalink
[CHECKER] add stale releases
Browse files Browse the repository at this point in the history
  • Loading branch information
chia7712 committed Jan 4, 2025
1 parent 02d1b29 commit 44a389f
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 33 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/org/astraea/app/checker/Changelog.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.astraea.app.checker;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
Expand All @@ -24,6 +25,7 @@
public class Changelog {
private List<Protocol> protocols;
private List<Config> configs;
private List<String> stale_releases;

public Map<String, Protocol> protocols() {
return protocols.stream().collect(Collectors.toMap(Protocol::name, Function.identity()));
Expand All @@ -32,4 +34,8 @@ public Map<String, Protocol> protocols() {
public Map<String, Config> configs() {
return configs.stream().collect(Collectors.toMap(Config::name, Function.identity()));
}

public List<String> staleReleases() {
return Collections.unmodifiableList(stale_releases);
}
}
30 changes: 30 additions & 0 deletions app/src/main/java/org/astraea/app/checker/Release.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.astraea.app.checker;

public class Release {
private String name;
private boolean supported;

public String name() {
return name;
}

public boolean supported() {
return supported;
}
}
34 changes: 1 addition & 33 deletions app/src/main/java/org/astraea/app/checker/VersionGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.astraea.app.checker;

import java.util.Collection;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.kafka.clients.admin.Admin;
Expand All @@ -27,37 +26,6 @@
import org.astraea.common.metrics.broker.ServerMetrics;

public class VersionGuard implements Guard {
private static final Set<String> UNSUPPORTED_VERSIONS =
Set.of(
"0.7.0",
"0.7.1",
"0.7.2",
"0.8.0",
"0.8.1",
"0.8.1.1",
"0.8.2-beta",
"0.8.2.1",
"0.8.2.2",
"0.9.0.0",
"0.9.0.1",
"0.10.0.0",
"0.10.0.1",
"0.10.1.0",
"0.10.1.1",
"0.10.2.0",
"0.10.2.1",
"0.10.2.2",
"0.11.0.0",
"0.11.0.1",
"0.11.0.2",
"0.11.0.3",
"1.0.0",
"1.0.1",
"1.0.2",
"1.1.0",
"1.1.1",
"2.0.0",
"2.0.1");

@Override
public Collection<Report> run(
Expand All @@ -68,7 +36,7 @@ public Collection<Report> run(
var vs =
ServerMetrics.appInfo(clients.apply(node)).stream()
.map(AppInfo::version)
.filter(UNSUPPORTED_VERSIONS::contains)
.filter(v -> changelog.staleReleases().contains(v))
.collect(Collectors.toSet());
if (vs.isEmpty()) return Report.empty();
return Report.of(
Expand Down
31 changes: 31 additions & 0 deletions config/kafka_changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,5 +129,36 @@
"commit": "https://github.com/apache/kafka/commit/3161115adae4de9f2b2ec6b87462ea10a8993456",
"kip": "https://cwiki.apache.org/confluence/display/KAFKA/KIP-500%3A+Replace+ZooKeeper+with+a+Self-Managed+Metadata+Quorum"
}
],
"stale_releases": [
"0.7.0",
"0.7.1",
"0.7.2",
"0.8.0",
"0.8.1",
"0.8.1.1",
"0.8.2-beta",
"0.8.2.1",
"0.8.2.2",
"0.9.0.0",
"0.9.0.1",
"0.10.0.0",
"0.10.0.1",
"0.10.1.0",
"0.10.1.1",
"0.10.2.0",
"0.10.2.1",
"0.10.2.2",
"0.11.0.0",
"0.11.0.1",
"0.11.0.2",
"0.11.0.3",
"1.0.0",
"1.0.1",
"1.0.2",
"1.1.0",
"1.1.1",
"2.0.0",
"2.0.1"
]
}

0 comments on commit 44a389f

Please sign in to comment.