diff --git a/.github/workflows/test-action.yml b/.github/workflows/test-action.yml new file mode 100644 index 0000000..31492b8 --- /dev/null +++ b/.github/workflows/test-action.yml @@ -0,0 +1,51 @@ +name: Test Action + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main ] + workflow_dispatch: + +env: + BL_ENV: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }} + BL_WORKSPACE: ${{ vars.BL_WORKSPACE }} + BL_API_KEY: ${{ secrets.BL_API_KEY }} + +jobs: + test-action: + environment: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Test bl-action + uses: ./ # This references the action in the current repo + with: + workspace: ${{ vars.BL_WORKSPACE }} + apikey: ${{ secrets.BL_API_KEY }} + - name: List agents + run: bl get agents + - name: List functions + run: bl get functions + - name: List models + run: bl get models + - name: List sandboxes + run: bl get sandboxes + + test-matrix: + runs-on: ${{ matrix.os }} + environment: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }} + strategy: + matrix: + os: [ubuntu-latest] + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Test on ${{ matrix.os }} + uses: ./ + with: + workspace: ${{ vars.BL_WORKSPACE }} + apikey: ${{ secrets.BL_API_KEY }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index ce7d65f..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Test - -on: - workflow_dispatch: - -jobs: - test: - runs-on: ubuntu-latest - env: - TAVILY_API_KEY: ${{ secrets.TAVILY_API_KEY }} - GH_PAT: ${{ secrets.GH_PAT }} - MISTRAL_API_KEY: ${{ secrets.MISTRAL_API_KEY }} - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - HF_API_TOKEN: ${{ secrets.HF_API_TOKEN }} - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }} - XAI_API_KEY: ${{ secrets.XAI_API_KEY }} - steps: - - uses: actions/checkout@v4 - - uses: blaxel/blaxel-action@v1 - with: - workspace: main - apikey: ${{ secrets.BL_API_KEY }} - deploy: blaxel - - name: List policies - run: bl get policies - - name: List models - run: bl get models - - name: List functions - run: bl get functions - - name: List agents - run: bl get agents diff --git a/README.md b/README.md index 657929d..d45f743 100644 --- a/README.md +++ b/README.md @@ -56,4 +56,4 @@ Contributions are welcome! Please open an issue or submit a pull request for any ## Support -For any questions or issues, please open an issue in this repository. +For any questions or issues, please open an issue in this repository. \ No newline at end of file diff --git a/action.yml b/action.yml index fe46efc..3fe801a 100644 --- a/action.yml +++ b/action.yml @@ -18,18 +18,122 @@ inputs: runs: using: "composite" steps: + - name: Checkout toolkit repository + uses: actions/checkout@v4 + with: + repository: blaxel-ai/toolkit + path: .bl-toolkit + clean: false - name: Install blaxel shell: bash run: | mkdir -p $HOME/.local/bin - if [ "$BL_ENV" = "dev" ]; then - curl -fsSL https://raw.githubusercontent.com/blaxel-ai/toolkit/main/install.sh | BINDIR=$HOME/.local/bin sh + # Function to download with multiple fallback methods + download_with_fallbacks() { + local repo=$1 + local path=$2 + local output_file=$3 + local max_attempts=3 + + echo "Downloading installation script..." + + # Method 1: Use locally checked out file (most reliable) + if [ -f ".bl-toolkit/$path" ]; then + echo "Using locally checked out installation script..." + cp ".bl-toolkit/$path" "$output_file" + echo "✓ Using local checkout" + return 0 + fi + + # Method 2: GitHub API (fallback) + echo "Trying GitHub API..." + if curl -fsSL \ + --connect-timeout 30 \ + --max-time 300 \ + -H "Accept: application/vnd.github.v3.raw" \ + -H "User-Agent: bl-action" \ + "https://api.github.com/repos/$repo/contents/$path" \ + -o "$output_file" 2>/dev/null; then + echo "✓ Downloaded via GitHub API" + return 0 + fi + + # Method 3: raw.githubusercontent.com with explicit TLS + echo "Trying raw.githubusercontent.com with TLS 1.2..." + if curl -fsSL \ + --connect-timeout 30 \ + --max-time 300 \ + --tlsv1.2 \ + -H "User-Agent: bl-action" \ + "https://raw.githubusercontent.com/$repo/main/$path" \ + -o "$output_file" 2>/dev/null; then + echo "✓ Downloaded via raw.githubusercontent.com" + return 0 + fi + + # Method 4: wget with different user agent + echo "Trying wget..." + if command -v wget >/dev/null 2>&1; then + if wget --secure-protocol=TLSv1_2 \ + --timeout=30 \ + --tries=1 \ + --user-agent="bl-action" \ + -O "$output_file" \ + "https://raw.githubusercontent.com/$repo/main/$path" 2>/dev/null; then + echo "✓ Downloaded via wget" + return 0 + fi + fi + + # Method 5: GitHub tarball extraction (last resort) + echo "Trying GitHub tarball extraction..." + local temp_dir="/tmp/bl-install-$$" + mkdir -p "$temp_dir" + + if curl -fsSL \ + --connect-timeout 30 \ + --max-time 300 \ + -H "User-Agent: bl-action" \ + "https://api.github.com/repos/$repo/tarball/main" | \ + tar -xz -C "$temp_dir" --strip-components=1 2>/dev/null; then + + if [ -f "$temp_dir/$path" ]; then + cp "$temp_dir/$path" "$output_file" + rm -rf "$temp_dir" + echo "✓ Downloaded via tarball extraction" + return 0 + fi + fi + + rm -rf "$temp_dir" + return 1 + } + + # Download the installation script with fallback methods + INSTALL_SCRIPT="/tmp/install.sh" + + if download_with_fallbacks "blaxel-ai/toolkit" "install.sh" "$INSTALL_SCRIPT"; then + chmod +x "$INSTALL_SCRIPT" + BINDIR=$HOME/.local/bin sh "$INSTALL_SCRIPT" else - curl -fsSL https://raw.githubusercontent.com/blaxel-ai/toolkit/main/install.sh | BINDIR=$HOME/.local/bin sh + echo "Error: Failed to download installation script with all methods" + echo "Please check your network connection and GitHub access" + exit 1 fi + + # Verify installation + if [ ! -f "$HOME/.local/bin/blaxel" ]; then + echo "Error: blaxel installation failed" + exit 1 + fi + + # Create symlink and add to PATH cp $HOME/.local/bin/blaxel $HOME/.local/bin/bl echo "$HOME/.local/bin" >> $GITHUB_PATH + + # Clean up checkout + rm -rf .bl-toolkit - name: Login to Blaxel shell: bash env: diff --git a/blaxel/0-integration-connection/anthropic-beamlit-organization.yml b/blaxel/0-integration-connection/anthropic-beamlit-organization.yml deleted file mode 100644 index 40e447a..0000000 --- a/blaxel/0-integration-connection/anthropic-beamlit-organization.yml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: IntegrationConnection -metadata: - name: anthropic-blaxel-organization -spec: - integration: anthropic - secret: - apiKey: ${ANTHROPIC_API_KEY} diff --git a/blaxel/0-integration-connection/cohere-beamlit-organization.yaml b/blaxel/0-integration-connection/cohere-beamlit-organization.yaml deleted file mode 100644 index b8804da..0000000 --- a/blaxel/0-integration-connection/cohere-beamlit-organization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: IntegrationConnection -metadata: - name: cohere-blaxel-organization -spec: - integration: cohere - secret: - apiKey: ${COHERE_API_KEY} diff --git a/blaxel/0-integration-connection/hf-beamlit-organization.yml b/blaxel/0-integration-connection/hf-beamlit-organization.yml deleted file mode 100644 index f3ab75c..0000000 --- a/blaxel/0-integration-connection/hf-beamlit-organization.yml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: IntegrationConnection -metadata: - name: hf-blaxel-organization -spec: - integration: huggingface - secret: - apiKey: ${HF_API_TOKEN} diff --git a/blaxel/0-integration-connection/mistral-beamlit-organization.yml b/blaxel/0-integration-connection/mistral-beamlit-organization.yml deleted file mode 100644 index 9bc4cc9..0000000 --- a/blaxel/0-integration-connection/mistral-beamlit-organization.yml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: IntegrationConnection -metadata: - name: mistral-blaxel-organization -spec: - integration: mistral - secret: - apiKey: ${MISTRAL_API_KEY} diff --git a/blaxel/0-integration-connection/openai-beamlit-organization.yml b/blaxel/0-integration-connection/openai-beamlit-organization.yml deleted file mode 100644 index 8969474..0000000 --- a/blaxel/0-integration-connection/openai-beamlit-organization.yml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: IntegrationConnection -metadata: - name: openai-blaxel-organization -spec: - integration: openai - secret: - apiKey: ${OPENAI_API_KEY} diff --git a/blaxel/0-integration-connection/xai-beamlit-organization.yaml b/blaxel/0-integration-connection/xai-beamlit-organization.yaml deleted file mode 100644 index eafa2f5..0000000 --- a/blaxel/0-integration-connection/xai-beamlit-organization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: IntegrationConnection -metadata: - name: xai-blaxel-organization -spec: - integration: xai - secret: - apiKey: ${XAI_API_KEY} diff --git a/blaxel/0-policies/eu-and-na.yml b/blaxel/0-policies/eu-and-na.yml deleted file mode 100644 index 4c30d3b..0000000 --- a/blaxel/0-policies/eu-and-na.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Policy -metadata: - name: eu-and-na - displayName: EU and NA -spec: - type: location - flavors: [] - locations: - - name: eu - type: continent - - name: na - type: continent \ No newline at end of file diff --git a/blaxel/0-policies/only-eu.yml b/blaxel/0-policies/only-eu.yml deleted file mode 100644 index 30bbc66..0000000 --- a/blaxel/0-policies/only-eu.yml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Policy -metadata: - name: only-eu - displayName: Only EU -spec: - type: location - locations: - - name: eu - type: continent \ No newline at end of file diff --git a/blaxel/0-policies/only-us.yml b/blaxel/0-policies/only-us.yml deleted file mode 100644 index f870514..0000000 --- a/blaxel/0-policies/only-us.yml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Policy -metadata: - name: only-us - displayName: Only US -spec: - type: location - flavors: [] - locations: - - name: na - type: continent \ No newline at end of file diff --git a/blaxel/1-models/all-minilm-l6-v2.yml b/blaxel/1-models/all-minilm-l6-v2.yml deleted file mode 100644 index a46297c..0000000 --- a/blaxel/1-models/all-minilm-l6-v2.yml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Model -metadata: - name: all-minilm-l6-v2 - displayName: All MiniLM L6 v2 -spec: - enabled: true - policies: ["only-eu"] - integrationConnections: - - hf-blaxel-organization - flavors: [] - runtime: - model: sentence-transformers/all-MiniLM-L6-v2 - type: huggingface diff --git a/blaxel/1-models/claude-35-sonnet.yml b/blaxel/1-models/claude-35-sonnet.yml deleted file mode 100644 index a71572f..0000000 --- a/blaxel/1-models/claude-35-sonnet.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Model -metadata: - name: claude-3-5-sonnet - displayName: Claude 3.5 Sonnet -spec: - enabled: true - policies: ["only-eu"] - integrationConnections: - - anthropic-blaxel-organization - runtime: - model: claude-3-5-sonnet-20241022 - type: anthropic diff --git a/blaxel/1-models/gpt-4o-mini.yml b/blaxel/1-models/gpt-4o-mini.yml deleted file mode 100644 index 2c87f8b..0000000 --- a/blaxel/1-models/gpt-4o-mini.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Model -metadata: - name: gpt-4o-mini - displayName: GPT 4o Mini -spec: - enabled: true - integrationConnections: - - openai-blaxel-organization - policies: ["only-eu"] - runtime: - model: gpt-4o-mini - type: openai diff --git a/blaxel/1-models/ministral-3b-2410.yml b/blaxel/1-models/ministral-3b-2410.yml deleted file mode 100644 index 535c03b..0000000 --- a/blaxel/1-models/ministral-3b-2410.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Model -metadata: - name: ministral-3b-2410 - displayName: Ministral 3b 2410 -spec: - enabled: true - policies: ["only-eu"] - integrationConnections: - - mistral-blaxel-organization - runtime: - model: ministral-3b-2410 - type: mistral diff --git a/blaxel/2-functions/github.yml b/blaxel/2-functions/github.yml deleted file mode 100644 index 21df091..0000000 --- a/blaxel/2-functions/github.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Function -metadata: - name: github - displayName: Github -spec: - enabled: true - policies: ["only-eu"] - configuration: - github_token: - value: ${GH_PAT} - secret: true - storeId: "github" \ No newline at end of file diff --git a/blaxel/2-functions/math.yml b/blaxel/2-functions/math.yml deleted file mode 100644 index 05e45bd..0000000 --- a/blaxel/2-functions/math.yml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Function -metadata: - name: math - displayName: Math -spec: - enabled: true - policies: ["only-eu"] - storeId: "math" diff --git a/blaxel/2-functions/search.yml b/blaxel/2-functions/search.yml deleted file mode 100644 index 7a8660f..0000000 --- a/blaxel/2-functions/search.yml +++ /dev/null @@ -1,13 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Function -metadata: - name: search - displayName: Search -spec: - enabled: true - policies: ["only-eu"] - configuration: - tavily_api_key: - value: ${TAVILY_API_KEY} - secret: true - storeId: "search" \ No newline at end of file diff --git a/blaxel/3-agents/agent-github.yml b/blaxel/3-agents/agent-github.yml deleted file mode 100644 index d32dbdc..0000000 --- a/blaxel/3-agents/agent-github.yml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Agent -metadata: - name: agent-github - displayName: Agent Github -spec: - functions: - - github - model: gpt-4o-mini - policies: ["only-eu"] - description: Agent to execute request on github repositories aside from controlplane and store - runtime: - image: ghcr.io/blaxel/agents/blaxel-agent:latest - resources: - limits: - memory: 128M - requests: - memory: 128M diff --git a/blaxel/3-agents/agent-gpt-4o-mini.yml b/blaxel/3-agents/agent-gpt-4o-mini.yml deleted file mode 100644 index 7e2cbfc..0000000 --- a/blaxel/3-agents/agent-gpt-4o-mini.yml +++ /dev/null @@ -1,24 +0,0 @@ -apiVersion: blaxel.ai/v1alpha1 -kind: Agent -metadata: - name: agent-gpt-4o-mini - displayName: Agent GPT 4o mini -spec: - enabled: true - policies: ["only-eu"] - functions: - - search - - math - agentChain: - - name: agent-github - enabled: true - description: "" - model: gpt-4o-mini - description: "" - runtime: - image: ghcr.io/blaxel/agents/blaxel-agent:latest - resources: - limits: - memory: 128M - requests: - memory: 128M