From 5010208f5f9a5afccff19ec5e42c10d3c24841bc Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 15 Jul 2024 21:47:41 -0700 Subject: [PATCH 1/2] Revert "Revert "[docs] add linux amd64 download button" (#41671)" This reverts commit 64faf690be04a3f39a4ee8e4ac4197880cf1df53. --- .../getting-started/oss-quickstart.md | 23 +++++++-- docusaurus/docusaurus.config.js | 3 +- .../src/scripts/download-abctl-buttons.js | 51 +++++++++++++++++++ 3 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 docusaurus/src/scripts/download-abctl-buttons.js diff --git a/docs/using-airbyte/getting-started/oss-quickstart.md b/docs/using-airbyte/getting-started/oss-quickstart.md index e5433c12e427..5012a131d32e 100644 --- a/docs/using-airbyte/getting-started/oss-quickstart.md +++ b/docs/using-airbyte/getting-started/oss-quickstart.md @@ -48,11 +48,16 @@ brew upgrade abctl -**1: Download the latest release of `abctl` [here](https://github.com/airbytehq/abctl/releases)** +**1: Download the latest release of `abctl`.** + +Loading... +Loading... +
+
:::info -Be sure to download the file that is compatible with your machine's processor architecture. -::: +
+Be sure to download the file that is compatible with your machine's processor architecture. You'll see two options: `linux-amd64` and `linux-arm64` If you're unsure which one you need, running the following command will help: @@ -63,6 +68,8 @@ uname -m - If the output is `x86_64`, you have an x86-64 processor. - If the output is `aarch64` or something similar, you have an ARM-based processor. +
+::: **2: Extract the archive** @@ -99,7 +106,11 @@ If this command prints the installed version of the Airbyte Command Line Tool, i
-**1: Download the latest release of `abctl` [here](https://github.com/airbytehq/abctl/releases)** +**1: Download the latest release of `abctl`.** + +Loading... +
+
**2: Extract the archive** - Right click the zip file you've downloaded and select `Extract All...`, then choose a destination folder. @@ -210,4 +221,6 @@ There are several channels for community support of local setup and deployment. On Udemy, [The Complete Hands-on Introduction to Airbyte](https://www.udemy.com/course/the-complete-hands-on-introduction-to-airbyte/) is a convenient and hands-on introduction to Airbyte that includes setting up example source and destination configurations. You'll also go on to use it in conjunction with Apache Airflow, Snowflake, dbt, and more. **Bug Reports:**
If you find an issue with the `abctl` command, please report it as a github -issue [here](https://github.com/airbytehq/airbyte/issues) with the type of `🐛 [abctl] Report an issue with the abctl tool`. \ No newline at end of file +issue [here](https://github.com/airbytehq/airbyte/issues) with the type of `🐛 [abctl] Report an issue with the abctl tool`. + +**Releases:**
If you'd like to select which release of abctl to run, you can find the list of releases [here](https://github.com/airbytehq/abctl/releases/). \ No newline at end of file diff --git a/docusaurus/docusaurus.config.js b/docusaurus/docusaurus.config.js index 06c4311a1d9e..4cd2357df1d9 100644 --- a/docusaurus/docusaurus.config.js +++ b/docusaurus/docusaurus.config.js @@ -79,8 +79,9 @@ const config = { ], clientModules: [ - require.resolve("./src/scripts/fontAwesomeIcons.js"), require.resolve("./src/scripts/cloudStatus.js"), + require.resolve('./src/scripts/download-abctl-buttons.js'), + require.resolve("./src/scripts/fontAwesomeIcons.js"), ], presets: [ diff --git a/docusaurus/src/scripts/download-abctl-buttons.js b/docusaurus/src/scripts/download-abctl-buttons.js new file mode 100644 index 000000000000..8b079fdbb250 --- /dev/null +++ b/docusaurus/src/scripts/download-abctl-buttons.js @@ -0,0 +1,51 @@ +import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment"; + +if (ExecutionEnvironment.canUseDOM) { + // Pre-fetch the urls for the binaries. + const binaries = fetch( + 'https://api.github.com/repos/airbytehq/abctl/releases/latest') + .then(response => response.json()) + .then(data => data.assets); + + // Initialize button by choosing the relevant binary based on the data-architecture tag. + function initializeDownloadButton(button) { + binaries.then(assets => { + const architecture = button.getAttribute('data-architecture'); + const binary = assets.find( + b => b.name.toLowerCase().includes(architecture.toLowerCase())); + if (binary) { + button.href = binary.browser_download_url; + button.innerText = `Download ${architecture}`; + button.classList.remove('disabled'); + } else { + fallback(button); + } + }) + .catch(error => { + console.error('Error fetching latest release:', error); + fallback(button); + }); + } + + // If loading fails for some reason or we can't find the asset, fallback on just + // making a link to the latest releases page. + function fallback(button) { + const architecture = button.getAttribute('data-architecture'); + button.href = 'https://github.com/airbytehq/abctl/releases/latest'; + button.innerText = `Latest ${architecture} Release` + button.target = '_blank'; // Opens the link in a new tab + button.classList.remove('disabled'); + } + + // All buttons with this behavior have the class abctl-download. + function initializeAllDownloadButtons() { + const buttons = document.getElementsByClassName('abctl-download'); + Array.from(buttons).forEach(initializeDownloadButton); + } + + // Document load is a bit weird in docusaurus. + // https://stackoverflow.com/a/74736980/4195169 + window.addEventListener('load', () => { + setTimeout(initializeAllDownloadButtons, 1000); + }); +} From 833cde9f8620830588fb593243e53d8042d30dc8 Mon Sep 17 00:00:00 2001 From: cgardens Date: Mon, 15 Jul 2024 21:57:32 -0700 Subject: [PATCH 2/2] move fallback to link to releases hardcoded in html --- .../getting-started/oss-quickstart.md | 6 +++--- docusaurus/src/scripts/download-abctl-buttons.js | 14 -------------- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/docs/using-airbyte/getting-started/oss-quickstart.md b/docs/using-airbyte/getting-started/oss-quickstart.md index 5012a131d32e..1808e670ac41 100644 --- a/docs/using-airbyte/getting-started/oss-quickstart.md +++ b/docs/using-airbyte/getting-started/oss-quickstart.md @@ -50,8 +50,8 @@ brew upgrade abctl **1: Download the latest release of `abctl`.** -Loading... -Loading... +Latest linux-amd64 Release +Latest linux-arm64 Release

@@ -108,7 +108,7 @@ If this command prints the installed version of the Airbyte Command Line Tool, i **1: Download the latest release of `abctl`.** -Loading... +Latest windows-amd64 Release

diff --git a/docusaurus/src/scripts/download-abctl-buttons.js b/docusaurus/src/scripts/download-abctl-buttons.js index 8b079fdbb250..5ab2f3879fd2 100644 --- a/docusaurus/src/scripts/download-abctl-buttons.js +++ b/docusaurus/src/scripts/download-abctl-buttons.js @@ -16,27 +16,13 @@ if (ExecutionEnvironment.canUseDOM) { if (binary) { button.href = binary.browser_download_url; button.innerText = `Download ${architecture}`; - button.classList.remove('disabled'); - } else { - fallback(button); } }) .catch(error => { console.error('Error fetching latest release:', error); - fallback(button); }); } - // If loading fails for some reason or we can't find the asset, fallback on just - // making a link to the latest releases page. - function fallback(button) { - const architecture = button.getAttribute('data-architecture'); - button.href = 'https://github.com/airbytehq/abctl/releases/latest'; - button.innerText = `Latest ${architecture} Release` - button.target = '_blank'; // Opens the link in a new tab - button.classList.remove('disabled'); - } - // All buttons with this behavior have the class abctl-download. function initializeAllDownloadButtons() { const buttons = document.getElementsByClassName('abctl-download');