Skip to content

Commit c0a4142

Browse files
authored
ci(bedrock): enable OIDC web identity recording (ogx-ai#6169)
## Summary - add an optional Bedrock recording path for the STS web identity auth introduced in ogx-ai#5388 - when AWS_BEDROCK_ROLE_ARN is configured, request a GitHub OIDC token for sts.amazonaws.com and expose AWS_ROLE_ARN/AWS_WEB_IDENTITY_TOKEN_FILE to the Bedrock provider - keep the current bearer-token path as fallback when AWS_BEDROCK_ROLE_ARN is not configured - pass standard AWS credential-chain env vars through Docker integration test runs ## Context ogx-ai#6167 preserved compatibility between AWS_BEDROCK_BEARER_TOKEN and the legacy AWS_BEARER_TOKEN_BEDROCK name. That PR is now merged. The remaining question from the failed Bedrock re-record is whether CI ever moved onto the STS/OIDC auth path from ogx-ai#5388. The provider already supports SigV4 + web identity, but the record workflow did not prepare AWS_ROLE_ARN/AWS_WEB_IDENTITY_TOKEN_FILE for Bedrock. This PR wires that optional path without removing the bearer-token fallback. To use it, configure an AWS_BEDROCK_ROLE_ARN repository secret for the role trusted by GitHub Actions OIDC. ## Test Plan - uv run pytest tests/unit/providers/inference/test_bedrock_config.py tests/unit/providers/inference/bedrock/test_sigv4_auth.py -q - uv run pre-commit run check-yaml --files .github/workflows/record-integration-tests.yml - uv run pre-commit run actionlint --files .github/workflows/record-integration-tests.yml - pre-commit via git commit hooks from original commit Signed-off-by: Sumanth Kamenani <skamenan@redhat.com>
1 parent 0f5e0cc commit c0a4142

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/record-integration-tests.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,30 @@ jobs:
283283
suite: ${{ inputs.suite || matrix.provider.suite }}
284284
inference-mode: 'record-if-missing'
285285

286+
- name: Prepare AWS web identity for Bedrock
287+
if: steps.should_run.outputs.run == 'true' && matrix.provider.setup == 'bedrock'
288+
env:
289+
AWS_BEDROCK_ROLE_ARN: ${{ secrets.AWS_BEDROCK_ROLE_ARN }}
290+
run: |
291+
set -euo pipefail
292+
293+
if [[ -z "${AWS_BEDROCK_ROLE_ARN}" ]]; then
294+
echo "AWS_BEDROCK_ROLE_ARN is not configured; using Bedrock bearer token or default AWS credential chain."
295+
exit 0
296+
fi
297+
298+
token_file="${RUNNER_TEMP}/bedrock-web-identity-token"
299+
curl -fsSL \
300+
-H "Authorization: bearer ${ACTIONS_ID_TOKEN_REQUEST_TOKEN}" \
301+
"${ACTIONS_ID_TOKEN_REQUEST_URL}&audience=sts.amazonaws.com" \
302+
| jq -r '.value' > "${token_file}"
303+
304+
{
305+
echo "AWS_ROLE_ARN=${AWS_BEDROCK_ROLE_ARN}"
306+
echo "AWS_WEB_IDENTITY_TOKEN_FILE=${token_file}"
307+
echo "AWS_DEFAULT_REGION=us-west-2"
308+
} >> "${GITHUB_ENV}"
309+
286310
- name: Run and record tests
287311
if: steps.should_run.outputs.run == 'true'
288312
uses: ogx-ai/ogx/.github/actions/run-and-record-tests@e1ba4f9f10fa45750f5b4f186a0c4ae59bc93e4d

scripts/integration-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,12 @@ if [[ "$STACK_CONFIG" == *"docker:"* && "$COLLECT_ONLY" == false ]]; then
506506
[ -n "${AWS_BEDROCK_BEARER_TOKEN:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e AWS_BEDROCK_BEARER_TOKEN=$AWS_BEDROCK_BEARER_TOKEN"
507507
[ -n "${AWS_BEARER_TOKEN_BEDROCK:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e AWS_BEARER_TOKEN_BEDROCK=$AWS_BEARER_TOKEN_BEDROCK"
508508
[ -n "${AWS_DEFAULT_REGION:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION"
509+
[ -n "${AWS_ACCESS_KEY_ID:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID"
510+
[ -n "${AWS_SECRET_ACCESS_KEY:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY"
511+
[ -n "${AWS_SESSION_TOKEN:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN"
512+
[ -n "${AWS_ROLE_ARN:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e AWS_ROLE_ARN=$AWS_ROLE_ARN"
513+
[ -n "${AWS_WEB_IDENTITY_TOKEN_FILE:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e AWS_WEB_IDENTITY_TOKEN_FILE=$AWS_WEB_IDENTITY_TOKEN_FILE"
514+
[ -n "${AWS_ROLE_SESSION_NAME:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e AWS_ROLE_SESSION_NAME=$AWS_ROLE_SESSION_NAME"
509515
[ -n "${VERTEX_AI_PROJECT:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e VERTEX_AI_PROJECT=$VERTEX_AI_PROJECT"
510516
[ -n "${VERTEX_AI_LOCATION:-}" ] && DOCKER_ENV_VARS="$DOCKER_ENV_VARS -e VERTEX_AI_LOCATION=$VERTEX_AI_LOCATION"
511517

0 commit comments

Comments
 (0)