Repository navigation
Rename linux-x64 artifacts to linux_x64 and add setup scripts #310
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| FROM alpine:latest | ||
|
|
||
| RUN apk update \ | ||
| && apk upgrade \ | ||
| && apk add --update openjdk11 tzdata curl unzip bash \ | ||
| && rm -rf /var/cache/apk/* | ||
|
|
||
| RUN mkdir /opt/rosetta | ||
| COPY binary/build/image/binary-linux-x64 /opt/rosetta/ | ||
| FROM alpine:latest | ||
| RUN apk update \ | ||
| && apk upgrade \ | ||
| && apk add --update openjdk11 tzdata curl unzip bash \ | ||
| && rm -rf /var/cache/apk/* | ||
| RUN mkdir /opt/rosetta | ||
| COPY binary/build/image/binary-linux_x64 /opt/rosetta/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| @echo off | ||
| REM Define the Rosetta version | ||
| set ROSETTA_VERSION=__ROSETTA_VERSION__ | ||
| set "ARCH=win_x64" | ||
| set ZIP_FILE=rosetta-%ROSETTA_VERSION%-win_x64.zip | ||
| set EXTRACTION_DIR=rosetta-%ROSETTA_VERSION%-win_x64 | ||
|
|
||
| set URL=https://github.com/AdaptiveScale/rosetta/releases/download/v%ROSETTA_VERSION%/%ZIP_FILE% | ||
|
|
||
| REM Download the ZIP file using curl (replace with wget if installed) | ||
| echo Downloading %ZIP_FILE%... | ||
| curl -L -o "%ZIP_FILE%" "%URL%" | ||
| if not %errorlevel%==0 ( | ||
| echo Download failed. Exiting. | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| REM Extract the ZIP file | ||
| echo Extracting %ZIP_FILE%... | ||
| powershell -Command "Expand-Archive -Path '%ZIP_FILE%' -DestinationPath '%EXTRACTION_DIR%'" | ||
| if not %errorlevel%==0 ( | ||
| echo Extraction failed. Exiting. | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| REM Cleanup: Remove the ZIP file | ||
| echo Cleaning up... | ||
| del "%ZIP_FILE%" | ||
|
|
||
| REM Add the directory to PATH | ||
| set "EXTRACTION_DIR=%CD%\%EXTRACTION_DIR%\%EXTRACTION_DIR%\bin" | ||
| if exist "%EXTRACTION_DIR%" ( | ||
| echo Adding %EXTRACTION_DIR% to PATH... | ||
| set "PATH=%NEW_VALUE%;%PATH%" | ||
| setx PATH "%EXTRACTION_DIR%;%PATH%" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift Do not persist the expanded process PATH with If the existing PATH plus 🤖 Prompt for AI Agents |
||
| ) else ( | ||
| echo Directory %EXTRACTION_DIR% does not exist. Exiting. | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| REM Prompt for project name with a default value | ||
| set /p PROJECT_NAME="Enter the project name (default: my_rosetta_project): " | ||
| if "%PROJECT_NAME%"=="" set PROJECT_NAME=my_rosetta_project | ||
|
|
||
| REM Run the Rosetta init command | ||
| echo Initializing Rosetta project: %PROJECT_NAME%... | ||
| rosetta init "%PROJECT_NAME%" | ||
| if not %errorlevel%==0 ( | ||
| echo Failed to initialize Rosetta project. Please check for errors. | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| echo Rosetta project '%PROJECT_NAME%' initialized successfully. | ||
| echo Next steps: | ||
| echo 1. Navigate to the project directory: cd %PROJECT_NAME% | ||
| echo 2. Configure your database connections in the 'main.conf' file inside the project directory. | ||
| echo 3. Start using Rosetta commands. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Define the Rosetta version | ||
| ROSETTA_VERSION="__ROSETTA_VERSION__" | ||
|
|
||
| # Determine the OS and Architecture | ||
| OS=$(uname -s) | ||
| ARCH=$(uname -m) | ||
|
|
||
| # Initialize variables | ||
| URL="" | ||
| ZIP_FILE="" | ||
| EXTRACTION_DIR="" | ||
|
|
||
| # Set URL, ZIP_FILE, and EXTRACTION_DIR based on OS and ARCH | ||
| if [[ "$OS" == "Darwin" ]]; then | ||
| if [[ "$ARCH" == "arm64" ]]; then | ||
| echo "Running on macOS (ARM architecture)" | ||
| ZIP_FILE="rosetta-${ROSETTA_VERSION}-mac_aarch64.zip" | ||
| EXTRACTION_DIR="rosetta-${ROSETTA_VERSION}-mac_aarch64" | ||
| elif [[ "$ARCH" == "x86_64" ]]; then | ||
| echo "Running on macOS (Intel architecture)" | ||
| ZIP_FILE="rosetta-${ROSETTA_VERSION}-mac_x64.zip" | ||
| EXTRACTION_DIR="rosetta-${ROSETTA_VERSION}-mac_x64" | ||
| else | ||
| echo "Unknown architecture on macOS: $ARCH" | ||
| exit 1 | ||
| fi | ||
| elif [[ "$OS" == "Linux" ]]; then | ||
| echo "Running on Linux" | ||
| if [[ "$ARCH" == "x86_64" ]]; then | ||
| ZIP_FILE="rosetta-${ROSETTA_VERSION}-linux_x64.zip" | ||
| EXTRACTION_DIR="rosetta-${ROSETTA_VERSION}-linux_x64" | ||
| URL="https://github.com/AdaptiveScale/rosetta/releases/download/v${ROSETTA_VERSION}/${ZIP_FILE}" | ||
| elif [[ "$ARCH" == "arm64" ]]; then | ||
| ZIP_FILE="rosetta-${ROSETTA_VERSION}-linux_aarch64.zip" | ||
| EXTRACTION_DIR="rosetta-${ROSETTA_VERSION}-linux_aarch64" | ||
|
Comment on lines
+35
to
+37
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: cat scripts/github_release.sh
sed -n '1,50p' scripts/templates/rosetta_setup.sh
grep -n 'linux\|aarch\|arm' binary/build.gradleRepository: rosettadb/rosetta Length of output: 5795 Publish the Linux ARM64 archive or remove the unsupported setup branch. On Linux ARM64, If Add 🤖 Prompt for AI Agents |
||
| else | ||
| echo "Unknown architecture on Linux: $ARCH" | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "Unsupported OS: $OS" | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
||
| URL="https://github.com/AdaptiveScale/rosetta/releases/download/v${ROSETTA_VERSION}/${ZIP_FILE}" | ||
|
|
||
| # Download the ZIP file using wget | ||
| echo "Downloading $ZIP_FILE..." | ||
| wget -q --show-progress "$URL" -O "$ZIP_FILE" | ||
|
|
||
| # Check if the download was successful | ||
| if [ $? -eq 0 ]; then | ||
| echo "Download complete." | ||
| else | ||
| echo "Download failed. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Extract the ZIP file | ||
| echo "Extracting $ZIP_FILE..." | ||
| unzip -q "$ZIP_FILE" -d "$EXTRACTION_DIR" | ||
|
|
||
| # Check if the extraction was successful | ||
| if [ $? -eq 0 ]; then | ||
| echo "Extraction complete. Files are in $EXTRACTION_DIR." | ||
| else | ||
| echo "Extraction failed. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Cleanup: Remove the ZIP file (optional) | ||
| echo "Cleaning up..." | ||
| rm -f "$ZIP_FILE" | ||
|
|
||
| # Define the directory to add to PATH | ||
| EXTRACTION_DIR="$PWD/$EXTRACTION_DIR/$EXTRACTION_DIR/bin" | ||
|
|
||
| # Check if the directory exists | ||
| if [ -d "$EXTRACTION_DIR" ]; then | ||
| echo "Adding $EXTRACTION_DIR to PATH..." | ||
| else | ||
| echo "Directory $EXTRACTION_DIR does not exist. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Check if the directory exists | ||
| if [ ! -d "$EXTRACTION_DIR" ]; then | ||
| echo "Directory $EXTRACTION_DIR does not exist. Exiting." | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Detect the appropriate shell configuration file | ||
| SHELL_CONFIG="" | ||
| if [ -n "$ZSH_VERSION" ]; then | ||
| SHELL_CONFIG="$HOME/.zshrc" | ||
| elif [ -n "$BASH_VERSION" ]; then | ||
| SHELL_CONFIG="$HOME/.bashrc" | ||
|
Comment on lines
+97
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Select the user’s shell startup file, not the script interpreter’s file. This script runs under Bash, so 🤖 Prompt for AI Agents |
||
| fi | ||
|
|
||
| if [ -z "$SHELL_CONFIG" ]; then | ||
| echo "Could not determine shell configuration file. Add the following line manually:" | ||
| echo "export PATH=\"$EXTRACTION_DIR:\$PATH\"" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Backup the shell configuration file | ||
| echo "Creating a backup of $SHELL_CONFIG..." | ||
| cp "$SHELL_CONFIG" "$SHELL_CONFIG.bak" | ||
|
|
||
| # Check for an existing Rosetta PATH line and replace it if found | ||
| if grep -q "export PATH=.*rosetta" "$SHELL_CONFIG"; then | ||
| echo "Replacing existing Rosetta PATH in $SHELL_CONFIG..." | ||
| sed -i.bak "/export PATH=.*rosetta/d" "$SHELL_CONFIG" | ||
| else | ||
| echo "No existing Rosetta PATH found in $SHELL_CONFIG." | ||
| fi | ||
|
|
||
| # Add the new PATH line for Rosetta | ||
| echo "Adding new PATH for Rosetta to $SHELL_CONFIG..." | ||
| echo "export PATH=\"$EXTRACTION_DIR:\$PATH\"" >> "$SHELL_CONFIG" | ||
|
|
||
| # echo "PATH updated. Restart your terminal or run 'source $SHELL_CONFIG' to apply." | ||
|
|
||
| # Apply the changes to the current session | ||
| echo "Sourcing $SHELL_CONFIG..." | ||
| source "$SHELL_CONFIG" | ||
|
|
||
| # Prompt for project name with a default value | ||
| DEFAULT_PROJECT_NAME="my_rosetta_project" | ||
| read -p "Enter the project name (default: $DEFAULT_PROJECT_NAME): " PROJECT_NAME | ||
| PROJECT_NAME=${PROJECT_NAME:-$DEFAULT_PROJECT_NAME} | ||
|
|
||
| # Run the Rosetta init command | ||
| echo "Initializing Rosetta project: $PROJECT_NAME..." | ||
| rosetta init "$PROJECT_NAME" | ||
|
|
||
| if [ $? -eq 0 ]; then | ||
| echo "Rosetta project '$PROJECT_NAME' initialized successfully." | ||
| echo "Next steps:" | ||
| echo "1. Navigate to the project directory: cd $PROJECT_NAME" | ||
| echo "2. Configure your database connections in the 'main.conf' file inside the project directory." | ||
| echo "3. Start using Rosetta commands" | ||
| else | ||
| echo "Failed to initialize Rosetta project. Please check for errors." | ||
| fi | ||
|
Comment on lines
+146
to
+148
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Return a failure status when initialization fails. If 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Set PATH in the running setup process before invoking
rosetta init. Neither template reliably adds the extractedbindirectory to its current process PATH. Persistent configuration alone cannot prepare the invocation in the same run. (learn.microsoft.com)scripts/templates/rosetta_setup.bat#L34-L34: replace the undefinedNEW_VALUEwithEXTRACTION_DIRwhen setting the current PATH.scripts/templates/rosetta_setup.sh#L129-L129: exportEXTRACTION_DIRto PATH directly rather than relying on sourcing.bashrc.📍 Affects 2 files
scripts/templates/rosetta_setup.bat#L34-L34(this comment)scripts/templates/rosetta_setup.sh#L129-L129🤖 Prompt for AI Agents