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
116 changes: 116 additions & 0 deletions .github/workflows/import-bssh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
name: Import bssh binary

on:
workflow_dispatch:
inputs:
tag:
description: "Release tag to download (e.g., v0.1.0). Leave empty for latest."
required: false
type: string
repository_dispatch:
types: [bssh-release]

permissions:
contents: write

jobs:
import-binary:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Get release tag
id: get-tag
run: |
if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
TAG="${{ github.event.client_payload.tag }}"
elif [ -n "${{ github.event.inputs.tag }}" ]; then
TAG="${{ github.event.inputs.tag }}"
else
# Get latest release tag
TAG=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" https://api.github.com/repos/lablup/bssh/releases/latest | jq -r .tag_name)
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "Using tag: $TAG"

- name: Download bssh binaries
run: |
TAG="${{ steps.get-tag.outputs.tag }}"
for ARCH in aarch64 x86_64; do
URL="https://github.com/lablup/bssh/releases/download/${TAG}/bssh-linux-${ARCH}-musl.tar.gz"
echo "Downloading from: $URL"
curl -fL -o bssh.tar.gz "$URL"
tar -xzf bssh.tar.gz
if [ -f "bssh" ]; then
mv bssh "bssh.${ARCH}.bin"
chmod +x "bssh.${ARCH}.bin"
echo "Binary extracted and renamed to bssh.${ARCH}.bin"
else
echo "Error: bssh binary not found in the archive for $ARCH"
exit 1
fi
rm -f bssh.tar.gz
done

- name: Move binaries to target location
run: |
TARGET_DIR="src/ai/backend/runner"
mkdir -p "${TARGET_DIR}"
# Move executable binaries
for ARCH in aarch64 x86_64; do
mv "bssh.${ARCH}.bin" "${TARGET_DIR}/"
echo "Binary moved to ${TARGET_DIR}/bssh.${ARCH}.bin"
ls -la "${TARGET_DIR}/bssh.${ARCH}.bin"
done
# Move manpages
mv bssh.1 "${TARGET_DIR}/"

- name: Add news fragment
run: |
echo "Update bssh binaries to ${{ steps.get-tag.outputs.tag }}" > changes/.deps.md

- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.OCTODOG }}
commit-message: "chore: Update bssh binaries to ${{ steps.get-tag.outputs.tag }}"
title: "deps: Update bssh binaries to ${{ steps.get-tag.outputs.tag }}"
author: "Lablup Octodog <[email protected]>"
body: |
This PR updates the bssh binaries (musl variant) for both aarch64 and x86_64 architectures to version ${{ steps.get-tag.outputs.tag }}.

Source: https://github.com/lablup/bssh/releases/tag/${{ steps.get-tag.outputs.tag }}

This update was triggered by:
- Event: ${{ github.event_name }}
${{ github.event_name == 'repository_dispatch' && '- Automated trigger from bssh repository release' || '- Manual workflow dispatch' }}
branch: deps/update-bssh-${{ steps.get-tag.outputs.tag }}
delete-branch: true

setup-webhook:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Instructions for automated trigger
run: |
echo "To enable automated triggers when bssh releases occur:"
echo ""
echo "1. Go to https://github.com/lablup/bssh/settings/hooks"
echo "2. Add a new webhook with:"
echo " - Payload URL: https://api.github.com/repos/${{ github.repository }}/dispatches"
echo " - Content type: application/json"
echo " - Secret: (generate a secure secret)"
echo " - Events: Select 'Releases'"
echo ""
echo "3. Configure the webhook payload:"
echo ' {'
echo ' "event_type": "bssh-release",'
echo ' "client_payload": {'
echo ' "tag": "{{ .Release.TagName }}"'
echo ' }'
echo ' }'
echo ""
echo "4. Add a GitHub Personal Access Token with 'repo' scope as a secret"
echo " in the webhook Authorization header:"
echo " Authorization: token YOUR_GITHUB_TOKEN"
1 change: 1 addition & 0 deletions changes/6452.misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bundle bssh as intrinsic binary in Backend.AI runner package
2 changes: 2 additions & 0 deletions src/ai/backend/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,8 @@ def mount_static_binary(
mount_static_binary("yank.sh", "/opt/kernel/yank.sh")
mount_static_binary(f"all-smi.{arch}.bin", "/usr/local/bin/all-smi")
mount_static_binary("all-smi.1", "/usr/local/share/man/man1/all-smi.1", skip_missing=True)
mount_static_binary(f"bssh.{arch}.bin", "/usr/local/bin/bssh")
mount_static_binary("bssh.1", "/usr/local/share/man/man1/bssh.1", skip_missing=True)

jail_path: Optional[Path]
if self.local_config.container.sandbox_type == ContainerSandboxType.JAIL:
Expand Down
1 change: 1 addition & 0 deletions src/ai/backend/runner/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ resources(
".tmux.conf",
".vimrc",
"all-smi.1",
"bssh.1",
"yank.sh",
"terminfo.alpine3.8/**/*",
],
Expand Down
Loading
Loading