From f9e572d50be9bd7e9baf8b4387af40b0252cec4a Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Thu, 28 Apr 2022 13:47:12 -0700 Subject: [PATCH] [Version] Increment to 3.0 (#1502) Increment from 2.0.0 to 3.0.0, also some version checks. Also, add a release build verification workflow. To verify x64 and ARM64 artifacts are built successfully with dependencies. Issue: n/a Signed-off-by: Kawika Avilla --- .github/workflows/build_and_test_workflow.yml | 55 +++++++++++++++++++ dev-tools/get-version.sh | 15 +++++ package.json | 5 +- ...h_dashboards_version_compatability.test.ts | 24 ++++++++ ...search_dashboards_version_compatability.ts | 2 +- .../is_config_version_upgradeable.test.ts | 3 +- .../is_config_version_upgradeable.ts | 2 +- 7 files changed, 101 insertions(+), 5 deletions(-) create mode 100755 dev-tools/get-version.sh diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index 58c342f27e31..83c40cc2da6d 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_workflow.yml @@ -106,3 +106,58 @@ jobs: CI_PARALLEL_PROCESS_NUMBER: ciGroup${{ matrix.group }} JOB: ci${{ matrix.group }} CACHE_DIR: ciGroup${{ matrix.group }} + + build-min-artifact-tests: + runs-on: ubuntu-latest + name: Build min release artifacts + defaults: + run: + working-directory: ./artifacts + strategy: + matrix: + include: + - name: Linux x64 + ext: tar.gz + suffix: linux-x64 + script: build-platform --linux --skip-os-packages + - name: Linux ARM64 + ext: tar.gz + suffix: linux-arm64 + script: build-platform --linux-arm --skip-os-packages + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + path: ./artifacts + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version-file: "./artifacts/.nvmrc" + registry-url: 'https://registry.npmjs.org' + + - name: Setup Yarn + run: | + npm uninstall -g yarn + npm i -g yarn@1.22.10 + + - name: Get package version + run: | + echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV + + - name: Get artifact build name + run: | + echo "ARTIFACT_BUILD_NAME=opensearch-dashboards-${{ env.VERSION }}-${{ matrix.suffix }}.${{ matrix.ext }}" >> $GITHUB_ENV + + - name: Run bootstrap + run: yarn osd bootstrap + + - name: Build `${{ matrix.name }}` + run: yarn ${{ matrix.script }} --release + + - uses: actions/upload-artifact@v3 + if: success() + with: + name: ${{ matrix.name }} + path: ./artifacts/target/${{ env.ARTIFACT_BUILD_NAME }} + retention-days: 1 \ No newline at end of file diff --git a/dev-tools/get-version.sh b/dev-tools/get-version.sh new file mode 100755 index 000000000000..555dd89e9e9c --- /dev/null +++ b/dev-tools/get-version.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Copyright OpenSearch Contributors +# SPDX-License-Identifier: Apache-2.0 + +set -e + +PACKAGE_VERSION=$(cat package.json \ +| grep version \ +| head -1 \ +| awk -F: '{ print $2 }' \ +| sed 's/[",]//g' \ +| tr -d [:space:]) + +echo "$PACKAGE_VERSION" \ No newline at end of file diff --git a/package.json b/package.json index 632c5bf42241..40f3bac5a751 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "dashboarding" ], "private": true, - "version": "2.0.0", + "version": "3.0.0", "branch": "main", "types": "./opensearch_dashboards.d.ts", "tsdocMetadata": "./build/tsdoc-metadata.json", @@ -70,7 +70,8 @@ "build:types": "rm -rf ./target/types && tsc --p tsconfig.types.json", "docs:acceptApiChanges": "node --max-old-space-size=6144 scripts/check_published_api_changes.js --accept", "osd:bootstrap": "node scripts/build_ts_refs && node scripts/register_git_hook", - "spec_to_console": "node scripts/spec_to_console" + "spec_to_console": "node scripts/spec_to_console", + "pkg-version": "./dev-tools/get-version.sh" }, "repository": { "type": "git", diff --git a/src/core/server/opensearch/version_check/opensearch_opensearch_dashboards_version_compatability.test.ts b/src/core/server/opensearch/version_check/opensearch_opensearch_dashboards_version_compatability.test.ts index 44773e22818c..80de3a19f0a5 100644 --- a/src/core/server/opensearch/version_check/opensearch_opensearch_dashboards_version_compatability.test.ts +++ b/src/core/server/opensearch/version_check/opensearch_opensearch_dashboards_version_compatability.test.ts @@ -68,6 +68,18 @@ describe('plugins/opensearch', () => { it('when majors and minors are not equal, but the engine is on legacy version 8.0.0 and OpenSearch Dashboards is on 2.0.0', () => { expect(opensearchVersionCompatibleWithOpenSearchDashboards('8.0.0', '2.0.0')).toBe(false); }); + + it('when majors and minors are not equal, but the engine is on legacy version 6.10.3 and OpenSearch Dashboards is on 3.0.0', () => { + expect(opensearchVersionCompatibleWithOpenSearchDashboards('6.10.3', '3.0.0')).toBe(false); + }); + + it('when majors and minors are not equal, but the engine is on legacy version 7.10.3 and OpenSearch Dashboards is on 3.0.0', () => { + expect(opensearchVersionCompatibleWithOpenSearchDashboards('7.10.3', '3.0.0')).toBe(false); + }); + + it('when majors and minors are not equal, but the engine is on legacy version 8.0.0 and OpenSearch Dashboards is on 3.0.0', () => { + expect(opensearchVersionCompatibleWithOpenSearchDashboards('8.0.0', '3.0.0')).toBe(false); + }); }); describe('returns true', () => { @@ -110,6 +122,18 @@ describe('plugins/opensearch', () => { it('when majors and minors are not equal, but the engine is on legacy version 7.10.2 and OpenSearch Dashboards is on 2.1.0', () => { expect(opensearchVersionCompatibleWithOpenSearchDashboards('7.10.2', '2.1.0')).toBe(true); }); + + it('when majors and minors are not equal, but the engine is on legacy version 7.10.2 and OpenSearch Dashboards is on 3.0.0', () => { + expect(opensearchVersionCompatibleWithOpenSearchDashboards('7.10.2', '3.0.0')).toBe(true); + }); + + it('when majors and minors are not equal, but the engine is on legacy version 7.10.2 and OpenSearch Dashboards is on 3.0.1', () => { + expect(opensearchVersionCompatibleWithOpenSearchDashboards('7.10.2', '3.0.1')).toBe(true); + }); + + it('when majors and minors are not equal, but the engine is on legacy version 7.10.2 and OpenSearch Dashboards is on 3.1.0', () => { + expect(opensearchVersionCompatibleWithOpenSearchDashboards('7.10.2', '3.1.0')).toBe(true); + }); }); }); }); diff --git a/src/core/server/opensearch/version_check/opensearch_opensearch_dashboards_version_compatability.ts b/src/core/server/opensearch/version_check/opensearch_opensearch_dashboards_version_compatability.ts index 8ecae4d60250..ab8e3725d73d 100644 --- a/src/core/server/opensearch/version_check/opensearch_opensearch_dashboards_version_compatability.ts +++ b/src/core/server/opensearch/version_check/opensearch_opensearch_dashboards_version_compatability.ts @@ -45,7 +45,7 @@ interface VersionNumbers { * * WARNING: OpenSearchDashboards 7.x could cause conflicts. */ -const osdLegacyCompatibleMajorVersions = [1, 2]; +const osdLegacyCompatibleMajorVersions = [1, 2, 3]; /** * Checks for the compatibilitiy between OpenSearch and OpenSearchDashboards versions diff --git a/src/core/server/ui_settings/create_or_upgrade_saved_config/is_config_version_upgradeable.test.ts b/src/core/server/ui_settings/create_or_upgrade_saved_config/is_config_version_upgradeable.test.ts index f1e052979c09..10a01c004e04 100644 --- a/src/core/server/ui_settings/create_or_upgrade_saved_config/is_config_version_upgradeable.test.ts +++ b/src/core/server/ui_settings/create_or_upgrade_saved_config/is_config_version_upgradeable.test.ts @@ -89,5 +89,6 @@ describe('savedObjects/health_check/isConfigVersionUpgradeable', function () { isUpgradeableTest('1.0.1', '1.0.0', false); isUpgradeableTest('7.10.2', '1.1.0', true); isUpgradeableTest('7.10.2', '2.0.0', true); - isUpgradeableTest('7.10.2', '3.0.0', false); + isUpgradeableTest('7.10.2', '3.0.0', true); + isUpgradeableTest('7.10.2', '4.0.0', false); }); diff --git a/src/core/server/ui_settings/create_or_upgrade_saved_config/is_config_version_upgradeable.ts b/src/core/server/ui_settings/create_or_upgrade_saved_config/is_config_version_upgradeable.ts index 3a111371c578..44206e6345b7 100644 --- a/src/core/server/ui_settings/create_or_upgrade_saved_config/is_config_version_upgradeable.ts +++ b/src/core/server/ui_settings/create_or_upgrade_saved_config/is_config_version_upgradeable.ts @@ -35,7 +35,7 @@ import semver from 'semver'; * * WARNING: OpenSearchDashboards 7.x could cause conflicts. */ -const osdValidMajorVersions = [1, 2]; +const osdValidMajorVersions = [1, 2, 3]; const rcVersionRegex = /^(\d+\.\d+\.\d+)\-rc(\d+)$/i; function extractRcNumber(version: string): [string, number] {