Skip to content

Commit 8aaa850

Browse files
Merge branch 'main' into quentin/mimir-loki-namespace-separator
2 parents 80892fd + 2913359 commit 8aaa850

1 file changed

Lines changed: 358 additions & 0 deletions

File tree

Lines changed: 358 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,358 @@
1+
name: Update Beyla Component From Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
beyla_release_tag:
7+
description: Beyla release tag to sync from, for example v3.6.1
8+
required: true
9+
type: string
10+
beyla_ref:
11+
description: Optional Beyla git ref override for pre-release testing, for example main or release/v3.7
12+
required: false
13+
default: ""
14+
type: string
15+
source_ref:
16+
description: Alloy ref to branch from
17+
required: false
18+
default: main
19+
type: string
20+
21+
concurrency:
22+
group: agent-bump-beyla-${{ inputs.source_ref }}-${{ inputs.beyla_ref || inputs.beyla_release_tag }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
plan-beyla-update:
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 20
29+
permissions:
30+
contents: read
31+
id-token: write
32+
33+
steps:
34+
- name: Get secrets
35+
id: get-secrets
36+
uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # get-vault-secrets/v1.3.0
37+
with:
38+
export_env: false
39+
repo_secrets: |
40+
ANTHROPIC_API_KEY=anthropic-token:token
41+
ALLOYBOT_APP_ID=alloybot:app_id
42+
ALLOYBOT_PRIVATE_KEY=alloybot:private_key
43+
44+
- name: Generate token
45+
id: app-token
46+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
47+
with:
48+
app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_APP_ID }}
49+
private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_PRIVATE_KEY }}
50+
owner: grafana
51+
repositories: alloy
52+
53+
- name: Checkout repository
54+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
55+
with:
56+
ref: ${{ inputs.source_ref }}
57+
fetch-depth: 1
58+
token: ${{ steps.app-token.outputs.token }}
59+
60+
- name: Set up Go
61+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
62+
with:
63+
go-version-file: go.mod
64+
cache: false
65+
66+
- name: Prepare plan output
67+
run: mkdir -p .github/agent-output
68+
69+
- name: Run Claude Code plan job
70+
uses: anthropics/claude-code-action@cd77b50d2b0808657f8e6774085c8bf54484351c # v1.0.72
71+
env:
72+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
73+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
74+
DISABLE_TELEMETRY: "1"
75+
DISABLE_ERROR_REPORTING: "1"
76+
with:
77+
anthropic_api_key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ANTHROPIC_API_KEY }}
78+
github_token: ${{ steps.app-token.outputs.token }}
79+
use_commit_signing: "false"
80+
claude_args: "--max-turns 60 --allowedTools \"Bash(awk:*),Bash(cat:*),Bash(curl:*),Bash(date:*),Bash(gh:*),Bash(git:*),Bash(go:*),Bash(grep:*),Bash(head:*),Bash(jq:*),Bash(ls:*),Bash(make:*),Bash(mkdir:*),Bash(pwd:*),Bash(rg:*),Bash(sed:*),Bash(sort:*),Bash(tail:*),Bash(tr:*),Bash(wc:*),Edit,MultiEdit,Glob,Grep,LS,Read,Write,Task,TodoWrite\""
81+
prompt: |
82+
# Plan Alloy's Beyla update
83+
84+
**Target Beyla release tag**: `${{ inputs.beyla_release_tag }}`
85+
**Beyla ref override**: `${{ inputs.beyla_ref }}`
86+
**Branch from**: `${{ inputs.source_ref }}`
87+
**Repository**: `grafana/alloy`
88+
89+
Your job is to inspect the target Beyla release, compare it with the current Alloy integration, and write an execution plan to `.github/agent-output/plan.md`.
90+
91+
Do not edit Alloy source files.
92+
Do not create a branch.
93+
Do not commit, push, or open a PR.
94+
95+
## Source of truth
96+
97+
Fetch the Beyla source from `grafana/beyla`.
98+
Use `${{ inputs.beyla_ref }}` if it is non-empty; otherwise use tag `${{ inputs.beyla_release_tag }}`.
99+
Read `go.mod` there to determine the exact Beyla module version to use in Alloy.
100+
Derive the exact Grafana OBI replacement version from the Beyla `.obi-src` gitlink commit:
101+
- resolve the pinned `.obi-src` SHA for the selected Beyla ref
102+
- resolve that SHA into a Go pseudo-version for `github.com/grafana/opentelemetry-ebpf-instrumentation`
103+
- if the module proxy stalls, use `GOPROXY=direct` for the resolution step
104+
105+
You may use public GitHub raw URLs, `gh api`, or a shallow temporary clone outside the repo.
106+
107+
## Files the implementation job may update
108+
109+
- `collector/builder-config.yaml`
110+
- `dependency-replacements.yaml`
111+
- `collector/go.mod`
112+
- `go.mod`
113+
- `docs/sources/_index.md.t`
114+
- `internal/component/beyla/ebpf/args.go`
115+
- `internal/component/beyla/ebpf/beyla_linux.go`
116+
- `internal/component/beyla/ebpf/beyla_linux_test.go`
117+
- `docs/sources/reference/components/beyla/beyla.ebpf.md`
118+
119+
`go.sum` and `collector/go.sum` may change only if required by module updates.
120+
121+
## Required contents of `.github/agent-output/plan.md`
122+
123+
Write a concise Markdown plan with these sections:
124+
- Target versions
125+
- Required file updates
126+
- Beyla field parity changes
127+
- Verification steps
128+
- Risks or likely failure points
129+
130+
Include the exact Beyla module version and OBI pseudo-version you resolved, identify the new fields or behavior Alloy needs for parity, and list the exact commands the implementation job should run to verify the change.
131+
132+
- name: Upload plan artifact
133+
if: always()
134+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
135+
with:
136+
name: beyla-update-plan
137+
path: .github/agent-output/plan.md
138+
if-no-files-found: warn
139+
140+
- name: Add plan to job summary
141+
if: always()
142+
run: |
143+
{
144+
echo "## Beyla update plan"
145+
echo
146+
cat .github/agent-output/plan.md
147+
} >> "${GITHUB_STEP_SUMMARY}"
148+
149+
implement-beyla-update:
150+
needs: plan-beyla-update
151+
runs-on: ubuntu-latest
152+
timeout-minutes: 90
153+
permissions:
154+
contents: write
155+
pull-requests: write
156+
id-token: write
157+
158+
steps:
159+
- name: Get secrets
160+
id: get-secrets
161+
uses: grafana/shared-workflows/actions/get-vault-secrets@a37de51f3d713a30a9e4b21bcdfbd38170020593 # get-vault-secrets/v1.3.0
162+
with:
163+
export_env: false
164+
repo_secrets: |
165+
ANTHROPIC_API_KEY=anthropic-token:token
166+
ALLOYBOT_APP_ID=alloybot:app_id
167+
ALLOYBOT_PRIVATE_KEY=alloybot:private_key
168+
169+
- name: Generate token
170+
id: app-token
171+
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
172+
with:
173+
app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_APP_ID }}
174+
private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ALLOYBOT_PRIVATE_KEY }}
175+
owner: grafana
176+
repositories: alloy
177+
178+
- name: Checkout repository
179+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
180+
with:
181+
ref: ${{ inputs.source_ref }}
182+
fetch-depth: 1
183+
token: ${{ steps.app-token.outputs.token }}
184+
185+
- name: Download plan artifact
186+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
187+
with:
188+
name: beyla-update-plan
189+
path: .github/agent-input
190+
191+
- name: Set up Go
192+
uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
193+
with:
194+
go-version-file: go.mod
195+
cache: false
196+
197+
- name: Get GitHub App identity
198+
id: get-app
199+
env:
200+
APP_SLUG: ${{ steps.app-token.outputs.app-slug }}
201+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
202+
run: |
203+
APP_ID="$(gh api "/apps/${APP_SLUG}" --jq .id)"
204+
echo "app-id=${APP_ID}" >> "${GITHUB_OUTPUT}"
205+
echo "app-login=${APP_SLUG}[bot]" >> "${GITHUB_OUTPUT}"
206+
207+
- name: Configure Git
208+
env:
209+
APP_ID: ${{ steps.get-app.outputs.app-id }}
210+
APP_LOGIN: ${{ steps.get-app.outputs.app-login }}
211+
run: |
212+
git config user.name "${APP_LOGIN}"
213+
git config user.email "${APP_ID}+${APP_LOGIN}@users.noreply.github.com"
214+
215+
- name: Prepare implementation outputs
216+
run: |
217+
mkdir -p .github/agent-output
218+
cat > .github/agent-output/implement-status.md <<'EOF'
219+
# Beyla update implementation status
220+
221+
State: not started
222+
EOF
223+
224+
- name: Run Claude Code implement job
225+
uses: anthropics/claude-code-action@cd77b50d2b0808657f8e6774085c8bf54484351c # v1.0.72
226+
env:
227+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
228+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
229+
DISABLE_TELEMETRY: "1"
230+
DISABLE_ERROR_REPORTING: "1"
231+
with:
232+
anthropic_api_key: ${{ fromJSON(steps.get-secrets.outputs.secrets).ANTHROPIC_API_KEY }}
233+
github_token: ${{ steps.app-token.outputs.token }}
234+
use_commit_signing: "false"
235+
claude_args: "--max-turns 120 --allowedTools \"Bash(awk:*),Bash(cat:*),Bash(curl:*),Bash(date:*),Bash(gh:*),Bash(git:*),Bash(go:*),Bash(grep:*),Bash(head:*),Bash(jq:*),Bash(ls:*),Bash(make:*),Bash(mkdir:*),Bash(pwd:*),Bash(rg:*),Bash(sed:*),Bash(sort:*),Bash(tail:*),Bash(tr:*),Bash(wc:*),Edit,MultiEdit,Glob,Grep,LS,Read,Write,Task,TodoWrite\""
236+
prompt: |
237+
# Update Alloy's Beyla integration for a Beyla release
238+
239+
**Target Beyla release tag**: `${{ inputs.beyla_release_tag }}`
240+
**Beyla ref override**: `${{ inputs.beyla_ref }}`
241+
**Branch from**: `${{ inputs.source_ref }}`
242+
**Repository**: `grafana/alloy`
243+
**Plan file**: `.github/agent-input/plan.md`
244+
**Status file**: `.github/agent-output/implement-status.md`
245+
246+
Your job is to implement the Beyla update described in `.github/agent-input/plan.md`, verify it locally, and open a **draft PR** only after tests pass.
247+
248+
Treat the plan as a starting point, but re-check any assumption that looks stale while you work.
249+
250+
## Required output
251+
252+
Create a branch from `${{ inputs.source_ref }}`, implement the required updates, run verification, push the branch, and open a draft PR against `${{ inputs.source_ref }}`.
253+
254+
If there are no changes to make, do not open a PR.
255+
If verification fails, do not open a PR.
256+
257+
## Status tracking
258+
259+
Keep `.github/agent-output/implement-status.md` updated throughout the run so a human can continue from it if this job fails.
260+
261+
Update that file:
262+
- before making changes, with the plan you are executing
263+
- after each major edit batch
264+
- after each verification cycle
265+
- whenever a command fails, including the exact command and a short failure summary
266+
- at the end, with the final outcome
267+
268+
The status file should stay concise, but it must include what you tried, what failed, and what remains to do.
269+
270+
## Files to update
271+
272+
Update only what is required in these files:
273+
- `collector/builder-config.yaml`
274+
- `dependency-replacements.yaml`
275+
- `collector/go.mod`
276+
- `go.mod`
277+
- `docs/sources/_index.md.t`
278+
- `internal/component/beyla/ebpf/args.go`
279+
- `internal/component/beyla/ebpf/beyla_linux.go`
280+
- `internal/component/beyla/ebpf/beyla_linux_test.go`
281+
- `docs/sources/reference/components/beyla/beyla.ebpf.md`
282+
283+
You may also update `go.sum` or `collector/go.sum` if the module changes require it. Do not touch unrelated files.
284+
285+
## Implementation requirements
286+
287+
1. Bump the OBI replacement version derived from Beyla's pinned `.obi-src` SHA in:
288+
- `collector/builder-config.yaml`
289+
- `dependency-replacements.yaml`
290+
- `collector/go.mod`
291+
292+
2. Bump the Beyla version in:
293+
- `go.mod`
294+
- `docs/sources/_index.md.t`
295+
296+
3. After bumping module versions, run:
297+
- `go mod tidy`
298+
- `(cd collector && go mod tidy)`
299+
300+
4. Compare the current Alloy Beyla integration against the target Beyla release and add any newly added fields needed for parity in:
301+
- `internal/component/beyla/ebpf/args.go`
302+
- `internal/component/beyla/ebpf/beyla_linux.go`
303+
- `internal/component/beyla/ebpf/beyla_linux_test.go`
304+
- `docs/sources/reference/components/beyla/beyla.ebpf.md`
305+
306+
5. When determining newly added fields, inspect the relevant Beyla changes instead of guessing. Update only fields and behavior that are newly required for this release.
307+
308+
6. In `beyla_linux.go`, add matching convert and validate logic for the new fields, preserving existing defaults and zero-value behavior.
309+
310+
7. In `beyla_linux_test.go`, add focused tests for the new fields and any new validation behavior.
311+
312+
## Style constraints
313+
314+
- Keep the changes minimal and consistent with the surrounding Alloy code.
315+
- Do not add unnecessary comments.
316+
- Do not refactor unrelated code.
317+
- Preserve field ordering and naming patterns where possible.
318+
- Keep docs concise and consistent with existing wording and table format.
319+
- Do not add compatibility shims unless they are strictly required by the target Beyla release.
320+
321+
## Verification
322+
323+
Run the following after editing:
324+
- `go test ./internal/component/beyla/ebpf/...`
325+
326+
Fix any failures caused by your changes before continuing.
327+
328+
## Git and PR workflow
329+
330+
- Create a branch named `agent/bump-beyla-${{ inputs.beyla_release_tag }}`
331+
- Commit with message `chore(beyla): Bump to ${{ inputs.beyla_release_tag }}`
332+
- Push the branch to `origin`
333+
- Open a **draft PR** against `${{ inputs.source_ref }}`
334+
- Use a conventional PR title, for example `chore(beyla): Bump to ${{ inputs.beyla_release_tag }}`
335+
336+
Use a concise PR body that summarizes:
337+
- the Beyla version bump
338+
- the OBI replacement bump
339+
- any newly mapped Beyla fields
340+
341+
Do not force-push. Do not open a non-draft PR.
342+
343+
- name: Upload implementation status artifact
344+
if: always()
345+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
346+
with:
347+
name: beyla-update-implementation-status
348+
path: .github/agent-output/implement-status.md
349+
if-no-files-found: warn
350+
351+
- name: Add implementation status to job summary
352+
if: always()
353+
run: |
354+
{
355+
echo "## Beyla update implementation status"
356+
echo
357+
cat .github/agent-output/implement-status.md
358+
} >> "${GITHUB_STEP_SUMMARY}"

0 commit comments

Comments
 (0)