Skip to content

Commit 182c29e

Browse files
dan2k3k4claude
andcommitted
Add litellm-database variant; Slack via bot token + channel variable
Matrix-build both upstream image variants (plain for Lagoon, -database for the helm chart), and notify via org SLACK_BOT_TOKEN secret with a SLACK_CHANNEL_ID repo variable instead of an incoming webhook. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 527d48a commit 182c29e

3 files changed

Lines changed: 63 additions & 26 deletions

File tree

.github/workflows/build.yml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,21 @@ concurrency:
2323
group: build
2424
cancel-in-progress: false
2525

26-
env:
27-
IMAGE: ghcr.io/${{ github.repository }}
28-
2926
jobs:
3027
build:
3128
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
include:
33+
# plain image: consumed by litellm-lagoon (Lagoon/docker-compose)
34+
- upstream: litellm
35+
package: litellm-lagoon-base
36+
# -database image: consumed by the litellm helm chart (k0rdent)
37+
- upstream: litellm-database
38+
package: litellm-lagoon-base-database
39+
env:
40+
IMAGE: ghcr.io/${{ github.repository_owner }}/${{ matrix.package }}
3241
steps:
3342
- uses: actions/checkout@v4
3443

@@ -73,6 +82,7 @@ jobs:
7382
push: true
7483
platforms: linux/amd64,linux/arm64
7584
build-args: |
85+
LITELLM_IMAGE=ghcr.io/berriai/${{ matrix.upstream }}
7686
LITELLM_VERSION=${{ steps.version.outputs.version }}
7787
tags: |
7888
${{ env.IMAGE }}:${{ steps.version.outputs.version }}
@@ -81,8 +91,12 @@ jobs:
8191
- name: Notify Slack on failure
8292
if: failure()
8393
env:
84-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
94+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
95+
SLACK_CHANNEL_ID: ${{ vars.SLACK_CHANNEL_ID }}
96+
TEXT: ":rotating_light: ${{ matrix.package }} build failed for LiteLLM ${{ steps.version.outputs.version || 'unknown' }} — the patch may no longer apply. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
8597
run: |
86-
curl -fsS -X POST -H 'Content-type: application/json' --data \
87-
"{\"text\":\":rotating_light: litellm-lagoon-base build failed for LiteLLM ${{ steps.version.outputs.version || 'unknown' }} — the patch may no longer apply. ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \
88-
"$SLACK_WEBHOOK_URL"
98+
curl -fsS -X POST https://slack.com/api/chat.postMessage \
99+
-H "Authorization: Bearer $SLACK_BOT_TOKEN" \
100+
-H 'Content-type: application/json; charset=utf-8' \
101+
--data "$(jq -n --arg c "$SLACK_CHANNEL_ID" --arg t "$TEXT" '{channel:$c,text:$t}')" \
102+
| jq -e '.ok'

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
# LITELLM_IMAGE: ghcr.io/berriai/litellm (Lagoon/docker-compose) or
2+
# ghcr.io/berriai/litellm-database (helm chart default). Both are alpine,
3+
# run as root, and ship litellm in site-packages, so patching is identical.
4+
ARG LITELLM_IMAGE=ghcr.io/berriai/litellm
15
ARG LITELLM_VERSION=v1.93.0
2-
FROM ghcr.io/berriai/litellm:${LITELLM_VERSION}
6+
FROM ${LITELLM_IMAGE}:${LITELLM_VERSION}
37

48
# Apply patch/*.patch onto the installed litellm package. Only litellm/*
59
# paths are applied — tests/ and ui/ sources in a patch are skipped (the

README.md

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,31 @@
11
# litellm-lagoon-base
22

33
Republishes the upstream [LiteLLM](https://github.com/BerriAI/litellm) proxy
4-
image with our pending upstream patches applied — nothing else. Consumed by
5-
[litellm-lagoon](https://github.com/amazeeio/litellm-lagoon) as its base image.
4+
images with our pending upstream patches applied — nothing else. With an empty
5+
`patch/` dir the output is a 1-to-1 copy of upstream.
66

7-
Images: `ghcr.io/amazeeio/litellm-lagoon-base:<litellm-version>` (e.g.
8-
`v1.93.0`) plus `latest`. With an empty `patch/` dir the output is a 1-to-1
9-
copy of `ghcr.io/berriai/litellm:<version>`.
7+
Two packages, mirroring the upstream image variants, tagged with the upstream
8+
release (e.g. `v1.93.0`) plus `latest`:
9+
10+
| Package | Upstream base | Consumed by |
11+
| --- | --- | --- |
12+
| `ghcr.io/amazeeio/litellm-lagoon-base` | `ghcr.io/berriai/litellm` | [litellm-lagoon](https://github.com/amazeeio/litellm-lagoon) (Lagoon / docker-compose) |
13+
| `ghcr.io/amazeeio/litellm-lagoon-base-database` | `ghcr.io/berriai/litellm-database` | litellm helm chart in [amazeeai-k0rdent-catalog](https://github.com/amazeeio/amazeeai-k0rdent-catalog) |
1014

1115
## How it works
1216

13-
- `Dockerfile` starts `FROM ghcr.io/berriai/litellm:${LITELLM_VERSION}` and
14-
applies every `patch/*.patch` onto the installed `litellm` site-package with
17+
- `Dockerfile` starts `FROM ${LITELLM_IMAGE}:${LITELLM_VERSION}` and applies
18+
every `patch/*.patch` onto the installed `litellm` site-package with
1519
`git apply --include='litellm/*'` (tests/UI-source paths in a patch are
16-
skipped — the image ships prebuilt UI assets).
20+
skipped — the images ship prebuilt UI assets).
1721
- `.github/workflows/build.yml` runs every 6 hours, resolves the latest
18-
**stable** (non-prerelease) LiteLLM release, and builds/pushes it if not
19-
already published. Pushes to `main` touching `Dockerfile` or `patch/`
22+
**stable** (non-prerelease) LiteLLM release, and builds/pushes both variants
23+
if not already published. Pushes to `main` touching `Dockerfile` or `patch/`
2024
republish the current version. `workflow_dispatch` accepts an explicit
2125
version.
22-
- If the build fails (usually: patch no longer applies to a new release),
23-
a message is posted to Slack via the `SLACK_WEBHOOK_URL` repo secret.
26+
- If a build fails (usually: patch no longer applies to a new release), a
27+
message is posted to Slack — and re-posted every 6 hours until the patch is
28+
fixed.
2429

2530
## Current patches
2631

@@ -42,12 +47,26 @@ git diff > <this-repo>/patch/0001-litellm-pr31618-budget-threshold-webhook-alert
4247
## When the PR merges upstream
4348

4449
Delete `patch/*.patch` (keep `patch/.gitkeep`) and push. Builds continue and
45-
publish unpatched 1-to-1 copies of upstream — `litellm-lagoon` keeps working
46-
unchanged.
50+
publish unpatched 1-to-1 copies of upstream — consumers keep working unchanged.
51+
52+
## Consuming the internal packages
53+
54+
The packages stay **internal**, so every pull needs auth against ghcr.io with
55+
`read:packages`:
56+
57+
- **Lagoon builds** (litellm-lagoon): `.lagoon.yml` declares a
58+
`container-registries` entry for ghcr.io; create the referenced Lagoon
59+
variables (`GHCR_USERNAME`, `GHCR_PULL_TOKEN` — a fine-grained PAT or classic
60+
PAT with `read:packages`) on each project:
61+
`lagoon add variable -p <project> -N GHCR_PULL_TOKEN -V <token> -S container_registry`
62+
- **Kubernetes / k0rdent**: create a `kubernetes.io/dockerconfigjson` pull
63+
secret for ghcr.io in the target namespace and reference it via the chart's
64+
`litellm-helm.imagePullSecrets`.
65+
- **Local dev**: `docker login ghcr.io` with your GitHub username + PAT.
4766

4867
## One-time setup
4968

50-
- Repo secret `SLACK_WEBHOOK_URL` — incoming-webhook URL for the alerts channel.
51-
- After the first push to GHCR, set the `litellm-lagoon-base` package
52-
visibility to **public** (org packages default to private; Lagoon builds
53-
pull this image unauthenticated).
69+
- Grant the org-level `SLACK_BOT_TOKEN` secret access to this repo (org
70+
settings → secrets → repository access), and set the `SLACK_CHANNEL_ID`
71+
**repository variable** to the alerts channel ID. The Slack app must be a
72+
member of that channel.

0 commit comments

Comments
 (0)