1+ #! /bin/bash
2+ set -e
3+
4+ # Download Amazon Q artifacts for IDE integration
5+ # Usage: download_amazon_q_artifacts.sh <version> <target_dir> <ide_type>
6+ # Example: download_amazon_q_artifacts.sh 1.25.0 /etc/amazon-q/artifacts/agentic-chat jupyterlab
7+
8+ VERSION=${1:- $FLARE_SERVER_VERSION_JL }
9+ TARGET_DIR=${2:- " /etc/amazon-q-agentic-chat/artifacts/jupyterlab" }
10+ IDE_TYPE=${3:- " jupyterlab" }
11+
12+ if [ -z " $VERSION " ]; then
13+ echo " Error: Version not specified and FLARE_SERVER_VERSION_JL not set"
14+ exit 1
15+ fi
16+
17+ echo " Downloading Amazon Q artifacts for $IDE_TYPE (version: $VERSION )"
18+
19+ # Create target directories
20+ sudo mkdir -p " $TARGET_DIR "
21+
22+ # Download manifest and extract artifact URLs
23+ MANIFEST_URL=" https://aws-toolkit-language-servers.amazonaws.com/qAgenticChatServer/0/manifest.json"
24+ curl -L --retry 3 --retry-delay 5 --fail " $MANIFEST_URL " -o " /tmp/manifest.json" || {
25+ echo " Failed to download manifest"
26+ exit 1
27+ }
28+
29+ # Extract artifact URLs
30+ ARTIFACT_URLS=$( python3 /tmp/extract_amazon_q_agentic_chat_urls.py /tmp/manifest.json " $VERSION " )
31+ if [ $? -ne 0 ] || [ -z " $ARTIFACT_URLS " ]; then
32+ echo " Failed to extract Amazon Q artifact URLs"
33+ exit 1
34+ fi
35+
36+ eval " $ARTIFACT_URLS "
37+
38+ # Download and extract servers.zip
39+ echo " Downloading servers.zip..."
40+ curl -L --retry 3 --retry-delay 5 --fail " $SERVERS_URL " -o " /tmp/servers.zip" || {
41+ echo " Failed to download servers.zip"
42+ exit 1
43+ }
44+ sudo unzip " /tmp/servers.zip" -d " $TARGET_DIR /servers" || {
45+ echo " Failed to extract servers.zip"
46+ exit 1
47+ }
48+
49+ # Download and extract clients.zip
50+ echo " Downloading clients.zip..."
51+ curl -L --retry 3 --retry-delay 5 --fail " $CLIENTS_URL " -o " /tmp/clients.zip" || {
52+ echo " Failed to download clients.zip"
53+ exit 1
54+ }
55+ sudo unzip " /tmp/clients.zip" -d " $TARGET_DIR /clients" || {
56+ echo " Failed to extract clients.zip"
57+ exit 1
58+ }
59+
60+ # Clean up temporary files
61+ rm -f /tmp/manifest.json /tmp/servers.zip /tmp/clients.zip
62+
63+ echo " Amazon Q artifacts downloaded successfully to $TARGET_DIR "
0 commit comments