Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@
"ghcr.io/devcontainers/features/sshd:1": {
"version": "latest"
}
},
"customizations": {
"codespaces": {
"repositories": {
"github/gh-runtime-cli": {
"permissions": {
"contents": "read",
"packages": "read"
}
}
}
}
}
}

49 changes: 16 additions & 33 deletions .devcontainer/onCreate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,19 @@ echo "Installing the GitHub CLI"
&& sudo apt update \
&& sudo apt install gh inotify-tools -y

echo "Installing the GitHub CLI Runtime extension"
# if the GITHUB_USER is monalisa, then install the plugin from the local folder
if [ "$GITHUB_USER" = "monalisa" ]; then
cd ./gh-runtime-cli
gh extension install .
else
gh extension install github/gh-runtime-cli
fi

echo "Adding an alias for the GitHub CLI Runtime extension"
gh alias set runtime runtime-cli

echo "Downloading the latest release of workbench-template from GitHub"
echo "Installing azcopy"

GITHUB_PAT="$RELEASE_PAT"
REPO="github/workbench-template"
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"

# Fetch the latest release information
LATEST_RELEASE=$(curl -s -H "Authorization: token $GITHUB_PAT" https://api.github.com/repos/$REPO/releases/latest)

# Extract the first browser_download_url from the assets
LATEST_RELEASE=$(curl -s -H "Authorization: token $TEMPLATE_PAT" https://api.github.com/repos/github/spark-template/releases/latest)
DOWNLOAD_URL=$(echo "$LATEST_RELEASE" | jq -r '.assets[0].url')
echo "Download URL: $DOWNLOAD_URL"


# Fetch the latest release information
curl -L -o dist.zip -H "Authorization: token $GITHUB_PAT" -H "Accept: application/octet-stream" "$DOWNLOAD_URL"

curl -L -o dist.zip -H "Authorization: token $TEMPLATE_PAT" -H "Accept: application/octet-stream" "$DOWNLOAD_URL"
unzip -o dist.zip
rm dist.zip

Expand All @@ -56,7 +41,13 @@ tar -xzf ./spark-sdk-dist/spark-tools.tgz
mkdir -p /workspaces/spark-tools
sudo mv ./package/* /workspaces/spark-tools
sudo rmdir ./package
rm -rf ./spark-sdk-dist

sudo mv spark-sdk-dist/gh-spark-cli /usr/local/bin/
cd /usr/local/bin/gh-spark-cli
gh extension install .
gh alias set spark spark-cli

rm -rf /workspaces/spark-template/spark-sdk-dist

cd /workspaces/spark-tools
npm i
Expand All @@ -65,11 +56,3 @@ npm i -f /workspaces/spark-tools



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"
6 changes: 3 additions & 3 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ fi

echo "Deploying as ${GITHUB_USER} to ${GITHUB_RUNTIME_PERMANENT_NAME}"

gh runtime create \
gh spark create \
--app ${GITHUB_RUNTIME_PERMANENT_NAME} \
--env "GITHUB_RUNTIME_PERMANENT_NAME=${GITHUB_RUNTIME_PERMANENT_NAME}" \
--secret "GITHUB_TOKEN=${GITHUB_TOKEN}" \

gh runtime deploy \
gh spark deploy \
--app ${GITHUB_RUNTIME_PERMANENT_NAME} \
--dir dist

DEPLOYED_URL="$(gh runtime get --app ${GITHUB_RUNTIME_PERMANENT_NAME})"
DEPLOYED_URL="$(gh spark get --app ${GITHUB_RUNTIME_PERMANENT_NAME})"

echo "[--URL-App=[https://${DEPLOYED_URL}]--]"
echo "[--Deployment: Complete--]"
Loading