Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

add LTS Docker tag to releases (#77885)

Chris Vandoodewaard024244e68e67
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6c08f26547b..25a90413060 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -138,19 +138,45 @@ jobs:
- name: Check JAR version properties
run: |
# ensure actual jar checksum matches checksum file
- grep -q $(sha256sum ./metabase.jar) SHA256.sum && echo "checksums match" || (echo "checksum mismatch" && exit 1)
+ jar_checksum=$(sha256sum ./metabase.jar | cut -d ' ' -f 1)
+ if grep -q "$jar_checksum" SHA256.sum; then
+ echo "checksums match"
+ else
+ echo "checksum mismatch"
+ exit 1
+ fi
# ensure stored commit-id file matches input commit
- grep -q ${{ inputs.commit }} COMMIT-ID && echo "commit ids match" || (echo "commit-id mismatch" && exit 1)
+ if grep -q "${{ inputs.commit }}" COMMIT-ID; then
+ echo "commit ids match"
+ else
+ echo "commit-id mismatch"
+ exit 1
+ fi
# ensure version.properties partial commit matches commit input
- grep -q $(cut -c 1-7 <<< ${{ inputs.commit }}) version.properties && echo "version.properties commit matches" || (echo "version.properties commit mismatch" && exit 1)
+ if grep -q "$(cut -c 1-7 <<< '${{ inputs.commit }}')" version.properties; then
+ echo "version.properties commit matches"
+ else
+ echo "version.properties commit mismatch"
+ exit 1
+ fi
# ensure version.properties version number matches input version (without v0/v1 to make it ee/oss agnostic)
- grep -q $(cut -c 3-99 <<< ${{ inputs.version }}) version.properties && echo "version.properties version number matches" || (echo "version.properties version number mismatch" && exit 1)
+ if grep -q "$(cut -c 3-99 <<< '${{ inputs.version }}')" version.properties; then
+ echo "version.properties version number matches"
+ else
+ echo "version.properties version number mismatch"
+ exit 1
+ fi
# ensure the build is not a snapshot build
- grep -q "SNAPSHOT" version.properties && (echo "jar is a snapshot" && exit 1) || echo "jar is not a snapshot build"
+ if grep -q "SNAPSHOT" version.properties; then
+ echo "jar is a snapshot"
+ exit 1
+ else
+ echo "jar is not a snapshot build"
+ fi
- name: Upload Uberjar as artifact
uses: actions/upload-artifact@v7
with:
@@ -244,7 +270,7 @@ jobs:
run:
curl -L http://${{ vars.AWS_S3_DOWNLOADS_BUCKET }}.s3.${{ vars.AWS_REGION }}.amazonaws.com/${{ steps.version_path.outputs.result }}/metabase.jar -o metabase-downloaded.jar
- name: Verify Checksum
- run: grep -q $(sha256sum ./metabase-downloaded.jar) SHA256.sum && echo "checksums match" || exit 1
+ run: grep -q "$(sha256sum ./metabase-downloaded.jar | cut -d ' ' -f 1)" SHA256.sum && echo "checksums match" || exit 1
containerize-oss:
needs: check-version
@@ -255,7 +281,7 @@ jobs:
commit: ${{ inputs.commit }}
repo: ${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_REPO }}
tag: ${{ needs.check-version.outputs.oss }}
- release: "true"
+ release: ${{ 'true' }}
containerize-ee:
needs: check-version
@@ -266,7 +292,7 @@ jobs:
commit: ${{ inputs.commit }}
repo: ${{ vars.DOCKERHUB_OWNER }}/${{ vars.DOCKERHUB_REPO }}-enterprise
tag: ${{ needs.check-version.outputs.ee }}
- release: "true"
+ release: ${{ 'true' }}
push-tags:
needs: [verify-s3-download, containerize-oss, containerize-ee, check-version]
@@ -325,7 +351,7 @@ jobs:
const version = '${{ inputs.version }}';
const latestMajorVersion = '${{ vars.LATEST_MAJOR_VERSION }}';
- const extra_tags = getExtraTagsForVersion({ version, latestMajorVersion });
+ const extra_tags = await getExtraTagsForVersion({ version, latestMajorVersion });
console.log({ extra_tags, latestMajorVersion });
core.setOutput('extra_tags', JSON.stringify(extra_tags));
diff --git a/release/src/version-helpers.ts b/release/src/version-helpers.ts
index 308c60cab63..12bb2380ff4 100644
--- a/release/src/version-helpers.ts
+++ b/release/src/version-helpers.ts
@@ -1,4 +1,5 @@
import type { GithubProps, Tag } from "./types";
+import { isLtsVersion } from "./version-info";
// https://regexr.com/7l1ip
export const isValidVersionString = (versionString: string) => {
@@ -116,6 +117,12 @@ export const getMajorVersionFromRef = (ref: string) => {
return getMajorVersionNumberFromReleaseBranch(ref.replace("refs/heads/", ""));
};
+// creates tag in format: `v<oss|ee>.<major>-lts`, for example: v0.58-lts
+const getLtsTag = (version: string) => {
+ const pieces = version.replace(/-.+/, "").split("."); // ignore any -suffixes
+ return pieces.slice(0, 2).join(".") + "-lts";
+}
+
export const getDotXs = (version: string, number: number) => {
const pieces = version.replace(/-.+/, "").split("."); // ignore any -suffixes
return pieces.slice(0, number + 1).join(".") + ".x";
@@ -142,7 +149,7 @@ const shouldAddLatestTag = ({
return majorVersion === latestMajorVersion;
};
-export const getExtraTagsForVersion = ({
+export const getExtraTagsForVersion = async ({
version,
latestMajorVersion,
}: {
@@ -165,6 +172,7 @@ export const getExtraTagsForVersion = ({
...baseTags,
...minorTags,
...(shouldAddLatestTag({ version, latestMajorVersion }) ? ["latest"] : []),
+ ...(await isLtsVersion({ version }) ? [getLtsTag(ossVersion), getLtsTag(eeVersion)] : [])
];
};
diff --git a/release/src/version-helpers.unit.spec.ts b/release/src/version-helpers.unit.spec.ts
index 05d99fc1b45..25817c6221b 100644
--- a/release/src/version-helpers.unit.spec.ts
+++ b/release/src/version-helpers.unit.spec.ts
@@ -23,6 +23,14 @@ import {
isValidVersionString,
versionSort,
} from "./version-helpers";
+import { isLtsVersion } from "./version-info";
+
+jest.mock("./version-info", () => ({
+ __esModule: true,
+ isLtsVersion: jest.fn().mockResolvedValue(false),
+}));
+
+const mockIsLtsVersion = jest.mocked(isLtsVersion);
describe("version-helpers", () => {
describe("isValidVersionString", () => {
@@ -750,27 +758,32 @@ describe("version-helpers", () => {
});
describe("getExtraTagsForVersion", () => {
- it("should return the correct extra tags for a major version", () => {
- expect(getExtraTagsForVersion({ version: "v1.75.0" })).toEqual([
+ beforeEach(() => {
+ mockIsLtsVersion.mockReset();
+ mockIsLtsVersion.mockResolvedValue(false);
+ });
+
+ it("should return the correct extra tags for a major version", async () => {
+ expect(await getExtraTagsForVersion({ version: "v1.75.0" })).toEqual([
"v0.75.x",
"v1.75.x",
]);
- expect(getExtraTagsForVersion({ version: "v0.75.0" })).toEqual([
+ expect(await getExtraTagsForVersion({ version: "v0.75.0" })).toEqual([
"v0.75.x",
"v1.75.x",
]);
});
- it("should return the correct extra tags for a minor version", () => {
- expect(getExtraTagsForVersion({ version: "v1.75.1" })).toEqual([
+ it("should return the correct extra tags for a minor version", async () => {
+ expect(await getExtraTagsForVersion({ version: "v1.75.1" })).toEqual([
"v0.75.x",
"v1.75.x",
"v0.75.1.x",
"v1.75.1.x",
]);
- expect(getExtraTagsForVersion({ version: "v0.75.1" })).toEqual([
+ expect(await getExtraTagsForVersion({ version: "v0.75.1" })).toEqual([
"v0.75.x",
"v1.75.x",
"v0.75.1.x",
@@ -778,15 +791,15 @@ describe("version-helpers", () => {
]);
});
- it("should return the correct extra tags for a patch version", () => {
- expect(getExtraTagsForVersion({ version: "v1.75.1.3" })).toEqual([
+ it("should return the correct extra tags for a patch version", async () => {
+ expect(await getExtraTagsForVersion({ version: "v1.75.1.3" })).toEqual([
"v0.75.x",
"v1.75.x",
"v0.75.1.x",
"v1.75.1.x",
]);
- expect(getExtraTagsForVersion({ version: "v0.75.1.3" })).toEqual([
+ expect(await getExtraTagsForVersion({ version: "v0.75.1.3" })).toEqual([
"v0.75.x",
"v1.75.x",
"v0.75.1.x",
@@ -794,80 +807,92 @@ describe("version-helpers", () => {
]);
});
- it("should return the correct extra tags for a beta version", () => {
- expect(getExtraTagsForVersion({ version: "v1.75.0-beta" })).toEqual([
+ it("should return the correct extra tags for a beta version", async () => {
+ expect(await getExtraTagsForVersion({ version: "v1.75.0-beta" })).toEqual([
"v0.75.x",
"v1.75.x",
]);
- expect(getExtraTagsForVersion({ version: "v1.75.1-beta" })).toEqual([
+ expect(await getExtraTagsForVersion({ version: "v1.75.1-beta" })).toEqual([
"v0.75.x",
"v1.75.x",
"v0.75.1.x",
"v1.75.1.x",
]);
- expect(getExtraTagsForVersion({ version: "v0.75.1.2-beta" })).toEqual([
- "v0.75.x",
- "v1.75.x",
- "v0.75.1.x",
- "v1.75.1.x",
- ]);
+ expect(
+ await getExtraTagsForVersion({ version: "v0.75.1.2-beta" }),
+ ).toEqual(["v0.75.x", "v1.75.x", "v0.75.1.x", "v1.75.1.x"]);
});
- it("should add latest tag when version major matches latestMajorVersion", () => {
+ it("should add latest tag when version major matches latestMajorVersion", async () => {
expect(
- getExtraTagsForVersion({ version: "v0.58.1", latestMajorVersion: "58" }),
+ await getExtraTagsForVersion({
+ version: "v0.58.1",
+ latestMajorVersion: "58",
+ }),
).toEqual(["v0.58.x", "v1.58.x", "v0.58.1.x", "v1.58.1.x", "latest"]);
expect(
- getExtraTagsForVersion({ version: "v1.58.2", latestMajorVersion: "58" }),
+ await getExtraTagsForVersion({
+ version: "v1.58.2",
+ latestMajorVersion: "58",
+ }),
).toEqual(["v0.58.x", "v1.58.x", "v0.58.2.x", "v1.58.2.x", "latest"]);
});
- it("should add latest tag for major versions when major matches latestMajorVersion", () => {
+ it("should add latest tag for major versions when major matches latestMajorVersion", async () => {
expect(
- getExtraTagsForVersion({ version: "v0.58.0", latestMajorVersion: "58" }),
+ await getExtraTagsForVersion({
+ version: "v0.58.0",
+ latestMajorVersion: "58",
+ }),
).toEqual(["v0.58.x", "v1.58.x", "latest"]);
});
- it("should add latest tag for patch versions when major matches latestMajorVersion", () => {
+ it("should add latest tag for patch versions when major matches latestMajorVersion", async () => {
expect(
- getExtraTagsForVersion({
+ await getExtraTagsForVersion({
version: "v0.58.1.3",
latestMajorVersion: "58",
}),
).toEqual(["v0.58.x", "v1.58.x", "v0.58.1.x", "v1.58.1.x", "latest"]);
});
- it("should NOT add latest tag when version major does not match latestMajorVersion", () => {
+ it("should NOT add latest tag when version major does not match latestMajorVersion", async () => {
expect(
- getExtraTagsForVersion({ version: "v0.57.5", latestMajorVersion: "58" }),
+ await getExtraTagsForVersion({
+ version: "v0.57.5",
+ latestMajorVersion: "58",
+ }),
).toEqual(["v0.57.x", "v1.57.x", "v0.57.5.x", "v1.57.5.x"]);
expect(
- getExtraTagsForVersion({ version: "v0.59.0", latestMajorVersion: "58" }),
+ await getExtraTagsForVersion({
+ version: "v0.59.0",
+ latestMajorVersion: "58",
+ }),
).toEqual(["v0.59.x", "v1.59.x"]);
});
- it("should add latest tag for pre-release versions when major matches", () => {
+ it("should add latest tag for pre-release versions when major matches", async () => {
expect(
- getExtraTagsForVersion({
+ await getExtraTagsForVersion({
version: "v0.58.1-rc1",
latestMajorVersion: "58",
}),
).toEqual(["v0.58.x", "v1.58.x", "v0.58.1.x", "v1.58.1.x", "latest"]);
expect(
- getExtraTagsForVersion({
+ await getExtraTagsForVersion({
version: "v0.58.0-beta",
latestMajorVersion: "58",
}),
).toEqual(["v0.58.x", "v1.58.x", "latest"]);
});
- it("should NOT add latest tag when latestMajorVersion is not provided", () => {
- expect(getExtraTagsForVersion({ version: "v0.58.1" })).toEqual([
+ it("should NOT add latest tag when latestMajorVersion is not provided", async () => {
+ expect(await getExtraTagsForVersion({ version: "v0.58.1" })).toEqual([
"v0.58.x",
"v1.58.x",
"v0.58.1.x",
@@ -875,9 +900,23 @@ describe("version-helpers", () => {
]);
expect(
- getExtraTagsForVersion({ version: "v0.58.1", latestMajorVersion: "" }),
+ await getExtraTagsForVersion({
+ version: "v0.58.1",
+ latestMajorVersion: "",
+ }),
).toEqual(["v0.58.x", "v1.58.x", "v0.58.1.x", "v1.58.1.x"]);
});
+
+ it("should append a <major>-lts tag when isLtsVersion is true", async () => {
+ mockIsLtsVersion.mockResolvedValue(true);
+
+ expect(await getExtraTagsForVersion({ version: "v0.75.0" })).toEqual([
+ "v0.75.x",
+ "v1.75.x",
+ "v0.75-lts",
+ "v1.75-lts",
+ ]);
+ });
});
describe("getMajorVersion", () => {
diff --git a/release/src/version-info.ts b/release/src/version-info.ts
index ccfe78a2b5a..7c424e79dc7 100644
--- a/release/src/version-info.ts
+++ b/release/src/version-info.ts
@@ -8,6 +8,7 @@ import type {
VersionInfoFile,
} from "./types";
import {
+ getMajorVersion,
getVersionType,
isEnterpriseVersion,
isPatchVersion,
@@ -188,3 +189,23 @@ export async function updateVersionInfoLatest({
rollout,
});
}
+
+// Checks if a version is part of an LTS major release.
+export async function isLtsVersion({
+ version,
+}: {
+ version: string,
+}): Promise<boolean> {
+ const url = getVersionInfoUrl("v0"); // any non-`v1.` string picks the OSS file
+ const versionInfo = (await fetch(url).then(r => r.json())) as VersionInfoFile;
+
+ const majorVersions = versionInfo?.major_version_support;
+ if (!majorVersions || majorVersions.length === 0) {
+ return false;
+ }
+
+ const versionMajor = getMajorVersion(version);
+ const match = majorVersions.find((v) => v?.lts && String(v.major) === versionMajor);
+
+ return match !== undefined;
+}
diff --git a/release/src/version-info.unit.spec.ts b/release/src/version-info.unit.spec.ts
index 998d1e4e9c9..1f2df39346a 100644
--- a/release/src/version-info.unit.spec.ts
+++ b/release/src/version-info.unit.spec.ts
@@ -1,7 +1,7 @@
import fetch from "node-fetch";
import type { VersionInfoFile } from "./types";
-import { generateVersionInfoJson, getSupportedMajors, getSupportedMajorVersions, getVersionInfoUrl, updateVersionInfoLatest, updateVersionInfoLatestJson } from "./version-info";
+import { generateVersionInfoJson, getSupportedMajors, getSupportedMajorVersions, getVersionInfoUrl, isLtsVersion, updateVersionInfoLatest, updateVersionInfoLatestJson } from "./version-info";
jest.mock("node-fetch", () => ({
__esModule: true,
@@ -414,6 +414,57 @@ describe("version-info", () => {
});
});
+ describe("isLtsVersion", () => {
+ const majorVersionSupport = [
+ { major: 55, released: "2025-04-15", lts: true, eol: "2027-06-01" },
+ { major: 56, released: "2025-08-01", lts: false, eol: "2026-08-01" },
+ ];
+
+ const mockVersionInfo = (major_version_support: any) => {
+ mockFetch.mockResolvedValue({
+ json: async () => ({ latest: {}, older: [], major_version_support }),
+ } as Awaited<ReturnType<typeof fetch>>);
+ };
+
+ beforeEach(() => {
+ process.env.AWS_S3_STATIC_BUCKET = "my.metabase.com";
+ process.env.AWS_REGION = "us-north-9";
+ mockFetch.mockReset();
+ mockVersionInfo(majorVersionSupport);
+ });
+
+ it("returns true when the version's major is an lts release", async () => {
+ expect(await isLtsVersion({ version: "v0.55.2" })).toEqual(true);
+ });
+
+ it("returns false when the version's major is not an lts release", async () => {
+ expect(await isLtsVersion({ version: "v0.56.0" })).toEqual(false);
+ });
+
+ it("returns false when the version's major is absent from the support list", async () => {
+ expect(await isLtsVersion({ version: "v0.99.0" })).toEqual(false);
+ });
+
+ it("returns true for an EE (v1.*) version of an lts major", async () => {
+ expect(await isLtsVersion({ version: "v1.55.0" })).toEqual(true);
+ });
+
+ it("resolves the major from patch and pre-release version strings", async () => {
+ expect(await isLtsVersion({ version: "v0.55.1.2" })).toEqual(true);
+ expect(await isLtsVersion({ version: "v0.55.0-RC1" })).toEqual(true);
+ });
+
+ it("returns false when major_version_support is missing", async () => {
+ mockVersionInfo(undefined);
+ expect(await isLtsVersion({ version: "v0.55.0" })).toEqual(false);
+ });
+
+ it("returns false when major_version_support is empty", async () => {
+ mockVersionInfo([]);
+ expect(await isLtsVersion({ version: "v0.55.0" })).toEqual(false);
+ });
+ });
+
describe("getVersionInfoUrl", () => {
beforeEach(() => {
jest.resetModules();