From c376edf2b5fd89cc41aa0557cf7380ced6e5f103 Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri Benedetti Date: Mon, 12 May 2025 12:40:16 +0200 Subject: [PATCH 1/2] Add checks for download and file --- install.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 544b67ab5..163ce3279 100755 --- a/install.sh +++ b/install.sh @@ -1,5 +1,5 @@ #!/bin/sh -set -e +set -euo pipefail # Determine OS type and architecture OS=$(uname -s | tr '[:upper:]' '[:lower:]') @@ -56,11 +56,22 @@ fi echo "Downloading docs-builder for $OS/$ARCH..." # Download the appropriate binary -curl -LO "https://github.com/elastic/docs-builder/releases/latest/download/$BINARY" +if ! curl -LO "https://github.com/elastic/docs-builder/releases/latest/download/$BINARY"; then + echo "Error: Failed to download $BINARY. Please check your internet connection." + exit 1 +fi + +# Validate the downloaded file +if [ ! -s "$BINARY" ]; then + echo "Error: Downloaded file $BINARY is missing or empty." + exit 1 +fi # Extract only the docs-builder file to /tmp directory -# Use -o flag to always overwrite files without prompting -unzip -j -o "$BINARY" docs-builder -d /tmp +if ! unzip -j -o "$BINARY" docs-builder -d /tmp; then + echo "Error: Failed to extract docs-builder from $BINARY." + exit 1 +fi # Ensure the binary is executable chmod +x /tmp/docs-builder From a3cca2bb32f5c6d0554c25b7f8f2f6bba95b6755 Mon Sep 17 00:00:00 2001 From: Fabrizio Ferri Benedetti Date: Mon, 12 May 2025 12:42:53 +0200 Subject: [PATCH 2/2] Edit docs --- docs/contribute/locally.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/contribute/locally.md b/docs/contribute/locally.md index 72fbb8891..1a8d8d68a 100644 --- a/docs/contribute/locally.md +++ b/docs/contribute/locally.md @@ -39,6 +39,8 @@ This guide uses the first option. If you'd like to clone the repository and buil ``` This downloads the latest binary, makes it executable, and installs it to your user PATH. + To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub. + 2. **Run docs-builder from a docs folder** Use the `serve` command from any docs folder to start serving the documentation at http://localhost:3000. The path to the `docset.yml` file that you want to build can be specified with `-p`: @@ -46,9 +48,6 @@ This guide uses the first option. If you'd like to clone the repository and buil ```sh docs-builder serve ``` - -To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub. - ::: :::{tab-item} Windows @@ -63,6 +62,8 @@ To download and install the binary file manually, refer to [Releases](https://gi This downloads the latest binary, makes it executable, and installs it to your user PATH. + To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub. + 2. **Run docs-builder from a docs folder** Use the `serve` command from any docs folder to start serving the documentation at http://localhost:3000. The path to the `docset.yml` file that you want to build can be specified with `-p`: @@ -70,9 +71,7 @@ To download and install the binary file manually, refer to [Releases](https://gi ```sh docs-builder serve ``` - -To download and install the binary file manually, refer to [Releases](https://github.com/elastic/docs-builder/releases) on GitHub. - + ::: ::::