Skip to content

Beyla two step memory win #17

Beyla two step memory win

Beyla two step memory win #17

name: BetterStack Docker Build and Push
on:
push:
branches:
- main
- betterstack-*
tags:
- 'v*'
pull_request:
branches:
- main
env:
IMAGE_NAME: betterstack/beyla
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Verify memory spike fixes are present
run: |
echo "Verifying our memory spike fixes are in the source code..."
if ! grep -q "BEYLA_MAX_CONCURRENT_ELF" vendor/go.opentelemetry.io/obi/pkg/components/discover/typer.go; then
echo "❌ FAIL: BEYLA_MAX_CONCURRENT_ELF not found in typer.go"
echo "This means our memory spike fixes are missing from the source!"
exit 1
fi
if ! grep -q "elfParseSem" vendor/go.opentelemetry.io/obi/pkg/components/discover/typer.go; then
echo "❌ FAIL: elfParseSem variable not found in typer.go"
echo "This means our semaphore code is missing!"
exit 1
fi
if ! grep -q "Acquire semaphore to limit concurrent ELF parsing" vendor/go.opentelemetry.io/obi/pkg/components/discover/typer.go; then
echo "❌ FAIL: Semaphore comment not found in typer.go"
echo "This means our semaphore implementation is missing!"
exit 1
fi
echo "✅ SUCCESS: All memory spike fix markers found in source code"
echo "✅ BEYLA_MAX_CONCURRENT_ELF environment variable: FOUND"
echo "✅ elfParseSem semaphore variable: FOUND"
echo "✅ Semaphore implementation: FOUND"
- name: Set up Depot
uses: depot/setup-action@v1
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}
tags: |
# For main branch, use 'latest' tag
type=raw,value=latest,enable={{is_default_branch}}
# For version tags, use the version
type=ref,event=tag
# For pull requests, use pr-X format
type=ref,event=pr,prefix=pr-
# For branches, use branch name (sanitized)
type=ref,event=branch
# SHA prefix - use pr-X for PRs, branch for others
type=sha,prefix=pr-{{pr}}-,format=short,enable=${{ github.event_name == 'pull_request' }}
type=sha,prefix={{branch}}-,format=short,enable=${{ github.event_name != 'pull_request' }}
- name: Build and test
run: |
make build-preserve-patches
make test
- name: Build and push Docker image
uses: depot/build-push-action@v1
with:
project: ${{ secrets.DEPOT_PROJECT_ID }}
token: ${{ secrets.DEPOT_API_TOKEN }}
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ github.ref_name }}
COMMIT=${{ github.sha }}
DEV_OBI=1
- name: Update Docker Hub description
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.IMAGE_NAME }}
short-description: "BetterStack's fork of Beyla with memory leak fixes"
readme-filepath: ./README_BETTERSTACK.md