From 04ab9c7b6bdae855ab95d94f61980f7983c4ef3b Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Mon, 6 Mar 2023 22:15:59 +0000 Subject: [PATCH] [Dev] enable `opensearch snapshot` for Darwin Enable the downloading of Darwin for running the command `yarn opensearch snapshot`. Darwin is not officially supported but snapshots are being built here: https://build.ci.opensearch.org/job/distribution-build-opensearch/ Issue resolved: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/2944 Signed-off-by: Kawika Avilla --- CHANGELOG.md | 1 + packages/osd-opensearch/src/artifact.js | 4 ++-- packages/osd-opensearch/src/artifact.test.js | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ecf078ae7efd..1fc377bd25dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - [Multiple DataSource] Add support for SigV4 authentication ([#3058](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3058)) - Make build scripts find and use the latest version of Node.js that satisfies `engines.node` ([#3467](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3467)) - [Multiple DataSource] Refactor test connection to support SigV4 auth type ([#3456](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3456)) +- [Darwin] Add support for Darwin for running OpenSearch snapshots with `yarn opensearch snapshot` ([#3537](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/3537)) ### 🐛 Bug Fixes diff --git a/packages/osd-opensearch/src/artifact.js b/packages/osd-opensearch/src/artifact.js index b7d8857ba09f..cd1702213d4d 100644 --- a/packages/osd-opensearch/src/artifact.js +++ b/packages/osd-opensearch/src/artifact.js @@ -188,8 +188,8 @@ async function getArtifactSpecForSnapshotFromUrl(urlVersion, log) { const arch = process.arch === 'arm64' ? 'arm64' : 'x64'; const extension = process.platform === 'win32' ? 'zip' : 'tar.gz'; - if (platform !== 'linux' && platform !== 'windows') { - throw createCliError(`Snapshots are only available for Linux and Windows`); + if (platform !== 'linux' && platform !== 'windows' && platform !== 'darwin') { + throw createCliError(`Snapshots are only available for Linux, Windows, and Darwin`); } const latestUrl = `${DAILY_SNAPSHOTS_BASE_URL}/${desiredVersion}-SNAPSHOT`; diff --git a/packages/osd-opensearch/src/artifact.test.js b/packages/osd-opensearch/src/artifact.test.js index 1d5d0bdf330c..92f3700c7935 100644 --- a/packages/osd-opensearch/src/artifact.test.js +++ b/packages/osd-opensearch/src/artifact.test.js @@ -163,10 +163,10 @@ describe('Artifact', () => { }); }); - it('should throw when on a non-Linux or non-Windows platform', async () => { + it('should throw when on a non-Linux, non-Windows, non-Darwin platform', async () => { Object.defineProperties(process, { platform: { - value: 'darwin', + value: 'android', }, arch: { value: ORIGINAL_ARCHITECTURE,