From 41c1a4bf8c672f51a7f62e8007fb72392f227244 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Thu, 12 Nov 2026 12:24:20 +0100 Subject: [PATCH 1/2] Pass the job's read-only token to the AOT smoke step The release run's osx-arm64 smoke failed with 'API rate limit exceeded for 13.105.49.252': hosted runners share IPs, so the 60 anonymous requests an hour can run out mid-run. In CI the smoke step now gets GITHUB_TOKEN (contents: read, masked in logs) and passes it as --token; locally it still runs anonymously. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 2 ++ build/scripts/Program.fs | 15 ++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7419bd5..ae27767 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,8 @@ jobs: - run: ./build.sh smokeaot -s name: Run the native-AOT binary against GitHub shell: bash + env: + GITHUB_TOKEN: ${{ github.token }} # read-only; hosted runners share IPs, so the anonymous limit runs out # Container image, linux-x64 only for now — the platform every GitHub-hosted Linux runner # already matches. No --push here and no registry login on this leg, so this only proves the diff --git a/build/scripts/Program.fs b/build/scripts/Program.fs index d4972d1..92c0aa2 100644 --- a/build/scripts/Program.fs +++ b/build/scripts/Program.fs @@ -117,8 +117,9 @@ let main argv = // The framework-dependent build cannot catch what trimming breaks: #47 broke only the native-AOT binary, where // Octokit's reflection-based JSON returned nothing or threw. So this publishes that binary and reads releases - // and issues that no longer change: elastic/apm-agent-dotnet's 1.11.0 and the line around it. It runs - // anonymously, as the issue's reproduction did, which costs about 15 of the 60 requests an hour GitHub allows. + // and issues that no longer change: elastic/apm-agent-dotnet's 1.11.0 and the line around it. It costs about 15 + // requests. Locally it runs anonymously (60 an hour); in CI the job's read-only GITHUB_TOKEN is passed, because + // hosted runners share IPs and the anonymous limit ran out mid-run on macOS. | Smokeaot -> target [] { let rid = RuntimeInformation.RuntimeIdentifier let publishDirectory = Path.Combine(Paths.Output.FullName, "aot-smoke") @@ -126,19 +127,23 @@ let main argv = sh $"dotnet publish {toolProject} -c Release -f net10.0 -r {rid} -o {publish}" let executable = if OperatingSystem.IsWindows() then $"{Paths.ToolName}.exe" else Paths.ToolName let binary = Paths.RootRelative <| Path.Combine(publishDirectory, executable) + let auth = + match Environment.GetEnvironmentVariable "GITHUB_TOKEN" with + | null | "" -> "" + | token -> $" --token {token}" // checked one command at a time and stopping at the first failure, so a broken binary spends few requests let check (command: string) (result: string) (expected: string list) = printfn "%s %s:\n%s" Paths.ToolName command result for line in expected do if not (result.Contains line) then failwithf "the native-AOT binary's %s did not print '%s'" command line // the latest release, then every page of releases: one object, then lists - let! previous = text $"{binary} find-previous elastic apm-agent-dotnet --version 1.11.0" + let! previous = text $"{binary} find-previous elastic apm-agent-dotnet --version 1.11.0{auth}" check "find-previous" previous [ "1.10.0" ] // every page of releases again, then one release by its tag - let! current = text $"{binary} current-version elastic apm-agent-dotnet --query 1.11 --version 1.11.0" + let! current = text $"{binary} current-version elastic apm-agent-dotnet --query 1.11 --version 1.11.0{auth}" check "current-version" current [ "1.11.1"; "1.11.2" ] // issues and pull requests, with their labels and pull request links - let! notes = text $"{binary} generate elastic apm-agent-dotnet --version 1.11.0" + let! notes = text $"{binary} generate elastic apm-agent-dotnet --version 1.11.0{auth}" check "generate" notes [ "- #1239 Add Cosmos DB support (issue: #1154)"; "- #1302 Prefer W3C traceparent" ] } app.RunAsync(argv).GetAwaiter().GetResult() From 927e5c5a4115148603f56932b049ab4355c281c8 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Thu, 12 Nov 2026 12:27:26 +0100 Subject: [PATCH 2/2] Pass --token as its own argument in the AOT smoke step Make.Fs quotes each interpolated hole as one argument, so ' --token ' became part of the --version value. The commands are now argument lists, and --token sits in the command text. Co-Authored-By: Claude Opus 5.5 --- build/scripts/Program.fs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/build/scripts/Program.fs b/build/scripts/Program.fs index 92c0aa2..ae72e1e 100644 --- a/build/scripts/Program.fs +++ b/build/scripts/Program.fs @@ -127,23 +127,25 @@ let main argv = sh $"dotnet publish {toolProject} -c Release -f net10.0 -r {rid} -o {publish}" let executable = if OperatingSystem.IsWindows() then $"{Paths.ToolName}.exe" else Paths.ToolName let binary = Paths.RootRelative <| Path.Combine(publishDirectory, executable) - let auth = - match Environment.GetEnvironmentVariable "GITHUB_TOKEN" with - | null | "" -> "" - | token -> $" --token {token}" + // Make.Fs quotes each interpolated hole as one argument, so --token stays in the command text + let token = Environment.GetEnvironmentVariable "GITHUB_TOKEN" + let run (args: string list) = + match token with + | null | "" -> text $"{binary} {args}" + | t -> text $"{binary} {args} --token {t}" // checked one command at a time and stopping at the first failure, so a broken binary spends few requests let check (command: string) (result: string) (expected: string list) = printfn "%s %s:\n%s" Paths.ToolName command result for line in expected do if not (result.Contains line) then failwithf "the native-AOT binary's %s did not print '%s'" command line // the latest release, then every page of releases: one object, then lists - let! previous = text $"{binary} find-previous elastic apm-agent-dotnet --version 1.11.0{auth}" + let! previous = run [ "find-previous"; "elastic"; "apm-agent-dotnet"; "--version"; "1.11.0" ] check "find-previous" previous [ "1.10.0" ] // every page of releases again, then one release by its tag - let! current = text $"{binary} current-version elastic apm-agent-dotnet --query 1.11 --version 1.11.0{auth}" + let! current = run [ "current-version"; "elastic"; "apm-agent-dotnet"; "--query"; "1.11"; "--version"; "1.11.0" ] check "current-version" current [ "1.11.1"; "1.11.2" ] // issues and pull requests, with their labels and pull request links - let! notes = text $"{binary} generate elastic apm-agent-dotnet --version 1.11.0{auth}" + let! notes = run [ "generate"; "elastic"; "apm-agent-dotnet"; "--version"; "1.11.0" ] check "generate" notes [ "- #1239 Add Cosmos DB support (issue: #1154)"; "- #1302 Prefer W3C traceparent" ] } app.RunAsync(argv).GetAwaiter().GetResult()