forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci] Add debian-12 to matrix in packaging and platform jobs (elastic#…
…116172) Lintian test has been changed to parse the result instead of using exit code. This was required, because now `mismatched-override` is non-erasable tag which cannot be ignored for exit code. Lintian introduced non-backward-compatible format change for overrides file. Because of that, some overrides are now duplicated in a format for older versions. Additionally, Lintian overrides file has been cleaned up to remove the tags which are no longer failing.
- Loading branch information
Showing
8 changed files
with
122 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ steps: | |
setup: | ||
image: | ||
- debian-11 | ||
- debian-12 | ||
- opensuse-leap-15 | ||
- oraclelinux-7 | ||
- oraclelinux-8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ steps: | |
setup: | ||
image: | ||
- debian-11 | ||
- debian-12 | ||
- opensuse-leap-15 | ||
- oraclelinux-7 | ||
- oraclelinux-8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ steps: | |
setup: | ||
image: | ||
- debian-11 | ||
- debian-12 | ||
- opensuse-leap-15 | ||
- oraclelinux-7 | ||
- oraclelinux-8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
qa/packaging/src/test/java/org/elasticsearch/packaging/util/LintianResultParser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
package org.elasticsearch.packaging.util; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.regex.Matcher; | ||
import java.util.regex.Pattern; | ||
|
||
public class LintianResultParser { | ||
|
||
private static final Logger logger = LogManager.getLogger(LintianResultParser.class); | ||
private static final Pattern RESULT_PATTERN = Pattern.compile("(?<severity>[EW]): (?<package>\\S+): (?<tag>\\S+) (?<message>.+)"); | ||
|
||
public Result parse(String output) { | ||
String[] lines = output.split("\n"); | ||
List<Issue> issues = Arrays.stream(lines).map(line -> { | ||
Matcher matcher = RESULT_PATTERN.matcher(line); | ||
if (matcher.matches() == false) { | ||
logger.info("Lintian output not matching expected pattern: {}", line); | ||
return null; | ||
} | ||
Severity severity = switch (matcher.group("severity")) { | ||
case "E" -> Severity.ERROR; | ||
case "W" -> Severity.WARNING; | ||
default -> Severity.UNKNOWN; | ||
}; | ||
return new Issue(severity, matcher.group("tag"), matcher.group("message")); | ||
}).filter(Objects::nonNull).toList(); | ||
|
||
return new Result(issues.stream().noneMatch(it -> it.severity == Severity.ERROR || it.severity == Severity.WARNING), issues); | ||
} | ||
|
||
public record Result(boolean isSuccess, List<Issue> issues) {} | ||
|
||
public record Issue(Severity severity, String tag, String message) {} | ||
|
||
enum Severity { | ||
ERROR, | ||
WARNING, | ||
UNKNOWN | ||
} | ||
} |