Skip to content

Enable the postmerge redirect apply step for docs.ray.io - #66024

Merged
dstrodtman merged 2 commits into
masterfrom
doc-1300-enable-redirect-apply
Sep 18, 2026
Merged

dstrodtman merged 2 commits into
masterfrom
doc-1300-enable-redirect-apply

Conversation

@dstrodtman

@dstrodtman dstrodtman commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

What

Two changes:

  1. Enable the postmerge redirect apply step in .buildkite/doc.rayci.yml by removing its disabled tag, and update doc/redirects/README.md so the authoring flow documents that redirect application is now automatic.
  2. Fix one redirect in doc/redirects/current.yaml: /data/dataset.html pointed at /en/master/data/api/dataset.html, hard-pinning a version-agnostic page rule to the master build. Point it at the version-less /data/api/dataset.html like every other page rule in the file, so a reader who hits the legacy path stays on their own docs version instead of being bounced to master.

Enabling the step is the enable half of #65866, which deliberately landed the step disabled as a one-line follow-up so the live anyscale-ray Read the Docs project could be reconciled to doc/redirects/current.yaml under the manual-apply phase before automation took over.

Why now

The live anyscale-ray project has been reconciled to current.yaml under the manual-apply phase, so rtd-redirects plan now reports only the single intentional /data/dataset.html update this PR introduces (0 add / 1 update / 0 delete / 0 reorder). Bundling that one-line fix here makes the first automated postmerge run a small, fully reviewed apply — the redirect goes live exactly when automation turns on — rather than a hard reconcile of a drifted project.

The step's safety properties are unchanged from #65866: it's skip-on-premerge (postmerge-only, never runs on a PR or fork build), self-gates on the doc/redirects/ diff so unrelated master merges are a no-op, reads its token only from the dedicated least-privilege oss-ci/rtd-api-token secret, and fails without blocking master.

Not a duplicate

No open PR touches the redirect steps in .buildkite/doc.rayci.yml. This is the deferred enable step for #65866, not a competing change.

Testing

  • rtd-redirects plan --project anyscale-ray --file doc/redirects/current.yaml → 0 add, 1 update, 0 delete, 0 reorder; the single update is ~ /data/dataset.html -> /data/api/dataset.html (page). Read-only; confirms the live project matches the file except for the one intentional fix this PR applies.
  • rtd-redirects validate doc/redirects/current.yaml → 0 errors (44 pre-existing chain warnings, unchanged by this PR; all are false positives against version-agnostic catch-all rules that only fire on 404).
  • No local Buildkite run: the step is postmerge-only by construction and can't be exercised from a PR build. Its first real run is this merge.

Known follow-up: confirm the OSS CI IAM role can read the oss-ci/rtd-api-token secret. If it can't, the step fails at the secret fetch without blocking master, and the enable half of this PR is a clean one-line revert.

AI assistance

AI assistance (Claude Code) prepared this change and ran the plan and validate checks above. The submitter reviews every changed line before merge.

🤖 Generated with Claude Code

@dstrodtman
dstrodtman requested review from a team as code owners September 9, 2026 16:05

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request enables the automated Read the Docs (RtD) redirect application step in Buildkite by removing the disabled tag and updates the documentation to reflect this change. However, a critical issue was identified where the environment variable RTD_API_TOKEN will not persist across separate Buildkite command blocks, which will cause the step to fail. It is recommended to combine the token retrieval and the execution command into a single multi-line command block.

Comment thread .buildkite/doc.rayci.yml
tags:
- oss
- skip-on-premerge
- disabled

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Enabling this step will result in a failure because of how Buildkite executes commands. In Buildkite, each item in the commands list is executed in a separate shell process. Therefore, the environment variable RTD_API_TOKEN exported in the set +x block (lines 246-248) will not persist when rtd-redirects apply runs in the subsequent command block (line 249).

To fix this, you should combine the token retrieval and the rtd-redirects apply command into a single multi-line command block:

      - |
        set +x
        export RTD_API_TOKEN="$$(aws secretsmanager get-secret-value --region us-west-2 --secret-id oss-ci/rtd-api-token --query SecretString --output text)"
        rtd-redirects apply --project anyscale-ray --file doc/redirects/current.yaml --yes --strict

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the flag. I don't think the token is actually lost here, but I'm routing the final call to someone who owns our Buildkite/rayci wiring rather than deciding it myself.

Analysis: rayci passes commands straight through to Buildkite (the key is in commandStepAllowedKeys and isn't transformed), and Buildkite runs a step's entire commands list as a single script in one shell process, so RTD_API_TOKEN exported in the - | block persists to the apply item. It's the same single-shell assumption the set +x persists to apply below comment just above already relies on, so if the token didn't persist that comment would be wrong too.

That said, folding apply into the preceding - | block is correct under either interpretation and removes the ambiguity, so it's worth doing regardless. The only change is indenting the apply line into the block above:

      - |
        set +x
        export RTD_API_TOKEN="$$(aws secretsmanager get-secret-value --region us-west-2 --secret-id oss-ci/rtd-api-token --query SecretString --output text)"
        rtd-redirects apply --project anyscale-ray --file doc/redirects/current.yaml --yes --strict

@elliot-barn, could you make the call here? Does a commands list run as one shell (my read) or one shell per item (Gemini's)? If it's the latter this edit is a required fix; if the former it's harmless hardening. Happy to apply it either way once you confirm.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gemini is wrong

@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core devprod labels Sep 9, 2026
@dstrodtman dstrodtman added the go add ONLY when ready to merge, run all tests label Sep 18, 2026
dstrodtman and others added 2 commits September 18, 2026 12:03
The merge-time `rtd-redirects apply` step in .buildkite/doc.rayci.yml landed
disabled so the live anyscale-ray Read the Docs project could be reconciled to
doc/redirects/current.yaml under the manual-apply phase before automation took
over. `rtd-redirects plan` against the live project now reports no changes, so
drop the `disabled` tag and let the step run.

The step is unchanged otherwise: postmerge-only (`skip-on-premerge`), self-gated
on the doc/redirects/ diff, and reads its RtD token only from the dedicated
least-privilege `oss-ci/rtd-api-token` secret. With a clean plan the first
automated run is a no-op rather than a hard reconcile. On failure it fails
without blocking master.

Update doc/redirects/README.md so the authoring flow documents the automated
apply instead of the manual maintainer step.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
The `/data/dataset.html` page redirect pointed at `/en/master/data/api/dataset.html`,
hard-pinning a version-agnostic rule to the master build. A reader on the stable
docs who hit the legacy path was bounced to master instead of staying on their
version. `/data/api/dataset.html` exists on both latest and master, so point the
rule at the version-less path like the other `type: page` rules in this file.

Signed-off-by: Douglas Strodtman <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
@dstrodtman
dstrodtman force-pushed the doc-1300-enable-redirect-apply branch from 75d0c8b to 2e6745c Compare September 18, 2026 16:04

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2e6745c. Configure here.

type: page
- from: /data/dataset.html
to: /en/master/data/api/dataset.html
to: /data/api/dataset.html

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Undeclared redirect change goes live

Medium Severity

This PR also rewrites the to path for the /data/dataset.html page redirect in current.yaml. The same change enables the postmerge apply step, and this merge touches doc/redirects/, so that rewrite is pushed to the live anyscale-ray project on merge. The first automated run is then not the no-op that plan reported, and two other page rules still keep /en/master/ destinations.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2e6745c. Configure here.

@dstrodtman
dstrodtman merged commit 3924d32 into master Sep 18, 2026
6 checks passed
@dstrodtman
dstrodtman deleted the doc-1300-enable-redirect-apply branch September 18, 2026 17:49
dstrodtman added a commit that referenced this pull request Sep 24, 2026
…66427)

## Why are these changes needed?

The postmerge `doc: apply redirects` step, enabled in #66024, has failed
on every run since it was turned on, and it never applied a redirect
change. The one change that merged since then, the `/data/dataset.html`
target updated in #66024 itself, didn't reach Read the Docs until a
maintainer applied it by hand.

There are two problems, and both come from the `HEAD~1..HEAD` gate at
the top of the step:

1. **The gate checks the wrong range.** The step isn't scheduled on
every master merge. In the postmerge builds since 2026-09-18, it appears
only in the full builds that release automation triggers, a few times a
day, and not in the per-merge builds. A `git diff HEAD~1 HEAD --
doc/redirects/` check sees only the single commit that build is on, so a
redirect merge that isn't that commit is never applied.
2. **The skip path reports failure.** All 12 runs from [postmerge
#19792](https://buildkite.com/ray-project/postmerge/builds/19792)
through
[#19893](https://buildkite.com/ray-project/postmerge/builds/19893)
logged `no doc/redirects/ change in this merge; nothing to apply`, then
`logout`, then `The command exited with status 1`. The command runs
under `bash -elic`, so the `exit 0` likely goes through login-shell
logout handling. I inferred that cause from the log and couldn't
reproduce it locally.

This PR replaces the gate with two changes:

- **Converge on every run.** `rtd-redirects apply` already converges:
when the live project matches `current.yaml`, it makes only read calls,
prints `apply: no changes`, and exits 0 (`cli.py` in
anyscale-rtd-redirects 0.2.0). A redirect merge now goes live on the
next postmerge run of the step, not only when it happens to be that
build's commit.
- **Guard against stale checkouts.** Release automation triggers
postmerge with its own branch and commit
(`.buildkite/release-automation/pre_release.rayci.yml`). In September,
18 of the 88 full postmerge builds ran on `releases/*`. Because `apply`
deletes live redirects that aren't in the file, applying an older
`current.yaml` would roll back newer redirects. The step now applies
only on a `master` build whose `doc/redirects/` matches the freshly
fetched `origin/master`. Otherwise it logs why it skipped and passes. It
skips the same way if the fetch fails. Cursor Bugbot flagged this on the
first revision.

The skip path no longer calls `exit`, and the token is fetched only when
the step applies. The step comment and `doc/redirects/README.md` are
updated to match. The step is still `skip-on-premerge` and still reads
the dedicated `oss-ci/rtd-api-token` secret.

## Related PRs

- #66024 enabled the step.
- #65866 added it, disabled.
- Duplicate check: no open PR touches this step. I searched open PRs for
"redirect apply" and reviewed the open redirect PR #66027, which stages
release-gated redirects and doesn't change the apply gate.

## Testing

- `pre-commit run --files .buildkite/doc.rayci.yml
doc/redirects/README.md`: passes.
- Parsed `.buildkite/doc.rayci.yml` with `yaml.safe_load` and confirmed
the `doc_redirects_apply` commands are the file guard, the pinned
install, and the guarded apply block.
- Extracted the guarded block, with the token fetch and `apply` replaced
by fakes, and ran it with `bash -e` in a scratch git repo against a
local bare `origin`:
    - `master` at the tip: applies.
    - Older `master` SHA with the same `doc/redirects/`: applies.
    - `releases/2.50.0`: skips, exit 0.
- Older `master` SHA whose `doc/redirects/` has since changed: skips,
exit 0.
- Fetch fails: skips with its own message, exit 0. The fetch runs only
on `master` builds, and a missed apply converges on the next run.
- `rtd-redirects plan --project anyscale-ray --file
doc/redirects/current.yaml --strict` with 0.2.0 against the live project
showed the one missed update. `apply --strict --yes` applied it (`1
updated`), and a follow-up `plan` reports `0 add, 0 update, 0 delete, 0
reorder`. `https://docs.ray.io/en/latest/data/dataset.html` now 301s to
`/en/latest/data/api/dataset.html`.
- The step runs only on postmerge, so this PR's CI doesn't exercise it.
The check is the first postmerge run after merge: it should log `apply:
no changes` and pass.

## AI assistance

This PR was prepared with AI assistance (Claude Code). I reviewed every
changed line and the Buildkite evidence above.

🤖 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]>
dstrodtman added a commit that referenced this pull request Oct 1, 2026
…ch fails (#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 #66024
and reworked in #66427 has failed at the secret fetch, for example
[postmerge
#20026](https://buildkite.com/ray-project/postmerge/builds/20026) and
[#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
[#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 #66024
and #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]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…#66024)

## What

Two changes:

1. Enable the postmerge redirect apply step in
`.buildkite/doc.rayci.yml` by removing its `disabled` tag, and update
`doc/redirects/README.md` so the authoring flow documents that redirect
application is now automatic.
2. Fix one redirect in `doc/redirects/current.yaml`:
`/data/dataset.html` pointed at `/en/master/data/api/dataset.html`,
hard-pinning a version-agnostic `page` rule to the master build. Point
it at the version-less `/data/api/dataset.html` like every other `page`
rule in the file, so a reader who hits the legacy path stays on their
own docs version instead of being bounced to master.

Enabling the step is the enable half of ray-project#65866, which deliberately
landed the step disabled as a one-line follow-up so the live
`anyscale-ray` Read the Docs project could be reconciled to
`doc/redirects/current.yaml` under the manual-apply phase before
automation took over.

## Why now

The live `anyscale-ray` project has been reconciled to `current.yaml`
under the manual-apply phase, so `rtd-redirects plan` now reports only
the single intentional `/data/dataset.html` update this PR introduces
(`0 add / 1 update / 0 delete / 0 reorder`). Bundling that one-line fix
here makes the first automated postmerge run a small, fully reviewed
apply — the redirect goes live exactly when automation turns on — rather
than a hard reconcile of a drifted project.

The step's safety properties are unchanged from ray-project#65866: it's
`skip-on-premerge` (postmerge-only, never runs on a PR or fork build),
self-gates on the `doc/redirects/` diff so unrelated master merges are a
no-op, reads its token only from the dedicated least-privilege
`oss-ci/rtd-api-token` secret, and fails without blocking master.

## Not a duplicate

No open PR touches the redirect steps in `.buildkite/doc.rayci.yml`.
This is the deferred enable step for ray-project#65866, not a competing change.

## Testing

- `rtd-redirects plan --project anyscale-ray --file
doc/redirects/current.yaml` → `0 add, 1 update, 0 delete, 0 reorder`;
the single update is `~ /data/dataset.html -> /data/api/dataset.html
(page)`. Read-only; confirms the live project matches the file except
for the one intentional fix this PR applies.
- `rtd-redirects validate doc/redirects/current.yaml` → 0 errors (44
pre-existing chain warnings, unchanged by this PR; all are false
positives against version-agnostic catch-all rules that only fire on
404).
- No local Buildkite run: the step is postmerge-only by construction and
can't be exercised from a PR build. Its first real run is this merge.

Known follow-up: confirm the OSS CI IAM role can read the
`oss-ci/rtd-api-token` secret. If it can't, the step fails at the secret
fetch without blocking master, and the enable half of this PR is a clean
one-line revert.

## AI assistance

AI assistance (Claude Code) prepared this change and ran the `plan` and
`validate` 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 4.8 <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…ay-project#66427)

## Why are these changes needed?

The postmerge `doc: apply redirects` step, enabled in ray-project#66024, has failed
on every run since it was turned on, and it never applied a redirect
change. The one change that merged since then, the `/data/dataset.html`
target updated in ray-project#66024 itself, didn't reach Read the Docs until a
maintainer applied it by hand.

There are two problems, and both come from the `HEAD~1..HEAD` gate at
the top of the step:

1. **The gate checks the wrong range.** The step isn't scheduled on
every master merge. In the postmerge builds since 2026-09-18, it appears
only in the full builds that release automation triggers, a few times a
day, and not in the per-merge builds. A `git diff HEAD~1 HEAD --
doc/redirects/` check sees only the single commit that build is on, so a
redirect merge that isn't that commit is never applied.
2. **The skip path reports failure.** All 12 runs from [postmerge
ray-project#19792](https://buildkite.com/ray-project/postmerge/builds/19792)
through
[ray-project#19893](https://buildkite.com/ray-project/postmerge/builds/19893)
logged `no doc/redirects/ change in this merge; nothing to apply`, then
`logout`, then `The command exited with status 1`. The command runs
under `bash -elic`, so the `exit 0` likely goes through login-shell
logout handling. I inferred that cause from the log and couldn't
reproduce it locally.

This PR replaces the gate with two changes:

- **Converge on every run.** `rtd-redirects apply` already converges:
when the live project matches `current.yaml`, it makes only read calls,
prints `apply: no changes`, and exits 0 (`cli.py` in
anyscale-rtd-redirects 0.2.0). A redirect merge now goes live on the
next postmerge run of the step, not only when it happens to be that
build's commit.
- **Guard against stale checkouts.** Release automation triggers
postmerge with its own branch and commit
(`.buildkite/release-automation/pre_release.rayci.yml`). In September,
18 of the 88 full postmerge builds ran on `releases/*`. Because `apply`
deletes live redirects that aren't in the file, applying an older
`current.yaml` would roll back newer redirects. The step now applies
only on a `master` build whose `doc/redirects/` matches the freshly
fetched `origin/master`. Otherwise it logs why it skipped and passes. It
skips the same way if the fetch fails. Cursor Bugbot flagged this on the
first revision.

The skip path no longer calls `exit`, and the token is fetched only when
the step applies. The step comment and `doc/redirects/README.md` are
updated to match. The step is still `skip-on-premerge` and still reads
the dedicated `oss-ci/rtd-api-token` secret.

## Related PRs

- ray-project#66024 enabled the step.
- ray-project#65866 added it, disabled.
- Duplicate check: no open PR touches this step. I searched open PRs for
"redirect apply" and reviewed the open redirect PR ray-project#66027, which stages
release-gated redirects and doesn't change the apply gate.

## Testing

- `pre-commit run --files .buildkite/doc.rayci.yml
doc/redirects/README.md`: passes.
- Parsed `.buildkite/doc.rayci.yml` with `yaml.safe_load` and confirmed
the `doc_redirects_apply` commands are the file guard, the pinned
install, and the guarded apply block.
- Extracted the guarded block, with the token fetch and `apply` replaced
by fakes, and ran it with `bash -e` in a scratch git repo against a
local bare `origin`:
    - `master` at the tip: applies.
    - Older `master` SHA with the same `doc/redirects/`: applies.
    - `releases/2.50.0`: skips, exit 0.
- Older `master` SHA whose `doc/redirects/` has since changed: skips,
exit 0.
- Fetch fails: skips with its own message, exit 0. The fetch runs only
on `master` builds, and a missed apply converges on the next run.
- `rtd-redirects plan --project anyscale-ray --file
doc/redirects/current.yaml --strict` with 0.2.0 against the live project
showed the one missed update. `apply --strict --yes` applied it (`1
updated`), and a follow-up `plan` reports `0 add, 0 update, 0 delete, 0
reorder`. `https://docs.ray.io/en/latest/data/dataset.html` now 301s to
`/en/latest/data/api/dataset.html`.
- The step runs only on postmerge, so this PR's CI doesn't exercise it.
The check is the first postmerge run after merge: it should log `apply:
no changes` and pass.

## AI assistance

This PR was prepared with AI assistance (Claude Code). I reviewed every
changed line and the Buildkite evidence above.

🤖 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]>
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Issues that should be addressed in Ray Core devprod docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants