The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Update the latest docker tag when the latest major version matches (#68946)
Nemanja Glumac6b1ceaf93b4b
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 67e501ca133..c57dc45e4f7 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -326,10 +326,11 @@ jobs:const { getExtraTagsForVersion } = require('${{ github.workspace }}/release/dist/index.cjs');const version = '${{ inputs.version }}';+ const latestMajorVersion = '${{ vars.LATEST_MAJOR_VERSION }}';- const extra_tags = getExtraTagsForVersion({ version });+ const extra_tags = getExtraTagsForVersion({ version, latestMajorVersion });- console.log({ extra_tags });+ console.log({ extra_tags, latestMajorVersion });core.setOutput('extra_tags', JSON.stringify(extra_tags));add-extra-tags:@@ -347,9 +348,11 @@ jobs:with:version: ${{ inputs.version }}tag_name: ${{ matrix.tag }}- tag_ee: ${{ contains(matrix.tag, 'v1') }}- tag_oss: ${{ contains(matrix.tag, 'v0') }}- dot-x-tag: true+ # For version tags (v0.x, v1.x), apply to matching edition only+ # For non-version tags like "latest", apply to both editions+ tag_ee: ${{ contains(matrix.tag, 'v1') || !startsWith(matrix.tag, 'v') }}+ tag_oss: ${{ contains(matrix.tag, 'v0') || !startsWith(matrix.tag, 'v') }}+ dot-x-tag: ${{ startsWith(matrix.tag, 'v') }}trigger-cloud-issues:if: ${{ !inputs.auto }}diff --git a/release/src/version-helpers.ts b/release/src/version-helpers.tsindex f32808f0a25..2bcf048cc53 100644--- a/release/src/version-helpers.ts+++ b/release/src/version-helpers.ts@@ -143,20 +143,40 @@ export const getDotXVersion = (version: string) => {return getDotXs(version, 2);};-export const getExtraTagsForVersion = ({ version }: { version: string }) => {- const ossVerion = getOSSVersion(version);+const shouldAddLatestTag = ({+ version,+ latestMajorVersion,+}: {+ version: string;+ latestMajorVersion?: string;+}) => {+ const majorVersion = getMajorVersion(version);+ return majorVersion === latestMajorVersion;+};++export const getExtraTagsForVersion = ({+ version,+ latestMajorVersion,+}: {+ version: string;+ latestMajorVersion?: string;+}) => {+ const ossVersion = getOSSVersion(version);const eeVersion = getEnterpriseVersion(version);const versionType = getVersionType(version);// eg. v0.23.x / v1.23.x- const tags = [getDotXs(ossVerion, 1), getDotXs(eeVersion, 1)];-- if (versionType === "major") {- return tags;- }-+ const baseTags = [getDotXs(ossVersion, 1), getDotXs(eeVersion, 1)];// eg. v0.23.4.x / v1.23.4.x- return [...tags, getDotXs(ossVerion, 2), getDotXs(eeVersion, 2)];+ const minorTags = versionType !== "major"+ ? [getDotXs(ossVersion, 2), getDotXs(eeVersion, 2)]+ : [];++ return [+ ...baseTags,+ ...minorTags,+ ...(shouldAddLatestTag({ version, latestMajorVersion }) ? ["latest"] : []),+ ];};/**diff --git a/release/src/version-helpers.unit.spec.ts b/release/src/version-helpers.unit.spec.tsindex 563c0bba047..25592da4985 100644--- a/release/src/version-helpers.unit.spec.ts+++ b/release/src/version-helpers.unit.spec.ts@@ -802,6 +802,70 @@ describe("version-helpers", () => {"v1.75.1.x",]);});++ it("should add latest tag when version major matches latestMajorVersion", () => {+ expect(+ 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" }),+ ).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", () => {+ expect(+ 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", () => {+ expect(+ 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", () => {+ expect(+ 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" }),+ ).toEqual(["v0.59.x", "v1.59.x"]);+ });++ it("should add latest tag for pre-release versions when major matches", () => {+ expect(+ 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({+ 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([+ "v0.58.x",+ "v1.58.x",+ "v0.58.1.x",+ "v1.58.1.x",+ ]);++ expect(+ getExtraTagsForVersion({ version: "v0.58.1", latestMajorVersion: "" }),+ ).toEqual(["v0.58.x", "v1.58.x", "v0.58.1.x", "v1.58.1.x"]);+ });});describe("filterOutNonSupportedPrereleaseIdentifier", () => {