From 5acb7b704b8c7a53a900a4820214c9b4b6488b4b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Jun 2025 08:10:19 +0000 Subject: [PATCH 1/6] Initial plan From 7659d8b8d0543d2f83edba24b92847924384cd6b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 28 Jun 2025 08:14:33 +0000 Subject: [PATCH 2/6] Fix codespace config permission issue by creating /home/node directory Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com> --- .devcontainer/onCreate.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.devcontainer/onCreate.sh b/.devcontainer/onCreate.sh index 1cb26c6..bb541f5 100755 --- a/.devcontainer/onCreate.sh +++ b/.devcontainer/onCreate.sh @@ -2,6 +2,12 @@ set -e +echo "Setting up node user home directory and permissions" +sudo mkdir -p /home/node/.config/vscode-dev-containers +sudo chown -R node:node /home/node +sudo chmod 755 /home/node +sudo chmod -R 755 /home/node/.config + echo "Installing the GitHub CLI" (type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \ && sudo mkdir -p -m 755 /etc/apt/keyrings \ From 8310246b49e661ce537a215d82b0679623167466 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 30 Jun 2025 09:26:39 +0000 Subject: [PATCH 3/6] Add error handling to refreshTools.sh to fix null hostname error Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com> --- .devcontainer/refreshTools.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.devcontainer/refreshTools.sh b/.devcontainer/refreshTools.sh index aaaa428..9066486 100755 --- a/.devcontainer/refreshTools.sh +++ b/.devcontainer/refreshTools.sh @@ -12,11 +12,28 @@ TOOLS_MARKER_FILE="$MARKER_DIR/tools" sudo mkdir -p "$MARKER_DIR" +# Check if TEMPLATE_PAT is set +if [ -z "$TEMPLATE_PAT" ]; then + echo "TEMPLATE_PAT environment variable is not set. Skipping tools update." + exit 0 +fi + # Fetch the latest release information LATEST_RELEASE=$(curl -s -H "Authorization: token $TEMPLATE_PAT" https://api.github.com/repos/github/spark-template/releases/latest) +# Check if the API call succeeded +if [ $? -ne 0 ] || [ -z "$LATEST_RELEASE" ]; then + echo "Failed to fetch release information from GitHub. Skipping tools update." + exit 0 +fi + # Check if marker file exists and has the same release ID RELEASE_ID=$(echo "$LATEST_RELEASE" | jq -r '.id') +if [ "$RELEASE_ID" == "null" ] || [ -z "$RELEASE_ID" ]; then + echo "Invalid release data received from GitHub. Skipping tools update." + exit 0 +fi + if [ -f "$RELEASE_MARKER_FILE" ] && [ "$(cat "$RELEASE_MARKER_FILE")" == "$RELEASE_ID" ]; then echo "Already at the latest release. Skipping download." exit 0 @@ -28,6 +45,13 @@ TEMP_DIR=$(mktemp -d) cd $TEMP_DIR DOWNLOAD_URL=$(echo "$LATEST_RELEASE" | jq -r '.assets[0].url') +if [ "$DOWNLOAD_URL" == "null" ] || [ -z "$DOWNLOAD_URL" ]; then + echo "No download URL found in release data. Skipping tools update." + cd - >/dev/null + rm -rf $TEMP_DIR + exit 0 +fi + curl -L -o dist.zip -H "Authorization: token $TEMPLATE_PAT" -H "Accept: application/octet-stream" "$DOWNLOAD_URL" unzip -o dist.zip From 7e8922eac2ad1939a66b1bae48e3458b6b25aa89 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 30 Jun 2025 09:33:15 +0000 Subject: [PATCH 4/6] Install jq before using it in refreshTools.sh to fix JSON parsing Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com> --- .devcontainer/refreshTools.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.devcontainer/refreshTools.sh b/.devcontainer/refreshTools.sh index 9066486..c1e63b6 100755 --- a/.devcontainer/refreshTools.sh +++ b/.devcontainer/refreshTools.sh @@ -4,6 +4,12 @@ set -e echo "Checking for updates to workbench-template from GitHub" +# Ensure jq is installed for JSON parsing +if ! command -v jq &> /dev/null; then + echo "Installing jq for JSON parsing..." + sudo apt-get update && sudo apt-get install -y jq +fi + WORKSPACE_DIR="/workspaces/spark-template" MARKER_DIR="/var/lib/spark/.versions" From 3e8a6cb990f37d06c8b2d08d710dcdf1f9533170 Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Mon, 30 Jun 2025 09:45:28 +0000 Subject: [PATCH 5/6] Fix it --- .devcontainer/onCreate.sh | 4 ++-- package.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.devcontainer/onCreate.sh b/.devcontainer/onCreate.sh index bb541f5..30f1695 100755 --- a/.devcontainer/onCreate.sh +++ b/.devcontainer/onCreate.sh @@ -30,8 +30,8 @@ sudo rm -rf "$azcopy_dir" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" "$SCRIPT_DIR/refreshTools.sh" -echo "Pre-starting the server and generating the optimized assets" -npm run optimize --override +echo "Installing Node.js dependencies" +npm install echo "Installing supervisor" sudo apt-get update && sudo apt-get install -y supervisor \ No newline at end of file diff --git a/package.json b/package.json index ff5966a..bc80ee4 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "lint": "eslint .", "test": "vitest", "test:run": "vitest run", - "optimize": "vite optimize", "preview": "vite preview", "build:pages": "bash ./build-for-gh-pages.sh", "predeploy": "npm run build:pages", From 6a5b22908619a7a87ca86b3a56e53f5bab1c50fc Mon Sep 17 00:00:00 2001 From: Rob Bos Date: Mon, 30 Jun 2025 09:52:11 +0000 Subject: [PATCH 6/6] moar fixes --- .devcontainer/devcontainer.json | 6 ++++++ .devcontainer/onCreate.sh | 20 ++------------------ 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 226b5e3..75f7591 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,6 +24,12 @@ "features": { "ghcr.io/devcontainers/features/sshd:1": { "version": "latest" + }, + "ghcr.io/devcontainers/features/github-cli:1": { + "version": "latest" + }, + "ghcr.io/devcontainers/features/azure-cli:1": { + "version": "latest" } } } diff --git a/.devcontainer/onCreate.sh b/.devcontainer/onCreate.sh index 30f1695..e45485f 100755 --- a/.devcontainer/onCreate.sh +++ b/.devcontainer/onCreate.sh @@ -8,24 +8,8 @@ sudo chown -R node:node /home/node sudo chmod 755 /home/node sudo chmod -R 755 /home/node/.config -echo "Installing the GitHub CLI" -(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \ - && sudo mkdir -p -m 755 /etc/apt/keyrings \ - && out=$(mktemp) && wget -nv -O$out https://cli.github.com/packages/githubcli-archive-keyring.gpg \ - && cat $out | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \ - && sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \ - && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ - && sudo apt update \ - && sudo apt install gh inotify-tools -y - -echo "Installing azcopy" - -sudo wget -O /usr/local/bin/azcopytar https://aka.ms/downloadazcopy-v10-linux -sudo tar -xvf /usr/local/bin/azcopytar -C /usr/local/bin/ -sudo rm /usr/local/bin/azcopytar -azcopy_dir=$(find /usr/local/bin/ -type d -name "azcopy*" | head -n 1) -sudo mv "$azcopy_dir/azcopy" /usr/local/bin/azcopy -sudo rm -rf "$azcopy_dir" +echo "Installing inotify-tools" +sudo apt update && sudo apt install -y inotify-tools SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" "$SCRIPT_DIR/refreshTools.sh"