Skip to content

Enable MCP for all API endpoints #477

Enable MCP for all API endpoints

Enable MCP for all API endpoints #477

Workflow file for this run

name: docker tests
on:
push:
branches:
- stable
- dev
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
docker-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install 3.11
- name: Install dependencies
run: uv sync
- name: Run tests
run: |
BBOT_SERVER_TEST_DOCKER_COMPOSE=true uv run pytest --disable-warnings --log-cli-level=INFO -k test_docker_compose
helm-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install Python dependencies
run: pip install requests
- name: Install kubectl
uses: azure/setup-kubectl@v4
- name: Install Helm
uses: azure/setup-helm@v4
- name: Install minikube
uses: medyagh/setup-minikube@latest
- name: Run helm deployment tests
run: python helm_deployment_test.py
- name: Cleanup minikube
if: always()
run: minikube delete
docker-publish:
runs-on: ubuntu-latest
needs:
- helm-test
- docker-test
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/stable' || github.ref == 'refs/heads/dev') }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Get version from pyproject.toml
id: version
run: |
VERSION=$(uv version --short)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "major=$(echo $VERSION | cut -d. -f1)" >> $GITHUB_OUTPUT
echo "minor=$(echo $VERSION | cut -d. -f1-2)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: blacklanternsecurity
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: blacklanternsecurity/bbot-server
tags: |
type=ref,event=branch
type=sha,prefix=sha-
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/stable' }}
type=raw,value=${{ steps.version.outputs.major }},enable=${{ github.ref == 'refs/heads/stable' }}
type=raw,value=${{ steps.version.outputs.minor }},enable=${{ github.ref == 'refs/heads/stable' }}
type=raw,value=${{ steps.version.outputs.version }},enable=${{ github.ref == 'refs/heads/stable' }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Clean up old Docker Hub tags (keep 50 most recent plus protected tags)
run: |
# Install jq for JSON processing
sudo apt-get update && sudo apt-get install -y jq
echo "Cleaning up bbot-server tags..."
# Protected tags that should never be deleted
PROTECTED="latest stable dev ${{ steps.version.outputs.major }} ${{ steps.version.outputs.minor }} ${{ steps.version.outputs.version }}"
tags_response=$(curl -s -H "Authorization: Bearer ${{ secrets.DOCKER_TOKEN }}" \
"https://hub.docker.com/v2/repositories/blacklanternsecurity/bbot-server/tags/?page_size=100")
tags_to_delete=$(echo "$tags_response" | jq -r '.results[].name' | sort -r | tail -n +51)
for tag in $tags_to_delete; do
# Skip protected tags
if echo "$PROTECTED" | grep -qw "$tag"; then
echo "Skipping protected tag: $tag"
continue
fi
echo "Deleting bbot-server tag: $tag"
curl -X DELETE -H "Authorization: Bearer ${{ secrets.DOCKER_TOKEN }}" \
"https://hub.docker.com/v2/repositories/blacklanternsecurity/bbot-server/tags/$tag/"
done
echo "Cleanup completed for bbot-server."
helm-publish:
runs-on: ubuntu-latest
needs:
- helm-test
- docker-test
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/stable' || github.ref == 'refs/heads/dev') }}
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Get version from pyproject.toml
id: version
run: |
VERSION=$(uv version --short)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Install Helm
uses: azure/setup-helm@v4
- name: Update Chart.yaml version and appVersion
run: |
VERSION="${{ steps.version.outputs.version }}"
CHART_VERSION="$VERSION"
if [ "${{ github.ref }}" = "refs/heads/dev" ]; then
CHART_VERSION="${VERSION}-dev"
fi
sed -i "s/^version:.*/version: ${CHART_VERSION}/" helm/Chart.yaml
sed -i "s/^appVersion:.*/appVersion: \"${VERSION}\"/" helm/Chart.yaml
# image.tag defaults to .Chart.AppVersion in the templates,
# so no need to sed values.yaml — the version flows automatically.
echo "Chart version: $CHART_VERSION"
echo "App version: $VERSION"
cat helm/Chart.yaml
- name: Add Helm repositories
run: helm repo add bitnami https://charts.bitnami.com/bitnami
- name: Build Helm dependencies
run: helm dependency build helm/
- name: Package Helm chart
run: helm package helm/
- name: Login to Docker Hub OCI registry
run: echo "${{ secrets.DOCKER_TOKEN }}" | helm registry login registry-1.docker.io -u blacklanternsecurity --password-stdin
- name: Push Helm chart to Docker Hub
run: helm push bbot-server-*.tgz oci://registry-1.docker.io/blacklanternsecurity