Despite the name, this is the lambda used to write GitHub webhook payloads to S3 as mentioned in https://github.com/pytorch/test-infra/blob/main/torchci/docs/architecture.md
Job logs are downloaded with a GitHub App installation token, falling back to the GITHUB_TOKENS
PAT pool when the app is rate limited, rejected, or not installed on the repo's owner.
| Env var | Required | Purpose |
|---|---|---|
GITHUB_APP_ID |
no | App id used to mint installation tokens (e.g. 4550824, pytorch-bot-preview) |
GITHUB_APP_PRIVATE_KEY |
no | The app's private key, base64-encoded PEM (same encoding torchci uses) |
GITHUB_TOKENS |
yes | Comma-separated PAT pool, used as the fallback and when no app is configured |
With both app vars unset the lambda behaves exactly as before and only uses GITHUB_TOKENS, so
the app can be rolled back by clearing the env vars — no code change or redeploy needed.
Notes on the app path:
- Installation tokens last an hour and are cached per repo owner in module scope, so a warm invocation reuses one rather than minting a token per job.
- The app's rate limit is per installation.
pytorchis enterprise-owned, so its installation gets 15,000 requests/hour, independent of any other app's quota. Use a dedicated app rather than the sharedpytorch-botinstallation, whose quota Dr. CI and the HUD already draw on. - Repos outside the installation (e.g.
vllm-project/vllm) resolve to no installation and go straight to the PAT pool; that negative result is cached briefly to avoid a lookup per job. - Downloading job logs is documented as needing the
actions: readpermission. It currently works without it because pytorch repos are public, but the permission should be granted so the dependency is explicit and private repos keep working.
make deployis immediately live in production. The API Gateway integration currently points at the unqualified function (:function:github-status-test/invocations), soupdate-function-codeputs the new code on$LATESTand every webhook hits it right away. The publish-a-version steps below are stale — they describe pinning the integration to a numbered version, which is not how it is wired today, and the resource id is nowxtmtzjrather thanclc02o. Until that is fixed, treat any deploy as a direct production change:make prepareverifies the zip contains every vendored module beforemake deploywill run, but there is no staged rollout behind it.
A new version of the lambda can be deployed using make deploy and it will be done so automatically by the workflow
github-status-test-lambda when a change is committed to main. We have limited capacity for testing this lambda at
the moment, so additional verification steps are needed to get the new deployed version to prod. More tests and guardrails
can be added later to make the deployment fully automated, but it's kind of low priority because this lambda has rarely
been updated.
- After the new version is deployed,
bunnylol cloud fbossci - Go to github-status-test and publish a new version of the lambda (click on Actions->
Publish New Version)- Copy the ARN of the new version, i.e.
arn:aws:lambda:us-east-1:308535385114:function:github-status-test:1
- Copy the ARN of the new version, i.e.
- Go to github-status-test API Gateway and update the integration request with the new ARN
- Deploy the API change to the
defaultstage (maybe we should call itprod) - Go back to the lambda monitoring page to make sure that:
- The number of invocations remain the same
- The new version shows up in the logs stream indicating that it's not in used. Also look into the Cloudwatch log to confirm that there is nothing wrong there
If you prefer awscli, here are the step to achieve the same thing:
- Run
aws lambda publish-version --function-name github-status-testto publish the new version. The new ARN will be listed underFunctionArnin the returning JSON - Run
aws apigateway get-integration --rest-api-id jqogootqqe --resource-id clc02o --http-method ANYto describe the integration point. Note that the REST api id isjqogootqqeand the integration id isclc02o
{
"type": "AWS_PROXY",
"httpMethod": "POST",
"uri": "arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/arn:aws:lambda:us-east-1:308535385114:function:github-status-test:1/invocations",
"passthroughBehavior": "WHEN_NO_MATCH",
"contentHandling": "CONVERT_TO_TEXT",
"timeoutInMillis": 29000,
"cacheNamespace": "clc02o",
"cacheKeyParameters": [],
"integrationResponses": {
"200": {
"statusCode": "200",
"selectionPattern": ".*"
}
}
}
- Run
aws apigateway put-integration --rest-api-id jqogootqqe --resource-id clc02o --http-method ANY --type AWS_PROXY --integration-http-method POST --uri arn:aws:apigateway:us-east-1:lambda:path/2015-03-31/functions/<LAMBDA ARN>/invocationsto update the integration to point to the new lambda version - Run
aws apigateway create-deployment --rest-api-id jqogootqqe --stage-name defaultto deploy the API change to thedefaultstage, which is actuallyprod - Go back to the lambda monitoring page to make sure that:
- The number of invocations remain the same
- The new version shows up in the logs stream indicating that it's not in used. Also look into the Cloudwatch log to confirm that there is nothing wrong there