Skip to content

Commit

Permalink
Merge branch 'w/2.8/bugfix/ZENKO-4869' into w/2.9/bugfix/ZENKO-4869
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisferrand committed Aug 7, 2024
2 parents e715eee + af1868c commit 1f91149
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/scripts/get-previous-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ function getPreviousTag(version, allReleases) {
// Find the latest release with the same prefix
previous_tags = allReleases.filter(r => r.tag_name.startsWith(version));
if (previous_tags.length > 0) {
return previous_tags.sort().reverse()[0].tag_name;
// Use a custom sort function, to ensure 'natural' sort of numeric parts
const compare = new Intl.Collator(undefined, { numeric: true }).compare;
return previous_tags.sort(
(a, b) => compare(a.tag_name, b.tag_name)
).reverse()[0].tag_name;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion solution/kafka-connect/kafka-connect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ rules:

#kafka.producer:type=producer-topic-metrics,client-id="{clientid}",topic="{topic}"", partition="{partition}"
#kafka.consumer:type=consumer-fetch-manager-metrics,client-id="{clientid}",topic="{topic}"", partition="{partition}"
- pattern: kafka.(.+)<type=(.+)-metrics, client-id=(.+), topic=(.+), partition=(.+)><>(.+-total|.+-rate|.+-avg|.+-replica|.+-lag|.+-lead)
- pattern: kafka.(.+)<type=(.+)-metrics, client-id=(.+), topic=(.+), partition=(.+)><>(.+-total|.+-rate|.+-avg|.+-max|.+-min|.+-replica|.+-lag|.+-lead)
name: kafka_$2_$6
labels:
clientId: "$3"
Expand Down
19 changes: 19 additions & 0 deletions tests/workflows/getPreviousTag.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@ it('should return the previous tag', async () => {
expect(tag).toBe("1.2.0");
});

it('should return the previous tag out of order', async () => {
const tag = getPreviousTag("1.2.1", [
{ tag_name: "1.1.2" }, { tag_name: "1.2.0" }, { tag_name: "1.1.1" },
{ tag_name: "1.1.0" }, { tag_name: "1.3.0" }
]);
expect(tag).toBe("1.2.0");
});

it('should return previous tag when > 10', async () => {
const tag = getPreviousTag("1.1.12", [
{ tag_name: "1.1.0" }, { tag_name: "1.1.1" }, { tag_name: "1.1.2" },
{ tag_name: "1.1.3" }, { tag_name: "1.1.4" }, { tag_name: "1.1.5" },
{ tag_name: "1.1.6" }, { tag_name: "1.1.7" }, { tag_name: "1.1.8" },
{ tag_name: "1.1.9" }, { tag_name: "1.1.10" }, { tag_name: "1.1.11" },
{ tag_name: "1.2.0" }, { tag_name: "1.3.0" }
]);
expect(tag).toBe("1.1.11");
});

it('should return the previous rc tag', async () => {
const tag = getPreviousTag("1.2.1-rc.2", [
{ tag_name: "1.1.0" }, { tag_name: "1.1.1" }, { tag_name: "1.1.2-rc.1" },
Expand Down
1 change: 1 addition & 0 deletions tests/workflows/release.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ test.each([

const result = await act.runEvent("workflow_dispatch", {
logFile: process.env.ACT_LOG ? "act-release-"+expect.getState().currentTestName+".log" : undefined,
verbose: process.env.ACT_VERBOSE ? true : false,
mockApi: [
// Mock artifact promotion: copy, retrieve workflow run and set index
mockapi.mock.artifacts.root
Expand Down

0 comments on commit 1f91149

Please sign in to comment.