Repository navigation
[ci][doc] Fail the redirect apply step clearly when the RtD token fetch fails - #66624
Merged
Merged
Conversation
…ch fails `export RTD_API_TOKEN="$(aws ...)"` returns export's status, so a failed Secrets Manager fetch fell through to `rtd-redirects apply` with an empty token and reported "RTD_API_TOKEN is not set", hiding the AWS error. Assign and export separately, fail at the fetch with a message naming the secret and the required permission, and document the IAM grant the runner role needs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Contributor
There was a problem hiding this comment.
Code Review
This pull request improves error handling when fetching the ReadTheDocs API token from AWS Secrets Manager in the Buildkite pipeline by separating the token assignment from the export command and checking for empty values. Feedback suggests redirecting the error message to standard error (stderr) and splitting the long log message into multiple lines for better readability.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
sai-miduthuri
approved these changes
Oct 1, 2026
nadongjun
pushed a commit
to nadongjun/ray
that referenced
this pull request
Oct 6, 2026
…ch fails (ray-project#66624) ## What Two changes to the postmerge `:book: doc: apply redirects` step in `.buildkite/doc.rayci.yml`: 1. Fail the step at the Secrets Manager fetch, with a message that names the secret and the permission it needs, when `get-secret-value` fails or returns an empty value. Previously `export RTD_API_TOKEN="$(aws ...)"` returned `export`'s status rather than `aws`'s. The step fell through to `rtd-redirects apply` with an empty token, which failed with `RTD_API_TOKEN is not set. Export your RtD API token before running.` That message reads like a local-environment problem and hides the real AWS error a few lines up. 2. Document the IAM permission the runner role needs, in the step comment. ## Why: the step has never been able to read its token Every master postmerge run of this step since it was enabled in ray-project#66024 and reworked in ray-project#66427 has failed at the secret fetch, for example [postmerge ray-project#20026](https://buildkite.com/ray-project/postmerge/builds/20026) and [ray-project#20049](https://buildkite.com/ray-project/postmerge/builds/20049). The job log shows: ``` An error occurred (AccessDeniedException) when calling the GetSecretValue operation: User: arn:aws:sts::029272617770:assumed-role/bk-runner-queue-small-branch-Role/i-... is not authorized to perform: secretsmanager:GetSecretValue on resource: oss-ci/rtd-api-token ``` The `oss-ci/rtd-api-token` secret exists, but the runner role can't read it. Release-branch builds such as [ray-project#20050](https://buildkite.com/ray-project/postmerge/builds/20050) aren't affected, because the step's branch guard skips them before the fetch. ## IAM grant needed (CI infra) This PR doesn't fix the access. It makes the failure say what's wrong. For the step to work, the CI stack needs this grant: - **Principal:** `bk-runner-queue-small-branch-Role`, the role of the postmerge runner queue this step lands on. The step sets no `instance_type`, so it runs on the default small queue. - **Action:** `secretsmanager:GetSecretValue` - **Resource:** the `oss-ci/rtd-api-token` secret in `us-west-2`, account `029272617770`. Scope it to that one secret ARN, not a wildcard. The token is deliberately isolated from other steps. - If the secret uses a customer-managed KMS key, the role also needs `kms:Decrypt` on that key. `fossa analyze` (`.buildkite/others.rayci.yml`) reads `oss-ci/fossa-api-key` the same way from an `instance_type: small` step, so the grant should follow whatever pattern covers that secret. Until the grant lands, this step keeps failing on master postmerge builds, now with a clear message. It doesn't block master. If the release-candidate noise is a problem in the meantime, re-adding a `disabled` tag to the step turns it off, as the step comment describes. ## Not a duplicate No open PR touches the redirect apply step. This follows up on ray-project#66024 and ray-project#66427. ## Testing - Pulled the command block out of the YAML, replaced `$$` with `$` as Buildkite does, and ran the apply branch under `bash -elc` with a stub `aws`: - `AccessDeniedException`, exit 254: the step prints the new error and exits 1 without calling `apply`. - Empty secret value: the step prints the new error and exits 1. - Non-empty value: the token is exported and reaches `rtd-redirects apply`. - `pre-commit run --files .buildkite/doc.rayci.yml`: the generic whitespace, end-of-file, and large-file hooks passed. No language-specific hook applies to this file. - No Buildkite run. The step is `skip-on-premerge`, so a PR build can't exercise it. Its first real run is the next master postmerge build after merge. ## AI assistance AI assistance (Claude Code) prepared this change and ran the checks above. The submitter reviews every changed line before merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two changes to the postmerge
:book: doc: apply redirectsstep in.buildkite/doc.rayci.yml:get-secret-valuefails or returns an empty value. Previouslyexport RTD_API_TOKEN="$(aws ...)"returnedexport's status rather thanaws's. The step fell through tortd-redirects applywith an empty token, which failed withRTD_API_TOKEN is not set. Export your RtD API token before running.That message reads like a local-environment problem and hides the real AWS error a few lines up.Why: the step has never been able to read its token
Every master postmerge run of this step since it was enabled in #66024 and reworked in #66427 has failed at the secret fetch, for example postmerge #20026 and #20049. The job log shows:
The
oss-ci/rtd-api-tokensecret exists, but the runner role can't read it. Release-branch builds such as #20050 aren't affected, because the step's branch guard skips them before the fetch.IAM grant needed (CI infra)
This PR doesn't fix the access. It makes the failure say what's wrong. For the step to work, the CI stack needs this grant:
bk-runner-queue-small-branch-Role, the role of the postmerge runner queue this step lands on. The step sets noinstance_type, so it runs on the default small queue.secretsmanager:GetSecretValueoss-ci/rtd-api-tokensecret inus-west-2, account029272617770. Scope it to that one secret ARN, not a wildcard. The token is deliberately isolated from other steps.kms:Decrypton that key.fossa analyze(.buildkite/others.rayci.yml) readsoss-ci/fossa-api-keythe same way from aninstance_type: smallstep, so the grant should follow whatever pattern covers that secret.Until the grant lands, this step keeps failing on master postmerge builds, now with a clear message. It doesn't block master. If the release-candidate noise is a problem in the meantime, re-adding a
disabledtag to the step turns it off, as the step comment describes.Not a duplicate
No open PR touches the redirect apply step. This follows up on #66024 and #66427.
Testing
$$with$as Buildkite does, and ran the apply branch underbash -elcwith a stubaws:AccessDeniedException, exit 254: the step prints the new error and exits 1 without callingapply.rtd-redirects apply.pre-commit run --files .buildkite/doc.rayci.yml: the generic whitespace, end-of-file, and large-file hooks passed. No language-specific hook applies to this file.skip-on-premerge, so a PR build can't exercise it. Its first real run is the next master postmerge build after merge.AI assistance
AI assistance (Claude Code) prepared this change and ran the checks above. The submitter reviews every changed line before merge.
🤖 Generated with Claude Code