generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 90
feat: Handle Amazon Q Agentic Chat artifacts in v2.9.5 and other build improvements #945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c9cd8ad
feat: Handle Amazon Q Agentic Chat artifacts in v2.9.5 and other build
44b55d2
Handle Amazon Q Agentic Chat version for JupyterLab
1c8e7f7
Make Amazon Q Agentic Chat artifact downloads more modular
88f3ccf
Handle common web client library downloads directly in Dockerfile
ea617b2
Unit test updates on recent changes for handling Amazon Q artifacts
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Assets | ||
|
||
This directory contains utility scripts and files used during the Docker image build process. | ||
|
||
## extract_amazon_q_agentic_chat_urls.py | ||
|
||
A Python script that extracts Amazon Q Agentic Chat artifact URLs from a manifest file for Linux x64 platform. | ||
|
||
### Usage | ||
```bash | ||
python extract_amazon_q_agentic_chat_urls.py <manifest_file> <version> | ||
``` | ||
|
||
### Parameters | ||
- `manifest_file`: Path to the JSON manifest file containing artifact information | ||
- `version`: The server version to extract artifacts for | ||
|
||
### Output | ||
The script outputs environment variables for use in shell scripts: | ||
- `SERVERS_URL`: URL for the servers.zip artifact | ||
- `CLIENTS_URL`: URL for the clients.zip artifact | ||
|
||
## download_amazon_q_agentic_chat_artifacts.sh | ||
|
||
A modular shell script that downloads and extracts Amazon Q Agentic Chat artifacts for IDE integration. | ||
|
||
### Usage | ||
```bash | ||
bash download_amazon_q_agentic_chat_artifacts.sh <version> <target_dir> <ide_type> | ||
``` | ||
|
||
### Parameters | ||
- `version`: Amazon Q server version (defaults to $FLARE_SERVER_VERSION_JL) | ||
- `target_dir`: Target directory for artifacts (defaults to /etc/amazon-q-agentic-chat/artifacts/jupyterlab) | ||
- `ide_type`: IDE type for logging (defaults to jupyterlab) | ||
|
||
### Features | ||
- Downloads JSZip library to shared web client location (/etc/web-client/libs/) for reuse across all web applications | ||
- Modular design supports future VSCode integration | ||
- Comprehensive error handling with retry logic | ||
- Automatic cleanup of temporary files | ||
|
||
### Directory Structure | ||
- `/etc/web-client/libs/` - Shared web client libraries (JSZip, etc.) for any web application | ||
- `/etc/amazon-q-agentic-chat/artifacts/jupyterlab/` - Amazon Q specific artifacts for JupyterLab | ||
- `/etc/amazon-q-agentic-chat/artifacts/vscode/` - Future Amazon Q artifacts for VSCode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Download Amazon Q artifacts for IDE integration | ||
# Usage: download_amazon_q_artifacts.sh <version> <target_dir> <ide_type> | ||
# Example: download_amazon_q_artifacts.sh 1.25.0 /etc/amazon-q/artifacts/agentic-chat jupyterlab | ||
|
||
VERSION=${1:-$FLARE_SERVER_VERSION_JL} | ||
TARGET_DIR=${2:-"/etc/amazon-q-agentic-chat/artifacts/jupyterlab"} | ||
IDE_TYPE=${3:-"jupyterlab"} | ||
|
||
if [ -z "$VERSION" ]; then | ||
echo "Error: Version not specified and FLARE_SERVER_VERSION_JL not set" | ||
exit 1 | ||
fi | ||
|
||
echo "Downloading Amazon Q artifacts for $IDE_TYPE (version: $VERSION)" | ||
|
||
# Create target directories | ||
sudo mkdir -p "$TARGET_DIR" | ||
|
||
# Download manifest and extract artifact URLs | ||
MANIFEST_URL="https://aws-toolkit-language-servers.amazonaws.com/qAgenticChatServer/0/manifest.json" | ||
curl -L --retry 3 --retry-delay 5 --fail "$MANIFEST_URL" -o "/tmp/manifest.json" || { | ||
echo "Failed to download manifest" | ||
exit 1 | ||
} | ||
|
||
# Extract artifact URLs | ||
ARTIFACT_URLS=$(python3 /tmp/extract_amazon_q_agentic_chat_urls.py /tmp/manifest.json "$VERSION") | ||
if [ $? -ne 0 ] || [ -z "$ARTIFACT_URLS" ]; then | ||
echo "Failed to extract Amazon Q artifact URLs" | ||
exit 1 | ||
fi | ||
|
||
eval "$ARTIFACT_URLS" | ||
|
||
# Download and extract servers.zip | ||
echo "Downloading servers.zip..." | ||
curl -L --retry 3 --retry-delay 5 --fail "$SERVERS_URL" -o "/tmp/servers.zip" || { | ||
echo "Failed to download servers.zip" | ||
exit 1 | ||
} | ||
sudo unzip "/tmp/servers.zip" -d "$TARGET_DIR/servers" || { | ||
echo "Failed to extract servers.zip" | ||
exit 1 | ||
} | ||
|
||
# Download and extract clients.zip | ||
echo "Downloading clients.zip..." | ||
curl -L --retry 3 --retry-delay 5 --fail "$CLIENTS_URL" -o "/tmp/clients.zip" || { | ||
echo "Failed to download clients.zip" | ||
exit 1 | ||
} | ||
sudo unzip "/tmp/clients.zip" -d "$TARGET_DIR/clients" || { | ||
echo "Failed to extract clients.zip" | ||
exit 1 | ||
} | ||
|
||
# Clean up temporary files | ||
rm -f /tmp/manifest.json /tmp/servers.zip /tmp/clients.zip | ||
|
||
echo "Amazon Q artifacts downloaded successfully to $TARGET_DIR" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/usr/bin/env python3 | ||
"""Extract Amazon Q artifact URLs from manifest for Linux x64 platform.""" | ||
|
||
import json | ||
import sys | ||
|
||
def extract_urls(manifest_file, version, platform='linux', arch='x64'): | ||
"""Extract servers.zip and clients.zip URLs for specified platform/arch.""" | ||
try: | ||
with open(manifest_file) as f: | ||
manifest = json.load(f) | ||
except FileNotFoundError: | ||
raise FileNotFoundError(f"Manifest file not found: {manifest_file}") | ||
except json.JSONDecodeError as e: | ||
raise ValueError(f"Invalid JSON in manifest file {manifest_file}: {str(e)}") | ||
|
||
for ver in manifest['versions']: | ||
if ver['serverVersion'] == version: | ||
for target in ver['targets']: | ||
if target['platform'] == platform and target.get('arch') == arch: | ||
servers_url = None | ||
clients_url = None | ||
|
||
for content in target['contents']: | ||
if content['filename'] == 'servers.zip': | ||
servers_url = content['url'] | ||
elif content['filename'] == 'clients.zip': | ||
clients_url = content['url'] | ||
|
||
if servers_url is None or clients_url is None: | ||
raise ValueError(f"Required files (servers.zip/clients.zip) not found for version {version} {platform} {arch}") | ||
|
||
return servers_url, clients_url | ||
|
||
raise ValueError(f"Version {version} not found for {platform} {arch}") | ||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) != 3: | ||
print("Usage: extract_amazon_q_agentic_chat_urls.py <manifest_file> <version>") | ||
sys.exit(1) | ||
|
||
manifest_file, version = sys.argv[1], sys.argv[2] | ||
servers_url, clients_url = extract_urls(manifest_file, version) | ||
|
||
print(f"SERVERS_URL={servers_url}") | ||
print(f"CLIENTS_URL={clients_url}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
build_artifacts/v2/v2.9/v2.9.5/download_amazon_q_agentic_chat_artifacts.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Download Amazon Q artifacts for IDE integration | ||
# Usage: download_amazon_q_artifacts.sh <version> <target_dir> <ide_type> | ||
# Example: download_amazon_q_artifacts.sh 1.25.0 /etc/amazon-q/artifacts/agentic-chat jupyterlab | ||
|
||
VERSION=${1:-$FLARE_SERVER_VERSION_JL} | ||
TARGET_DIR=${2:-"/etc/amazon-q-agentic-chat/artifacts/jupyterlab"} | ||
IDE_TYPE=${3:-"jupyterlab"} | ||
|
||
if [ -z "$VERSION" ]; then | ||
echo "Error: Version not specified and FLARE_SERVER_VERSION_JL not set" | ||
exit 1 | ||
fi | ||
|
||
echo "Downloading Amazon Q artifacts for $IDE_TYPE (version: $VERSION)" | ||
|
||
# Create target directories | ||
sudo mkdir -p "$TARGET_DIR" | ||
|
||
# Download manifest and extract artifact URLs | ||
MANIFEST_URL="https://aws-toolkit-language-servers.amazonaws.com/qAgenticChatServer/0/manifest.json" | ||
curl -L --retry 3 --retry-delay 5 --fail "$MANIFEST_URL" -o "/tmp/manifest.json" || { | ||
echo "Failed to download manifest" | ||
exit 1 | ||
} | ||
|
||
# Extract artifact URLs | ||
ARTIFACT_URLS=$(python3 /tmp/extract_amazon_q_agentic_chat_urls.py /tmp/manifest.json "$VERSION") | ||
if [ $? -ne 0 ] || [ -z "$ARTIFACT_URLS" ]; then | ||
echo "Failed to extract Amazon Q artifact URLs" | ||
exit 1 | ||
fi | ||
|
||
eval "$ARTIFACT_URLS" | ||
|
||
# Download and extract servers.zip | ||
echo "Downloading servers.zip..." | ||
curl -L --retry 3 --retry-delay 5 --fail "$SERVERS_URL" -o "/tmp/servers.zip" || { | ||
echo "Failed to download servers.zip" | ||
exit 1 | ||
} | ||
sudo unzip "/tmp/servers.zip" -d "$TARGET_DIR/servers" || { | ||
echo "Failed to extract servers.zip" | ||
exit 1 | ||
} | ||
|
||
# Download and extract clients.zip | ||
echo "Downloading clients.zip..." | ||
curl -L --retry 3 --retry-delay 5 --fail "$CLIENTS_URL" -o "/tmp/clients.zip" || { | ||
echo "Failed to download clients.zip" | ||
exit 1 | ||
} | ||
sudo unzip "/tmp/clients.zip" -d "$TARGET_DIR/clients" || { | ||
echo "Failed to extract clients.zip" | ||
exit 1 | ||
} | ||
|
||
# Clean up temporary files | ||
rm -f /tmp/manifest.json /tmp/servers.zip /tmp/clients.zip | ||
|
||
echo "Amazon Q artifacts downloaded successfully to $TARGET_DIR" |
41 changes: 41 additions & 0 deletions
41
build_artifacts/v2/v2.9/v2.9.5/extract_amazon_q_agentic_chat_urls.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python3 | ||
"""Extract Amazon Q artifact URLs from manifest for Linux x64 platform.""" | ||
|
||
import json | ||
import sys | ||
|
||
def extract_urls(manifest_file, version, platform='linux', arch='x64'): | ||
"""Extract servers.zip and clients.zip URLs for specified platform/arch.""" | ||
with open(manifest_file) as f: | ||
manifest = json.load(f) | ||
|
||
for ver in manifest['versions']: | ||
if ver['serverVersion'] == version: | ||
for target in ver['targets']: | ||
if target['platform'] == platform and target.get('arch') == arch: | ||
servers_url = None | ||
clients_url = None | ||
|
||
for content in target['contents']: | ||
if content['filename'] == 'servers.zip': | ||
servers_url = content['url'] | ||
elif content['filename'] == 'clients.zip': | ||
clients_url = content['url'] | ||
|
||
if servers_url is None or clients_url is None: | ||
raise ValueError(f"Required files (servers.zip/clients.zip) not found for version {version} {platform} {arch}") | ||
|
||
return servers_url, clients_url | ||
|
||
raise ValueError(f"Version {version} not found for {platform} {arch}") | ||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) != 3: | ||
print("Usage: extract_amazon_q_agentic_chat_urls.py <manifest_file> <version>") | ||
sys.exit(1) | ||
|
||
manifest_file, version = sys.argv[1], sys.argv[2] | ||
servers_url, clients_url = extract_urls(manifest_file, version) | ||
|
||
print(f"SERVERS_URL={servers_url}") | ||
print(f"CLIENTS_URL={clients_url}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Directory Structure | ||
|
||
This document outlines the key directory structure used in SageMaker Distribution images. | ||
|
||
## Web Client Libraries | ||
|
||
### `/etc/web-client/libs/` | ||
Shared JavaScript libraries for all web applications in the container. | ||
|
||
**Contents:** | ||
- `jszip.min.js` - ZIP file handling library used by JupyterLab, VSCode, and other web clients | ||
|
||
**Usage:** | ||
Any web application can reference these shared libraries to avoid duplication. | ||
|
||
## Amazon Q Integration | ||
|
||
### `/etc/amazon-q/artifacts/` | ||
Amazon Q specific artifacts organized by IDE type. | ||
|
||
**Structure:** | ||
``` | ||
/etc/amazon-q-agentic-chat/ | ||
└── artifacts/ | ||
├── jupyterlab/ # JupyterLab integration | ||
│ ├── servers/ # Server-side artifacts | ||
│ └── clients/ # Client-side artifacts | ||
└── vscode/ # Future VSCode integration | ||
├── servers/ | ||
└── clients/ | ||
``` | ||
|
||
## Benefits | ||
|
||
1. **Reusability**: Shared libraries in `/etc/web-client/libs/` prevent duplication | ||
2. **Modularity**: Each IDE has its own artifact directory under `/etc/amazon-q/artifacts/` | ||
3. **Scalability**: Easy to add new IDEs or web applications | ||
4. **Maintainability**: Clear separation between shared and application-specific resources |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,4 +109,4 @@ | |
"image_type": "cpu", | ||
}, | ||
], | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.